Sha256: a33e69e0f70ff7a21651b782125771c2bb2bfae5585d54afb5d9061818c72199

Contents?: true

Size: 779 Bytes

Versions: 3

Compression:

Stored size: 779 Bytes

Contents

# encoding: utf-8
require "logstash/pipeline_action/base"
require "logstash/shutdown_watcher"
require "logstash/converge_result"

module LogStash module PipelineAction
  class Stop < Base
    attr_reader :pipeline_id

    def initialize(pipeline_id)
      @pipeline_id = pipeline_id
    end

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
logstash-core-6.3.2-java lib/logstash/pipeline_action/stop.rb
logstash-core-6.3.1-java lib/logstash/pipeline_action/stop.rb
logstash-core-6.3.0-java lib/logstash/pipeline_action/stop.rb