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.



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

def initialize(writer)
  @writer = writer
end

Instance Method Details

#runObject



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

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

#shutdownObject



129
130
131
132
# File 'lib/fluent/command/cat.rb', line 129

def shutdown
  @finish = true
  @thread.join
end

#startObject



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

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