Class: Reacto::Resources::ExecutorResource

Inherits:
Object
  • Object
show all
Defined in:
lib/reacto/resources/executor_resource.rb

Instance Method Summary collapse

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

#cleanupObject



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