Class: Writer::TimerThread

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/command/cat.rb

Instance Method Summary collapse

Constructor Details

#initialize(writer) ⇒ TimerThread

Returns a new instance of TimerThread.



95
96
97
# File 'lib/fluent/command/cat.rb', line 95

def initialize(writer)
  @writer = writer
end

Instance Method Details

#runObject



109
110
111
112
113
114
# File 'lib/fluent/command/cat.rb', line 109

def run
  until @finish
    sleep 1
    @writer.on_timer
  end
end

#shutdownObject



104
105
106
107
# File 'lib/fluent/command/cat.rb', line 104

def shutdown
  @finish = true
  @thread.join
end

#startObject



99
100
101
102
# File 'lib/fluent/command/cat.rb', line 99

def start
  @finish = false
  @thread = Thread.new(&method(:run))
end