class Upperkut::WorkerThread

Public Class Methods

new(manager, processor) click to toggle source
# File lib/upperkut/worker_thread.rb, line 5
def initialize(manager, processor)
  @manager = manager
  @processor = processor
end

Public Instance Methods

kill() click to toggle source
# File lib/upperkut/worker_thread.rb, line 30
def kill
  return unless @thread

  @thread.raise Upperkut::Shutdown
  @thread.value # wait
end
run() click to toggle source
# File lib/upperkut/worker_thread.rb, line 10
def run
  @thread ||= Thread.new do
    begin
      @processor.blocking_process
    rescue Exception => e
      @manager.logger.debug(
        action: :processor_killed,
        reason: e,
        stacktrace: e.backtrace
      )

      @manager.notify_killed_processor(self)
    end
  end
end
stop() click to toggle source
# File lib/upperkut/worker_thread.rb, line 26
def stop
  @processor.stop
end