Class: LogStash::Codecs::IdentityMapCodec::MapCleaner
- Inherits:
-
Object
- Object
- LogStash::Codecs::IdentityMapCodec::MapCleaner
- Defined in:
- lib/logstash/codecs/identity_map_codec.rb
Instance Method Summary collapse
-
#initialize(imc, interval) ⇒ MapCleaner
constructor
A new instance of MapCleaner.
- #running? ⇒ Boolean
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(imc, interval) ⇒ MapCleaner
Returns a new instance of MapCleaner.
41 42 43 44 |
# File 'lib/logstash/codecs/identity_map_codec.rb', line 41 def initialize(imc, interval) @imc, @interval = imc, interval @running = false end |
Instance Method Details
#running? ⇒ Boolean
59 60 61 |
# File 'lib/logstash/codecs/identity_map_codec.rb', line 59 def running? @running end |
#start ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/logstash/codecs/identity_map_codec.rb', line 46 def start return self if running? @running = true @thread = Thread.new(@imc) do |imc| loop do sleep @interval break if !@running imc.map_cleanup end end self end |
#stop ⇒ Object
63 64 65 66 67 |
# File 'lib/logstash/codecs/identity_map_codec.rb', line 63 def stop return if !running? @running = false @thread.wakeup if @thread.alive? end |