Class: Salemove::ProcessHandler::PivotProcess
- Inherits:
-
Object
- Object
- Salemove::ProcessHandler::PivotProcess
- Defined in:
- lib/salemove/process_handler/pivot_process.rb
Defined Under Namespace
Classes: ServiceSpawner
Instance Attribute Summary collapse
-
#exception_notifier ⇒ Object
readonly
Returns the value of attribute exception_notifier.
-
#process_monitor ⇒ Object
readonly
Returns the value of attribute process_monitor.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(messenger, env: 'development', notifier: nil, notifier_factory: NotifierFactory, process_monitor: ProcessMonitor.new) ⇒ PivotProcess
constructor
A new instance of PivotProcess.
- #spawn(service, blocking: true) ⇒ Object
Constructor Details
#initialize(messenger, env: 'development', notifier: nil, notifier_factory: NotifierFactory, process_monitor: ProcessMonitor.new) ⇒ PivotProcess
Returns a new instance of PivotProcess.
20 21 22 23 24 25 26 27 28 |
# File 'lib/salemove/process_handler/pivot_process.rb', line 20 def initialize(messenger, env: 'development', notifier: nil, notifier_factory: NotifierFactory, process_monitor: ProcessMonitor.new) @messenger = messenger @process_monitor = process_monitor @exception_notifier = notifier_factory.get_notifier(env, notifier) end |
Instance Attribute Details
#exception_notifier ⇒ Object (readonly)
Returns the value of attribute exception_notifier.
10 11 12 |
# File 'lib/salemove/process_handler/pivot_process.rb', line 10 def exception_notifier @exception_notifier end |
#process_monitor ⇒ Object (readonly)
Returns the value of attribute process_monitor.
10 11 12 |
# File 'lib/salemove/process_handler/pivot_process.rb', line 10 def process_monitor @process_monitor end |
Class Method Details
.logger ⇒ Object
12 13 14 |
# File 'lib/salemove/process_handler/pivot_process.rb', line 12 def self.logger @logger ||= Logger.new(STDOUT).tap { |l| l.level = Logger::INFO } end |
.logger=(logger) ⇒ Object
16 17 18 |
# File 'lib/salemove/process_handler/pivot_process.rb', line 16 def self.logger=(logger) @logger = logger end |
Instance Method Details
#spawn(service, blocking: true) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/salemove/process_handler/pivot_process.rb', line 30 def spawn(service, blocking: true) @process_monitor.start @service_thread = ServiceSpawner.spawn(service, @messenger, @exception_notifier) blocking ? wait_for_monitor : Thread.new { wait_for_monitor } end |