Class: Fluent::DetachProcessManager
- Inherits:
-
Object
- Object
- Fluent::DetachProcessManager
- Includes:
- Singleton
- Defined in:
- lib/fluent/process.rb
Defined Under Namespace
Classes: Broker, DelayedForwarder, Forwarder, MultiForwarder
Instance Method Summary collapse
- #fork(forward_interval, delegate_object) ⇒ Object
-
#initialize ⇒ DetachProcessManager
constructor
A new instance of DetachProcessManager.
Constructor Details
#initialize ⇒ DetachProcessManager
Returns a new instance of DetachProcessManager.
37 38 39 40 41 |
# File 'lib/fluent/process.rb', line 37 def initialize require 'drb' DRb.start_service(create_drb_uri, Broker.new) @parent_uri = DRb.uri end |
Instance Method Details
#fork(forward_interval, delegate_object) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/fluent/process.rb', line 43 def fork(forward_interval, delegate_object) ipr, ipw = IO.pipe # child Engine.emit_stream -> parent Engine.emit_stream opr, opw = IO.pipe # parent target.emit -> child target.emit pid = Process.fork if pid # parent process ipw.close opr.close forward_thread = process_parent(ipr, opw, pid, forward_interval, delegate_object) return pid, forward_thread end # child process ipr.close opw.close forward_thread = process_child(ipw, opr, forward_interval, delegate_object) return nil, forward_thread end |