class TingYun::Agent::Threading::AgentThread
Public Class Methods
backing_thread_class()
click to toggle source
# File lib/ting_yun/agent/threading/agent_thread.rb, line 39 def self.backing_thread_class @backing_thread_class end
backing_thread_class=(clazz)
click to toggle source
# File lib/ting_yun/agent/threading/agent_thread.rb, line 43 def self.backing_thread_class=(clazz) @backing_thread_class = clazz end
create(label, &blk)
click to toggle source
# File lib/ting_yun/agent/threading/agent_thread.rb, line 9 def self.create(label, &blk) TingYun::Agent.logger.debug("Creating Ting Yun thread: #{label}") wrapped_blk = Proc.new do begin blk.call rescue => e TingYun::Agent.logger.error("Thread #{label} exited with error", e) rescue Exception => e TingYun::Agent.logger.error("Thread #{label} exited with exception. Re-raising in case of interupt.", e) raise ensure TingYun::Agent.logger.debug("Exiting TingYun thread: #{label}") end end thread = backing_thread_class.new(&wrapped_blk) thread[:TingYun_label] = label thread end
list()
click to toggle source
Simplifies testing if we don't directly use ::Thread.list, so keep the accessor for it here on AgentThread
to use and stub.
# File lib/ting_yun/agent/threading/agent_thread.rb, line 31 def self.list backing_thread_class.list end