The logic within org.apache.commons.pool2.impl.GenericKeyedObjectPool.evict() gives the EvictionPolicy higher precedence than KeyedPooledObjectFactory.validateObject().
This means the comment in org.messaginghub.pooled.jms.JmsPoolConnectionFactory.initConnectionsPool() is not true
// We always want our validate method to control when idle objects are evicted.
this.connectionsPool.setTestOnBorrow(true);
this.connectionsPool.setTestWhileIdle(true);
Since JmsPoolConnectionFactory leaves all pooled connections with a state of PooledObjectState.IDLE, they will be evicted after BaseObjectPoolConfig.DEFAULT_MIN_EVICTABLE_IDLE_DURATION, 30 minutes by default.
This causes code that is using an active connection to stacktrace, example:
javax.jms.IllegalStateException: The Session is closed
at org.apache.activemq.ActiveMQSession.checkClosed(ActiveMQSession.java:772) ~[activemq-client-5.16.5.jar:5.16.5]
at org.apache.activemq.ActiveMQSession.rollback(ActiveMQSession.java:597) ~[activemq-client-5.16.5.jar:5.16.5]
at org.messaginghub.pooled.jms.JmsPoolSession.close(JmsPoolSession.java:112) ~[pooled-jms-1.2.4.jar:na]
The logic within
org.apache.commons.pool2.impl.GenericKeyedObjectPool.evict()
gives theEvictionPolicy
higher precedence thanKeyedPooledObjectFactory.validateObject()
.This means the comment in
org.messaginghub.pooled.jms.JmsPoolConnectionFactory.initConnectionsPool()
is not trueSince
JmsPoolConnectionFactory
leaves all pooled connections with a state ofPooledObjectState.IDLE
, they will be evicted afterBaseObjectPoolConfig.DEFAULT_MIN_EVICTABLE_IDLE_DURATION
, 30 minutes by default.This causes code that is using an active connection to stacktrace, example: