Method: Fluent::Plugin::Output#after_shutdown

Defined in:
lib/fluent/plugin/output.rb

#after_shutdownObject



563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
# File 'lib/fluent/plugin/output.rb', line 563

def after_shutdown
  try_rollback_all if @buffering && !@as_secondary # rollback regardless with @delayed_commit, because secondary may do it
  @secondary.after_shutdown if @secondary

  if @buffering && @buffer
    @buffer.after_shutdown

    @output_flush_threads_running = false
    if @output_flush_threads && !@output_flush_threads.empty?
      @output_flush_threads.each do |state|
        # to wakeup thread and make it to stop by itself
        state.mutex.synchronize {
          if state.thread && state.thread.status
            state.next_clock = 0
            state.cond_var.signal
          end
        }
        Thread.pass
        state.thread.join
      end
    end
  end

  super
end