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.



102
103
104
# File 'lib/fluent/command/cat.rb', line 102

def initialize(writer)
  @writer = writer
end

Instance Method Details

#runObject



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

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

#shutdownObject



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

def shutdown
  @finish = true
  @thread.join
end

#startObject



106
107
108
109
# File 'lib/fluent/command/cat.rb', line 106

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