class RubyRabbitmqJanus::Process::Concurrencies::Concurrency
@author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
# Class for manage threads
@abstract Manage thread for listener to queue :
from-janus from-janus-admin
Attributes
condition[R]
lock[R]
rabbit[R]
Public Class Methods
new()
click to toggle source
Initialize class with elements for thread communication
# File lib/rrj/process/concurrency.rb, line 16 def initialize ::Log.info info_thread @rabbit = RubyRabbitmqJanus::Rabbit::Connect.new @lock = Mutex.new @condition = ConditionVariable.new end
Private Instance Methods
class_name()
click to toggle source
# File lib/rrj/process/concurrency.rb, line 40 def class_name self.class.name end
info_thread()
click to toggle source
# File lib/rrj/process/concurrency.rb, line 36 def info_thread "Create an thread -- #{class_name}" end
initialize_thread()
click to toggle source
# File lib/rrj/process/concurrency.rb, line 27 def initialize_thread @rabbit.transaction_long { transaction_running } rescue Interrupt ::Log.warn "This process has been interupted #{class_name}" ::Log.warn \ "Close a connection with RabbitMQ instance for #{class_name}" @rabbit.close end