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.



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

def initialize(writer)
  @writer = writer
end

Instance Method Details

#runObject



132
133
134
135
136
137
# File 'lib/fluent/command/cat.rb', line 132

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

#shutdownObject



127
128
129
130
# File 'lib/fluent/command/cat.rb', line 127

def shutdown
  @finish = true
  @thread.join
end

#startObject



122
123
124
125
# File 'lib/fluent/command/cat.rb', line 122

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