You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gt...@apache.org on 2010/06/29 15:17:11 UTC

svn commit: r958961 - /activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java

Author: gtully
Date: Tue Jun 29 13:17:11 2010
New Revision: 958961

URL: http://svn.apache.org/viewvc?rev=958961&view=rev
Log:
more input to doc comment re pooling: https://issues.apache.org/activemq/browse/AMQ-2806

Modified:
    activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java

Modified: activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java?rev=958961&r1=958960&r2=958961&view=diff
==============================================================================
--- activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java (original)
+++ activemq/trunk/activemq-pool/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java Tue Jun 29 13:17:11 2010
@@ -37,14 +37,21 @@ import org.apache.commons.pool.impl.Gene
  * A JMS provider which pools Connection, Session and MessageProducer instances
  * so it can be used with tools like <a href="http://camel.apache.org/activemq.html">Camel</a> and Spring's <a
  * href="http://activemq.apache.org/spring-support.html">JmsTemplate and MessagListenerContainer</a>.
+ * Connections, sessions and producers are returned to a pool after use so that they can be reused later
+ * without having to undergo the cost of creating them again.
  * 
- * <b>NOTE</b> this implementation does not pool consumers. Pooling makes sense for seldom used
- * resources that are expensive to create and can remain idle a minimal cost. like sessions and producers.
- * Consumers on the other hand, will consume messages even when idle due to <a 
- * href="http://activemq.apache.org/what-is-the-prefetch-limit-for.html">prefetch</a>.
- * If you want to consider a consumer pool, configure an appropriate prefetch and a pool
- * allocation strategy that is inclusive. Also note that message order guarantees will be
- * lost across the consumer pool. 
+ * b>NOTE:</b> while this implementation does allow the creation of a collection of active consumers,
+ * it does not 'pool' consumers. Pooling makes sense for connections, sessions and producers, which 
+ * are expensive to create and can remain idle a minimal cost. Consumers, on the other hand, are usually
+ * just created at startup and left active, handling incoming messages as they come. When a consumer is
+ * complete, it is best to close it rather than return it to a pool for later reuse: this is because, 
+ * even if a consumer is idle, ActiveMQ will keep delivering messages to the consumer's prefetch buffer,
+ * where they'll get held until the consumer is active again.
+ * 
+ * If you are creating a collection of consumers (for example, for multi-threaded message consumption), you
+ * might want to consider using a lower value for each consumer (e.g. 10 or 20), to ensure that all messages
+ * don't end up going to just one of the consumers. See this FAQ entry for more detail: 
+ * http://activemq.apache.org/i-do-not-receive-messages-in-my-second-consumer.html
  * 
  * @org.apache.xbean.XBean element="pooledConnectionFactory"
  *