org.openeai.jms.producer
Class PooledTempQueue


java.lang.Object

  |

  +--org.openeai.OpenEaiObject

        |

        +--org.openeai.jms.producer.PooledTempQueue


public class PooledTempQueue
extends OpenEaiObject

This is a class that wraps a JMS TemporaryQueue and QueueReceiver that listens for responses sent on the TemporaryQueue. It is instantiated and stored in the TemporaryQueuePool for use by PointToPointProducers. These objects are created when the producer is initialized and retrieved from the pool by the producer's QueueRequestor when requests are produced. This is done so message production doesn't have to be slowed down by the creation of the temporary queues each time a request is produced. The TempQueuePool is responsible for determining if a PooledTempQueue is available and if not, it will create a new one for use by the current request. This way, there will never be two threads attempting to use the same TempoaryQueue at the same time.

Version:
3.0 beta2 - 28 January 2003
Author:
Tod Jackson (tod@openeai.org), Steve Wheat (steve@openeai.org)
See Also:
QueueRequestor, PointToPointProducer, TempQueuePool

Field Summary
 
Fields inherited from class org.openeai.OpenEaiObject
logger
 
Constructor Summary
PooledTempQueue(javax.jms.QueueSession session)
          Constructor, creates a TemporaryQueue and QueueReceiver that will be used when the OpenEAI QueueRequestor produces a request.
 
Method Summary
 void delete()
          Frees up the resources allocated on behalf of the JMS resources.
 java.lang.String getQueueId()
          Returns the Queue Id associated to this PooledTempQueue.
 javax.jms.QueueReceiver getQueueReceiver()
          Returns the JMS QueueReceiver object associated to the PooledTempQueue.
 javax.jms.TemporaryQueue getTemporaryQueue()
          Returns the JMS TempoaryQueue object associated to the PooledTempQueue.
 boolean inUse()
          Returns true if this PooledTempQueue object is in use false if it's not.
 void setInUse(boolean inUse)
          Sets the inUse flag associated to this PooledTempQueue.
 void setQueueId(java.lang.String id)
          Sets the Queue Id associated to this PooledTempQueue.
 void setQueueReceiver(javax.jms.QueueReceiver receiver)
          Sets the JMS QueueReceiver object associated to the PooledTempQueue.
 void setTemporaryQueue(javax.jms.TemporaryQueue tempQueue)
          Sets the JMS TempoaryQueue object associated to the PooledTempQueue.
 
Methods inherited from class org.openeai.OpenEaiObject
addLog4jProperty, getAppName, getDebug, getFromAddr, getLog4jProperties, getMailHost, getMailService, getProperties, getToAddr, initializeLog4j, initializeLog4j, initializeLog4j, setAppName, setDebug, setFromAddr, setMailHost, setMailService, setProperties, setToAddr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PooledTempQueue


public PooledTempQueue(javax.jms.QueueSession session)
                throws javax.jms.JMSException
Constructor, creates a TemporaryQueue and QueueReceiver that will be used when the OpenEAI QueueRequestor produces a request. It will retrieve this PooledTempQueue from it's TempQueuePool and use the resources wrapped by this class (the TemporaryQueue and QueueReceiver).

Method Detail

setQueueId


public final void setQueueId(java.lang.String id)
Sets the Queue Id associated to this PooledTempQueue. This is the TemporaryQueue's name and is set when this object is constructed after the TemporaryQueue has been created..


getQueueId


public final java.lang.String getQueueId()
Returns the Queue Id associated to this PooledTempQueue. This is the TemporaryQueue's name and is set when this object is constructed after the TemporaryQueue has been created..

Returns:
String the queue id

inUse


public final boolean inUse()
Returns true if this PooledTempQueue object is in use false if it's not. This way, the TempQueuePool can keep track of PooledTempQueues that are in use by other requests being sent and create a new JMS resource if necessary.

Returns:
boolean true if this object is in use, false if it's not.

setInUse


public final void setInUse(boolean inUse)
Sets the inUse flag associated to this PooledTempQueue. This way, the TempQueuePool can keep track of PooledTempQueues that are in use by other requests being sent and create a new JMS resource if necessary.

This is set to true each time a PooledTempQueue is retreived from the TempQueuePool and set to false when the PooledTempQueue is released. These objects are retrieved and released from the TempQueuePool by the OpenEAI QueueRequestor when requests are produced.


setTemporaryQueue


public final void setTemporaryQueue(javax.jms.TemporaryQueue tempQueue)
Sets the JMS TempoaryQueue object associated to the PooledTempQueue. This is called when the PooledTempQueue is constructed and it creates this JMS resource.


getTemporaryQueue


public final javax.jms.TemporaryQueue getTemporaryQueue()
Returns the JMS TempoaryQueue object associated to the PooledTempQueue. This is called when the QueueRequestor retrieves one of these PooledTempQueues from the TempQueuePool for request message production.

Returns:
javax.jms.TempoaryQueue

setQueueReceiver


public final void setQueueReceiver(javax.jms.QueueReceiver receiver)
Sets the JMS QueueReceiver object associated to the PooledTempQueue. This is called when the PooledTempQueue is constructed and it creates this JMS resource.


getQueueReceiver


public final javax.jms.QueueReceiver getQueueReceiver()
Returns the JMS QueueReceiver object associated to the PooledTempQueue. This is called when the QueueRequestor retrieves one of these PooledTempQueues from the TempQueuePool for request message production.

Returns:
javax.jms.QueueReceiver

delete


public final void delete()
                  throws javax.jms.JMSException
Frees up the resources allocated on behalf of the JMS resources. Deletes the TempoaryQueue and QueueReceiver objects associated to this PooledTempQueue.

Throws:
javax.jms.JMSException - if errors occur deleting and closing the JMS resources.


Copyright © 2002, OpenEAI Software Foundation