Class: Push::Daemon::DeliveryHandler
- Inherits:
-
Object
- Object
- Push::Daemon::DeliveryHandler
- Defined in:
- lib/push/daemon/delivery_handler.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(queue, connection_pool, name) ⇒ DeliveryHandler
constructor
A new instance of DeliveryHandler.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(queue, connection_pool, name) ⇒ DeliveryHandler
Returns a new instance of DeliveryHandler.
6 7 8 9 10 |
# File 'lib/push/daemon/delivery_handler.rb', line 6 def initialize(queue, connection_pool, name) @queue = queue @connection_pool = connection_pool @name = "DeliveryHandler #{name}" end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/push/daemon/delivery_handler.rb', line 4 def name @name end |
Instance Method Details
#start ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/push/daemon/delivery_handler.rb', line 12 def start @thread = Thread.new do loop do break if @stop handle_next_notification end end end |
#stop ⇒ Object
21 22 23 24 |
# File 'lib/push/daemon/delivery_handler.rb', line 21 def stop @stop = true @queue.wakeup(@thread) end |