org.openeai.jms.producer
Class ProducerPool


java.lang.Object

  |

  +--org.openeai.OpenEaiObject

        |

        +--org.openeai.jms.producer.ProducerPool


public class ProducerPool
extends OpenEaiObject

The ProducerPool is a class that contains a list of producers for use by an application or command. It is very similar to a Database Connection pool in that it is filled with pre-configured and started producers when the application starts up. This is to allow developers to affect the performance of an application by adding producers to a pool relative to the amount of processing and number of threads present in the application. Since OpenEAI producers are by default thread safe, it does not do anything to limit the number of threads accessing a producer at the same time. It simply makes the number of producers producing to the same queue higher so their will be a smaller number of synchronizations occurring within the producers (when a message is produced and Session synchronization occurrs).

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

Field Summary
 
Fields inherited from class org.openeai.OpenEaiObject
logger
 
Constructor Summary
ProducerPool()
          Constructor
ProducerPool(java.util.List vProducers)
           
 
Method Summary
 MessageProducer getProducer()
          Returns the next producer from the pool.
 java.util.List getProducers()
          Returns the list of OpenEAI producers associated to this pool.
 void setProducers(java.util.List vProducers)
          Sets the list of OpenEAI producers to what's passed in.
 int size()
          Returns the size of the pool.
 
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

ProducerPool


public ProducerPool()
Constructor


ProducerPool


public ProducerPool(java.util.List vProducers)
Method Detail

setProducers


public final void setProducers(java.util.List vProducers)
Sets the list of OpenEAI producers to what's passed in.


getProducers


public final java.util.List getProducers()
Returns the list of OpenEAI producers associated to this pool.

Returns:
java.util.List

size


public final int size()
Returns the size of the pool.

Returns:
int the size of the pool.

getProducer


public final MessageProducer getProducer()
                                  throws javax.jms.JMSException
Returns the next producer from the pool. This is determined simply by maintaining and counter indicating the last producer returned. Since producers are thread safe it does not attempt to ensure that only one request is using a given producer at a time.

If a producer is not started, it will not be returned.

Returns:
MessageProducer either a PointToPoint or PubSubProducer
Throws:
javax.jms.JMSException - if no started producers can be found in the pool.


Copyright © 2002, OpenEAI Software Foundation