Sha256: 5feedc2d1a587f25a70e43bbb07f2666c3475b79e8627a35f9566e18987dbff8

Contents?: true

Size: 420 Bytes

Versions: 2

Compression:

Stored size: 420 Bytes

Contents

module Dharma
  class ThreadExecutor
    def initialize
    end

    def execute(work)
      Thread.new(work) do |work|
        begin
          work.call
        rescue Exception => e
          report_failure(e)
        end
      end
    end

    def report_failure(exception)
      puts "Dharma: ThreadExecutor failure: #{exception.message} (#{exception.class})\n\t#{exception.backtrace.join("\n\t")}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dharma-0.9.1 lib/dharma/thread_executor.rb
dharma-0.9.0 lib/dharma/thread_executor.rb