Class: Dynflow::Middleware::Common::Singleton
- Inherits:
-
Dynflow::Middleware
- Object
- Dynflow::Middleware
- Dynflow::Middleware::Common::Singleton
- Defined in:
- lib/dynflow/middleware/common/singleton.rb
Instance Method Summary collapse
-
#plan(*args) ⇒ Object
Each action tries to acquire its own lock before the action’s #plan starts.
-
#run(*args) ⇒ Object
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.
Methods inherited from Dynflow::Middleware
#action, #delay, #finalize, #finalize_phase, #hook, #initialize, #pass, #plan_phase, #present
Constructor Details
This class inherits a constructor from Dynflow::Middleware
Instance Method Details
#plan(*args) ⇒ Object
Each action tries to acquire its own lock before the action’s #plan starts
6 7 8 9 |
# File 'lib/dynflow/middleware/common/singleton.rb', line 6 def plan(*args) action.singleton_lock! pass(*args) end |
#run(*args) ⇒ Object
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
14 15 16 17 |
# File 'lib/dynflow/middleware/common/singleton.rb', line 14 def run(*args) action.singleton_lock! unless action.holds_singleton_lock? pass(*args) end |