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
7 8 9 10 |
# File 'lib/dynflow/middleware/common/singleton.rb', line 7 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
15 16 17 18 |
# File 'lib/dynflow/middleware/common/singleton.rb', line 15 def run(*args) action.singleton_lock! unless action.holds_singleton_lock? pass(*args) end |