Class: Euston::DaemonComponentHost
- Inherits:
-
Object
- Object
- Euston::DaemonComponentHost
- Includes:
- Euston::Daemons::Exceptions, Hollywood
- Defined in:
- lib/euston-daemons/euston/daemon_component_host.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#wait_time ⇒ Object
writeonly
Sets the attribute wait_time.
Instance Method Summary collapse
-
#initialize(logger, name, client, owner) ⇒ DaemonComponentHost
constructor
A new instance of DaemonComponentHost.
- #start ⇒ Object
- #stop ⇒ Object
- #thread_state ⇒ Object
Methods included from Euston::Daemons::Exceptions
Constructor Details
#initialize(logger, name, client, owner) ⇒ DaemonComponentHost
Returns a new instance of DaemonComponentHost.
6 7 8 |
# File 'lib/euston-daemons/euston/daemon_component_host.rb', line 6 def initialize logger, name, client, owner @log, @name, @client, @owner = logger, name, client, owner end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/euston-daemons/euston/daemon_component_host.rb', line 10 def name @name end |
#wait_time=(value) ⇒ Object
Sets the attribute wait_time
11 12 13 |
# File 'lib/euston-daemons/euston/daemon_component_host.rb', line 11 def wait_time=(value) @wait_time = value end |
Instance Method Details
#start ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/euston-daemons/euston/daemon_component_host.rb', line 13 def start @thread = Thread.new do while_thread_is_running do begin @client.run rescue => e Thread.current[:exception] = e end report_exceptions end end end |
#stop ⇒ Object
27 28 29 30 |
# File 'lib/euston-daemons/euston/daemon_component_host.rb', line 27 def stop @client.stop @thread[:stop] = true end |
#thread_state ⇒ Object
32 33 34 |
# File 'lib/euston-daemons/euston/daemon_component_host.rb', line 32 def thread_state @thread.status end |