Class: Qpid::Proton::Container::ConnectionTask

Inherits:
HandlerDriver show all
Includes:
TimeCompare
Defined in:
lib/core/container.rb

Overview

Container driver applies options and adds container context to events

Instance Attribute Summary

Attributes inherited from HandlerDriver

#handler

Instance Method Summary collapse

Methods included from TimeCompare

#before_eq, #earliest

Methods inherited from Qpid::Proton::ConnectionDriver

#can_read?, #can_write?, #close, #close_read, #close_write, #connection, #each_event, #event, #event?, #finished?, #read, #read_closed?, #tick, #to_io, #transport, #write, #write_closed?

Constructor Details

#initialize(container, io, opts, server = false) ⇒ ConnectionTask

Returns a new instance of ConnectionTask.



264
265
266
267
268
269
270
271
# File 'lib/core/container.rb', line 264

def initialize container, io, opts, server=false
  super io, opts[:handler]
  transport.set_server if server
  transport.apply opts
  connection.apply opts
  @work_queue = WorkQueue.new container
  connection.instance_variable_set(:@work_queue, @work_queue)
end

Instance Method Details

#dispatchObject

Intercept dispatch to close work_queue



275
276
277
278
# File 'lib/core/container.rb', line 275

def dispatch              # Intercept dispatch to close work_queue
  super
  @work_queue.send(:close) if read_closed? && write_closed? 
end

#next_tickObject



272
# File 'lib/core/container.rb', line 272

def next_tick() earliest(super, @work_queue.send(:next_tick)); end

#process(now) ⇒ Object



273
# File 'lib/core/container.rb', line 273

def process(now) @work_queue.send(:process, now); super(); end