class LogStash::Codecs::IdentityMapCodec::PeriodicRunner
Public Class Methods
new(listener, interval, method_symbol)
click to toggle source
# File lib/logstash/codecs/identity_map_codec.rb, line 42 def initialize(listener, interval, method_symbol) @listener, @interval = listener, interval @method_symbol = method_symbol @running = Concurrent::AtomicBoolean.new(false) end
Public Instance Methods
running?()
click to toggle source
# File lib/logstash/codecs/identity_map_codec.rb, line 61 def running? @running.value end
start()
click to toggle source
# File lib/logstash/codecs/identity_map_codec.rb, line 48 def start return self if running? @running.make_true @thread = Thread.new() do while running? do sleep @interval break if !running? @listener.send(@method_symbol) end end self end
stop()
click to toggle source
# File lib/logstash/codecs/identity_map_codec.rb, line 65 def stop return if !running? @running.make_false if @thread.alive? @thread.wakeup @thread.join end @listener = nil end