Class: Reacto::Resources::ExecutorResource
- Inherits:
-
Object
- Object
- Reacto::Resources::ExecutorResource
- Defined in:
- lib/reacto/resources/executor_resource.rb
Instance Method Summary collapse
- #cleanup ⇒ Object
-
#initialize(executor, threads: []) ⇒ ExecutorResource
constructor
A new instance of ExecutorResource.
Constructor Details
#initialize(executor, threads: []) ⇒ ExecutorResource
Returns a new instance of ExecutorResource.
4 5 6 7 |
# File 'lib/reacto/resources/executor_resource.rb', line 4 def initialize(executor, threads: []) @executor = executor @threads = threads end |
Instance Method Details
#cleanup ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/reacto/resources/executor_resource.rb', line 9 def cleanup @executor.shutdown unless @executor.nil? @executor = nil @threads.each do |thread| Thread.kill(thread) end @threads = [] end |