|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openeai.OpenEaiObject
org.openeai.jms.producer.TempQueuePool
public class TempQueuePool
The TempQueuePool contains a list of PooledTempQueue objects that will be used by a PointToPointProducer's QueueRequestor when a request is produced. The TempQueuePool is responsible for determining if a PooledTempQueue is in use and if so, allocate another one for temporary use.
PooledTempQueue,
PointToPointProducer,
QueueRequestor| Field Summary |
|---|
| Fields inherited from class org.openeai.OpenEaiObject |
|---|
logger |
| Constructor Summary | |
|---|---|
TempQueuePool(int size,
javax.jms.QueueSession session)
This constructor is used by the PointToPointProducer to create this TempQueuePool and set it on the QueueRequestor associated to the producer. |
|
| Method Summary | |
|---|---|
void |
close()
Releases all JMS resources allocated to all PooledTempQueues in this pool. |
PooledTempQueue |
getPooledTempQueue()
Returns a PooledTempQueue that contains a pre-established TempoaryQueue and QueueReceiver. |
int |
getPoolSize()
Returns the size of the pool. |
void |
reinitializePooledTempQueue(PooledTempQueue pq)
This will be called by the QueueRequestor if a Timeout occurs during a "request". |
void |
releasePooledTempQueue(PooledTempQueue pq)
Releases a PooledTempQueue back to the pool making it available for retrieval again. |
void |
setPoolSize(int size)
Sets the size of the pool. |
| Methods inherited from class org.openeai.OpenEaiObject |
|---|
getAppName, getDebug, getFromAddr, 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 |
|---|
public TempQueuePool(int size,
javax.jms.QueueSession session)
throws javax.jms.JMSException
size - int the size of the poolsession - javax.jms.QueueSession the QueueSession associated to the Producer creating
this pool that will be used to create TemporaryQueues that are added to the pool
via the PooledTempQueue object.
javax.jms.JMSExceptionQueueRequestor,
PooledTempQueue| Method Detail |
|---|
public void setPoolSize(int size)
size - int the size of the poolpublic int getPoolSize()
public PooledTempQueue getPooledTempQueue()
throws javax.jms.JMSException
The QueueRequestor object calls this method to retreive a PooledTempQueue from the pool when it produces a request on behalf of a PointToPointProducer.
javax.jms.JMSException - if an error occurs creating a new PooledTempQueue if an
available one can't be retrieved from the pool.
public void releasePooledTempQueue(PooledTempQueue pq)
throws javax.jms.JMSException
If the PooledTempQueue passed in was originally retrieved from the pool, its status will be set back to "not in use" so it may be retrieved from the pool by subsequent calls.
The OpenEAI QueueRequestor object calls this method when it's finished sending a request and has consumed the response. If a request times out, the QueueRequestor will call the reinitializePooledTempQueue method.
pq - PooledTempQueue the PooledTempQueue to be released.
javax.jms.JMSException - if an error occurs deleting the resources allocated to
a PooledTempQueue that was not originally a part of the pool.reinitializePooledTempQueue(org.openeai.jms.producer.PooledTempQueue)
public void reinitializePooledTempQueue(PooledTempQueue pq)
throws javax.jms.JMSException
We have to do this because if we send requests to gateways that are down, the messages sit on the Queue until the next time the gateway is brought up. At that time, the gateway will see that it has requests to process and it will process and respond to those requests. By that time, the TempQueuePool may be in use by another request and we don't want the gateway to mistakenly respond to those requests using the request sent by the original request that timed out. Instead, we want the gateway to receive a "queue not found" error at that time. By removing the PooledTempQueue from the pool and deleting it, we're ensuring that any PooledTempQueue used when a timeout occurred isn't used again when the gateway starts processing messages again.
pq - PooledTempQueue the PooledTempQueue to be re-initialized.
javax.jms.JMSException - if any errors occur re-initiallizing the PooledTempQueue.
public void close()
throws javax.jms.JMSException
javax.jms.JMSException - if errors occur. However, it will continue to iterate through
all PooledTempQueue objects closing them all and only throw the exception after
all resources that could be released are. It will save up any exceptions that occur
during the cleanup process and include those messages in the exception that it throws.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||