Class: LogStash::PipelineAction::Stop

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/pipeline_action/stop.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#<=>, #execution_priority, #inspect

Constructor Details

#initialize(pipeline_id) ⇒ Stop

Returns a new instance of Stop.



10
11
12
# File 'lib/logstash/pipeline_action/stop.rb', line 10

def initialize(pipeline_id)
  @pipeline_id = pipeline_id
end

Instance Attribute Details

#pipeline_idObject (readonly)

Returns the value of attribute pipeline_id.



8
9
10
# File 'lib/logstash/pipeline_action/stop.rb', line 8

def pipeline_id
  @pipeline_id
end

Instance Method Details

#execute(agent, pipelines) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/logstash/pipeline_action/stop.rb', line 14

def execute(agent, pipelines)
  pipeline = pipelines[pipeline_id]
  pipeline.shutdown { LogStash::ShutdownWatcher.start(pipeline) }
  pipeline.thread.join
  pipelines.delete(pipeline_id)
  # If we reach this part of the code we have succeeded because
  # the shutdown call will block.
  return LogStash::ConvergeResult::SuccessfulAction.new
end