class Hoodoo::Communicators::Pool::QueueEntry

Internal implementation detail of Hoodoo::Communicators::Pool which is placed on a Ruby Queue and used as part of thread processing for slow communicators.

Attributes

dropped[RW]

If not nil or zero, the number of dropped messages that should be send to the slow communicator subclass’s dropped method. See also dropped?

payload[RW]

If the entry represents neither a termination request nor a dropped message count (see terminate? and dropped?), the payload to send to the slow communicator subclass’s communicate method.

sync[RW]

If true, the processing Thread should push one item with any payload onto its sync Queue. See also sync?

terminate[RW]

If true, the processing Thread should exit. See also terminate?.

Public Class Methods

new( payload: nil, dropped: nil, terminate: false, sync: false ) click to toggle source

Create a new instance, ready to be added to the Queue.

ONLY USE ONE of the named parameters:

payload

A parameter to send to communicate in the communicator.

dropped

The integer to send to dropped in the communicator.

terminate

Set to true to exit the processing thread when the entry is read from the Queue.

sync

Set to true to push a message onto the sync Queue.

# File lib/hoodoo/communicators/pool.rb, line 579
def initialize( payload: nil, dropped: nil, terminate: false, sync: false )
  @payload   = payload
  @dropped   = dropped
  @terminate = terminate
  @sync      = sync
end

Public Instance Methods

dropped?() click to toggle source

Returns true if this queue entry represents a dropped message count (see dropped), else +false (see terminate? then payload).

# File lib/hoodoo/communicators/pool.rb, line 603
def dropped?
  @dropped != nil && @dropped > 0
end
sync?() click to toggle source

Returns true if this queue entry represents a request to push a message onto the processing Thread’s sync Queue.

# File lib/hoodoo/communicators/pool.rb, line 596
def sync?
  @sync == true
end
terminate?() click to toggle source

Returns true if encountering this queue entry should terminate the processing thread, else false (see dropped? then payload).

# File lib/hoodoo/communicators/pool.rb, line 589
def terminate?
  @terminate == true
end