org.apache.qpid.util.concurrent
Interface SynchRecord<E>

All Known Implementing Classes:
BatchSynchQueueBase.SynchRecordImpl

public interface SynchRecord<E>

SynchRecord associates a data item from a BatchSynchQueue with its producer. This enables the data item data item to be put back on the queue without unblocking its producer, or to send exceptions to the producer.

CRC Card
Responsibilities Collaborations
Get the underlying data element.
Put the data element back on the queue without unblocking its producer.
Send and exception to the data elements producer.


Method Summary
 E getElement()
          Gets the data element contained by this record.
 void inError(Exception e)
          Tells the synch queue to raise an exception with this elements producer.
 void releaseImmediately()
          Immediately releases the producer of this data record.
 void reQueue()
          Tells the synch queue to put this element back onto the queue instead of releasing its producer.
 

Method Detail

getElement

E getElement()
Gets the data element contained by this record.

Returns:
The data element contained by this record.

reQueue

void reQueue()
Tells the synch queue to put this element back onto the queue instead of releasing its producer. The element is not requeued immediately but upon calling the SynchRef.unblockProducers() method.

This method will raise a runtime exception AlreadyUnblockedException if the producer for this element has already been unblocked.


releaseImmediately

void releaseImmediately()
Immediately releases the producer of this data record. Consumers can bring the synchronization time of producers to a minimum by using this method to release them at the earliest possible moment when batch consuming records from sychronized producers.


inError

void inError(Exception e)
Tells the synch queue to raise an exception with this elements producer. The exception is not raised immediately but upon calling the SynchRef.unblockProducers() method. The exception will be wrapped in a SynchException before it is raised on the producer.

This method is unusual in that it accepts an exception as an argument. This is non-standard but is used because the exception is to be passed onto a different thread.

This method will raise a runtime exception AlreadyUnblockedException if the producer for this element has already been unblocked.

Parameters:
e - The exception to raise on the producer.


Licensed to the Apache Software Foundation