Class: LogStash::Codecs::AutoFlush
- Inherits:
-
Object
- Object
- LogStash::Codecs::AutoFlush
- Defined in:
- lib/logstash/codecs/auto_flush.rb
Instance Method Summary collapse
-
#initialize(mc, interval) ⇒ AutoFlush
constructor
A new instance of AutoFlush.
- #start ⇒ Object
- #stop ⇒ Object
- #stopped? ⇒ Boolean
- #timeout ⇒ Object
Constructor Details
#initialize(mc, interval) ⇒ AutoFlush
Returns a new instance of AutoFlush.
6 7 8 9 10 |
# File 'lib/logstash/codecs/auto_flush.rb', line 6 def initialize(mc, interval) @mc, @interval = mc, interval @stopped = Concurrent::AtomicBoolean.new # false by default @task = RetriggerableTask.new(@interval, self) end |
Instance Method Details
#start ⇒ Object
16 17 18 19 20 21 |
# File 'lib/logstash/codecs/auto_flush.rb', line 16 def start # can't start if pipeline is stopping return self if stopped? @task.retrigger self end |
#stop ⇒ Object
27 28 29 30 |
# File 'lib/logstash/codecs/auto_flush.rb', line 27 def stop @stopped.make_true @task.close end |
#stopped? ⇒ Boolean
23 24 25 |
# File 'lib/logstash/codecs/auto_flush.rb', line 23 def stopped? @stopped.value end |
#timeout ⇒ Object
12 13 14 |
# File 'lib/logstash/codecs/auto_flush.rb', line 12 def timeout @mc.auto_flush end |