lib/tamashii/agent/component.rb in tamashii-agent-0.2.1 vs lib/tamashii/agent/component.rb in tamashii-agent-0.2.3
- old
+ new
@@ -5,11 +5,12 @@
module Tamashii
module Agent
class Component
include Common::Loggable
- def initialize
+ def initialize(master)
+ @master = master
@event_queue = Queue.new
end
def send_event(event)
@event_queue.push(event)
@@ -24,9 +25,13 @@
def handle_new_event(non_block = false)
if ev = check_new_event(non_block)
process_event(ev)
end
ev
+ end
+
+ def restart_current_component_async
+ @master.send_event(Event.new(Event::RESTART_COMPONENT, self.class))
end
def process_event(event)
logger.debug "Got event: #{event.type}, #{event.body}"
end