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.



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

def initialize(writer)
  @writer = writer
end

Instance Method Details

#runObject



123
124
125
126
127
128
# File 'lib/fluent/command/cat.rb', line 123

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

#shutdownObject



118
119
120
121
# File 'lib/fluent/command/cat.rb', line 118

def shutdown
  @finish = true
  @thread.join
end

#startObject



113
114
115
116
# File 'lib/fluent/command/cat.rb', line 113

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