Description
A managed connection returned to the pool has cleanup called, but cleanup is not releasing the underlying activemq connection info and clientid. On the second attempt to reuse the connection, setting the id fails due to the pre existing state in error.
[Server:eai01] 17:04:58,073 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (jmsListener-734) IJ000613: Throwable while trying to match managed connection, destroying connection: org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@3e11f08f[state=NORMAL managed connection=[org.apache.activemq.ra.ActiveMQManagedConnection@34bc339a,ActiveMQConnection {id=ID:macbookpro-2.local-54186-1448868251571-1463:1,clientId=xxx,started=false}] connection handles=0 lastUse=1448874205871 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@2f2f39fd pool internal context=SemaphoreArrayListManagedConnectionPool@51eff7c[pool=ActiveMQConnectionFactory] xaResource=XAResourceWrapperImpl@623206[xaResource=[org.apache.activemq.ra.ActiveMQManagedConnection$1@64df868a,TransactionContext{transactionId=null,connection=ActiveMQConnection {id=ID:macbookpro-2.local-54186-1448868251571-1463:1,clientId=xxx,started=false}}] pad=false overrideRmValue=null productName=ActiveMQ productVersion=5.12.1 jndiName=java:/ra/activeMQ/ActiveMQConnectionFactory] txSync=null]: javax.resource.ResourceException: javax.jms.IllegalStateException: Setting clientID on a used Connection is not allowed [Server:eai01] at org.apache.activemq.ra.ActiveMQManagedConnectionFactory.matchManagedConnections(ActiveMQManagedConnectionFactory.java:217) [activemq-ra-5.12.1.jar:5.12.1] [Server:eai01] at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:314) [Server:eai01] at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:453) [Server:eai01] at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:425) [Server:eai01] at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:354) [Server:eai01] at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368) [Server:eai01] at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:510) [Server:eai01] at org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:94) [activemq-ra-5.12.1.jar:5.12.1] [Server:eai01] at org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:78) [activemq-ra-5.12.1.jar:5.12.1]