Sha256: 8c72401a47d4208d43cfcfb44ae08053336cfcc74875bdbdf868772efecc91e4

Contents?: true

Size: 580 Bytes

Versions: 26

Compression:

Stored size: 580 Bytes

Contents

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

26 entries across 26 versions & 1 rubygems

Version Path
dynflow-1.3.0 lib/dynflow/middleware/common/singleton.rb
dynflow-1.2.3 lib/dynflow/middleware/common/singleton.rb
dynflow-1.2.2 lib/dynflow/middleware/common/singleton.rb
dynflow-1.2.1 lib/dynflow/middleware/common/singleton.rb
dynflow-1.2.0 lib/dynflow/middleware/common/singleton.rb
dynflow-1.2.0.pre1 lib/dynflow/middleware/common/singleton.rb
dynflow-1.1.6 lib/dynflow/middleware/common/singleton.rb
dynflow-1.1.5 lib/dynflow/middleware/common/singleton.rb
dynflow-1.1.4 lib/dynflow/middleware/common/singleton.rb
dynflow-1.1.3 lib/dynflow/middleware/common/singleton.rb
dynflow-1.1.2 lib/dynflow/middleware/common/singleton.rb
dynflow-1.1.1 lib/dynflow/middleware/common/singleton.rb
dynflow-1.1.0 lib/dynflow/middleware/common/singleton.rb
dynflow-1.0.5 lib/dynflow/middleware/common/singleton.rb
dynflow-1.0.4 lib/dynflow/middleware/common/singleton.rb
dynflow-1.0.3 lib/dynflow/middleware/common/singleton.rb
dynflow-1.0.2 lib/dynflow/middleware/common/singleton.rb
dynflow-1.0.1 lib/dynflow/middleware/common/singleton.rb
dynflow-1.0.0 lib/dynflow/middleware/common/singleton.rb
dynflow-0.8.37 lib/dynflow/middleware/common/singleton.rb