Class: Fluent::JvmwatcherInput
- Inherits:
-
Input
- Object
- Input
- Fluent::JvmwatcherInput
- Defined in:
- lib/fluent/plugin/in_jvmwatcher.rb
Instance Method Summary collapse
-
#initialize ⇒ JvmwatcherInput
constructor
A new instance of JvmwatcherInput.
- #run ⇒ Object
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize ⇒ JvmwatcherInput
Returns a new instance of JvmwatcherInput.
9 10 11 12 13 14 15 |
# File 'lib/fluent/plugin/in_jvmwatcher.rb', line 9 def initialize super @log4j_path = JvmwatcherUtil.make_log4j_file @setenv_path = JvmwatcherUtil.make_setenv_file @bin_path = JvmwatcherUtil.find_watcher_java_path(JvmwatcherUtil::BinDirName) @jvmwatcher_connamd = File.join(@bin_path, "JvmWatcher.sh") end |
Instance Method Details
#run ⇒ Object
41 42 43 |
# File 'lib/fluent/plugin/in_jvmwatcher.rb', line 41 def run @io.each_line(&method(:each_line)) end |
#shutdown ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/fluent/plugin/in_jvmwatcher.rb', line 32 def shutdown Process.kill(:TERM, @pid) if @thread.join(60) return end Process.kill(:KILL, @pid) @yhread.join end |
#start ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/fluent/plugin/in_jvmwatcher.rb', line 23 def start @config_path = JvmwatcherUtil.find_filter_config_path(@filter_config_path) command = "#{@jvmwatcher_connamd} '#{@config_path}' #{@jvm_refind_interval} #{@log_interval} #{@log_buff_num} #{@setenv_path}" @io = IO.popen(command, "r") @pid = @io.pid @thread = Thread.new(&method(:run)) end |