Class: Bolt::Notifier

Inherits:
Object
  • Object
show all
Defined in:
lib/bolt/notifier.rb

Instance Method Summary collapse

Constructor Details

#initialize(executor = Concurrent::SingleThreadExecutor.new) ⇒ Notifier

Returns a new instance of Notifier.



7
8
9
# File 'lib/bolt/notifier.rb', line 7

def initialize(executor = Concurrent::SingleThreadExecutor.new)
  @executor = executor
end

Instance Method Details

#notify(callback, event) ⇒ Object



11
12
13
14
15
# File 'lib/bolt/notifier.rb', line 11

def notify(callback, event)
  @executor.post do
    callback.call(event)
  end
end

#shutdownObject



17
18
19
20
# File 'lib/bolt/notifier.rb', line 17

def shutdown
  @executor.shutdown
  @executor.wait_for_termination
end