Class: Flor::UnitExecutor
- Defined in:
- lib/flor/unit/executor.rb
Instance Attribute Summary collapse
-
#consumed ⇒ Object
readonly
Returns the value of attribute consumed.
-
#exid ⇒ Object
readonly
Returns the value of attribute exid.
Attributes inherited from Executor
#execution, #hooks, #traps, #unit
Instance Method Summary collapse
- #alive? ⇒ Boolean
-
#initialize(unit, messages) ⇒ UnitExecutor
constructor
A new instance of UnitExecutor.
- #run ⇒ Object
- #shutdown ⇒ Object
Methods inherited from Executor
#conf, #counter, #counter_add, #counter_next, #node, #traps_and_hooks, #trigger_block, #trigger_hook, #trigger_trap, #vars
Constructor Details
#initialize(unit, messages) ⇒ UnitExecutor
Returns a new instance of UnitExecutor.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/flor/unit/executor.rb', line 10 def initialize(unit, ) @exid = .first[:exid] super( unit, unit.loader.load_hooks(@exid), unit.storage.fetch_traps(@exid), unit.storage.load_execution(@exid)) @messages = .collect { |m| Flor::Storage .from_blob(m[:content]) .tap { |mm| mm['mid'] = m[:id].to_i } } @consumed = [] @alive = true @shutdown = false @thread = nil end |
Instance Attribute Details
#consumed ⇒ Object (readonly)
Returns the value of attribute consumed.
8 9 10 |
# File 'lib/flor/unit/executor.rb', line 8 def consumed @consumed end |
#exid ⇒ Object (readonly)
Returns the value of attribute exid.
7 8 9 |
# File 'lib/flor/unit/executor.rb', line 7 def exid @exid end |
Instance Method Details
#alive? ⇒ Boolean
33 |
# File 'lib/flor/unit/executor.rb', line 33 def alive?; @alive; end |
#run ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/flor/unit/executor.rb', line 35 def run @thread = Thread.new { do_run } #p [ :unit_executor, :thread, @thread.object_id ] self end |
#shutdown ⇒ Object
43 44 45 46 47 |
# File 'lib/flor/unit/executor.rb', line 43 def shutdown @shutdown = true @thread.join end |