Class: Tlb::JavaBalancerProcess
Instance Method Summary
collapse
#initialize, #stop_pumping
Instance Method Details
#buf_reader(stream) ⇒ Object
212
213
214
|
# File 'lib/tlb.rb', line 212
def buf_reader stream
java.io.BufferedReader.new(java.io.InputStreamReader.new(stream))
end
|
#die ⇒ Object
216
217
218
219
220
221
|
# File 'lib/tlb.rb', line 216
def die
super
@process.destroy
@process.waitFor
@process = nil
end
|
#start(server_command) ⇒ Object
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
# File 'lib/tlb.rb', line 189
def start server_command
require 'java'
pb = java.lang.ProcessBuilder.new(server_command.split)
ENV.each do |key, val|
pb.environment[key] = val
end
@process = pb.start()
return Class.new(StreamPumper) do
def data_available?
@stream.ready
end
def read
@stream.read_line
end
def stop_pumping!
super
@stream.close
end
end, buf_reader(@process.input_stream), buf_reader(@process.error_stream)
end
|