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.



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

def initialize(pipeline_id)
  @pipeline_id = pipeline_id
end

Instance Attribute Details

#pipeline_idObject (readonly)

Returns the value of attribute pipeline_id.



6
7
8
# File 'lib/logstash/pipeline_action/stop.rb', line 6

def pipeline_id
  @pipeline_id
end

Instance Method Details

#execute(agent, pipelines_registry) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/logstash/pipeline_action/stop.rb', line 12

def execute(agent, pipelines_registry)
  pipelines_registry.terminate_pipeline(pipeline_id) do |pipeline|
    pipeline.shutdown { LogStash::ShutdownWatcher.start(pipeline) }
    pipeline.thread.join
  end

  LogStash::ConvergeResult::SuccessfulAction.new
end

#to_sObject



21
22
23
# File 'lib/logstash/pipeline_action/stop.rb', line 21

def to_s
  "PipelineAction::Stop<#{pipeline_id}>"
end