Class: Micron::Runner::LivenessChecker
- Inherits:
-
Object
- Object
- Micron::Runner::LivenessChecker
- Includes:
- Debug
- Defined in:
- lib/micron/runner/liveness_checker.rb,
lib/micron/runner/liveness_checker/ping.rb,
lib/micron/runner/liveness_checker/pong.rb
Defined Under Namespace
Instance Method Summary collapse
- #fds ⇒ Object
-
#initialize ⇒ LivenessChecker
constructor
A new instance of LivenessChecker.
- #ping(pid) ⇒ Object
- #pong ⇒ Object
- #stop ⇒ Object
Methods included from Debug
Constructor Details
#initialize ⇒ LivenessChecker
Returns a new instance of LivenessChecker.
12 13 14 15 |
# File 'lib/micron/runner/liveness_checker.rb', line 12 def initialize @ping = IO.pipe @pong = IO.pipe end |
Instance Method Details
#fds ⇒ Object
33 34 35 |
# File 'lib/micron/runner/liveness_checker.rb', line 33 def fds (@ping + @pong).map { |f| f.to_i } end |
#ping(pid) ⇒ Object
17 18 19 20 21 |
# File 'lib/micron/runner/liveness_checker.rb', line 17 def ping(pid) @pinger = Ping.new(@pong.first, @ping.last, pid) @ping.first.close @pong.last.close end |
#pong ⇒ Object
23 24 25 26 27 |
# File 'lib/micron/runner/liveness_checker.rb', line 23 def pong @ponger = Pong.new(@ping.first, @pong.last) @ping.last.close @pong.first.close end |
#stop ⇒ Object
29 30 31 |
# File 'lib/micron/runner/liveness_checker.rb', line 29 def stop @pinger.thread.kill end |