No exposure to the 'idleTimeout' property for ConnectionPool class, which makes 
it difficult to implement keepAlive semantics on PooledConnections
--------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: AMQ-1578
                 URL: https://issues.apache.org/activemq/browse/AMQ-1578
             Project: ActiveMQ
          Issue Type: Bug
          Components: JMS client
    Affects Versions: 5.0.0
         Environment: 5.1-SNAPSHOT
            Reporter: Jason Rosenberg


The ConnectionPool class has a 'idleTimeout' property, but this is not 
accessible easily, via the PooledConnectionFactory class.

This essentially means that there's no easy way to implement a keepAlive setup 
for underlying tcp connections.  By default, the idleTimeout is set to 30 
seconds, and when this expires, it shuts down the connection's transport.  
Furthermore, it ignores and knows nothing about the InactiviyMonitor's efforts 
to keep the tcp connection refreshed.

A simple fix would be to have the PooledConnectionFactory have a setter for the 
idleTimeout property, and then pass this one when it creates new connections.   
As a work-around, I've created a sub-class of the PooledConnectionFactory 
class, that looks like this (this sub-classes actually the jencks amqpool 
class, which is very similar to the activemq version of the class, which has 
the same issue):


public class PooledConnectionFactoryWithIdleTimeout extends 
PooledConnectionFactory {
    
   private int idleTimeout = 0; 
   
   public int getIdleTimeout() {
       return idleTimeout;
   }

   public void setIdleTimeout(int idleTimeout) {
       this.idleTimeout = idleTimeout;
   } 
   
   @Override
   protected ConnectionPool createConnectionPool(ActiveMQConnection connection) 
{
       ConnectionPool connPool = new ConnectionPool(connection, 
getPoolFactory());
       connPool.setIdleTimeout(idleTimeout);
       
       return connPool;
   }   
}



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to