Sha256: 7e96d33b0aa571cc31217b725f6293a8201c6387c92cead8bfe5cfc54addbd99

Contents?: true

Size: 610 Bytes

Versions: 25

Compression:

Stored size: 610 Bytes

Contents

# frozen_string_literal: true
module Dynflow
  module Middleware::Common
    class Singleton < Middleware
      # Each action tries to acquire its own lock before the action's #plan starts
      def plan(*args)
        action.singleton_lock!
        pass(*args)
      end

      # At the start of #run we try to acquire action's lock unless it already holds it
      # At the end the action tries to unlock its own lock if the execution plan has no
      #   finalize phase
      def run(*args)
        action.singleton_lock! unless action.holds_singleton_lock?
        pass(*args)
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
dynflow-1.8.2 lib/dynflow/middleware/common/singleton.rb
dynflow-1.8.1 lib/dynflow/middleware/common/singleton.rb
dynflow-1.8.0 lib/dynflow/middleware/common/singleton.rb
dynflow-1.7.0 lib/dynflow/middleware/common/singleton.rb
dynflow-1.6.11 lib/dynflow/middleware/common/singleton.rb
dynflow-1.6.10 lib/dynflow/middleware/common/singleton.rb
dynflow-1.6.8 lib/dynflow/middleware/common/singleton.rb
dynflow-1.6.7 lib/dynflow/middleware/common/singleton.rb
dynflow-1.6.6 lib/dynflow/middleware/common/singleton.rb
dynflow-1.6.5 lib/dynflow/middleware/common/singleton.rb
dynflow-1.6.4 lib/dynflow/middleware/common/singleton.rb
dynflow-1.6.3 lib/dynflow/middleware/common/singleton.rb
dynflow-1.6.2 lib/dynflow/middleware/common/singleton.rb
dynflow-1.6.1 lib/dynflow/middleware/common/singleton.rb
dynflow-1.4.9 lib/dynflow/middleware/common/singleton.rb
dynflow-1.4.8 lib/dynflow/middleware/common/singleton.rb
dynflow-1.5.0 lib/dynflow/middleware/common/singleton.rb
dynflow-1.4.7 lib/dynflow/middleware/common/singleton.rb
dynflow-1.4.6 lib/dynflow/middleware/common/singleton.rb
dynflow-1.4.5 lib/dynflow/middleware/common/singleton.rb