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.
26 27 28 29 30 31 32 |
# File 'lib/fluent/plugin/in_jvmwatcher.rb', line 26 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
58 59 60 |
# File 'lib/fluent/plugin/in_jvmwatcher.rb', line 58 def run @io.each_line(&method(:each_line)) end |
#shutdown ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/fluent/plugin/in_jvmwatcher.rb', line 49 def shutdown Process.kill(:TERM, @pid) if @thread.join(60) return end Process.kill(:KILL, @pid) @yhread.join end |
#start ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/fluent/plugin/in_jvmwatcher.rb', line 40 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 |