Close failed connection on start if the reconnect on exception flag is
enabled.
(cherry picked from commit 2e64abc38a)
Conflicts:
activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSecurityExceptionTest.java
https://issues.apache.org/jira/browse/AMQ-5534
PooledConnectioFactory added reconnection support but can break if the
holder of the connection adds their own ExceptionListener as the
PooledConnection doesn't protect the internal ExceptionListener from
replacement which leads to cases where the loaned Connection is not
automatically closed so that the next create returns the same failed
connection.
(cherry picked from commit b65c0d1be4)
Disabling JMX for the Commons Pool implementation inside of
PooledConnectionFactory. In the future if we want JMX we should
enable our own JMX stats that are independent of Commons Pool.
Fixed session in the pool losing their reference to the anonymous
producer created when useAnonymousProducers is true. The anonymous
producer stays live for the life of the pooled session.
Also added some synchronization safety to some methods that could get
into NPE trouble.
Explicity set the properties from the generic JMS pooled
connectionfactory as the introspection based tools can easily get stuck
on getters that cause recursion or on inner types that have methods
which allow chaining.
Refactor the way sessions are pooled. We don't need to keep the
PooledSession instances around since the state is unique to the session
it wraps we only need to keep the Session instances in the SessionPool
and create a new PooledSession on borrow to manage that session. This
allows the PooledSession to have a real closed state that protects
against multiple close calls placing duplicate PooledSession instances
into the SessionPool. This also simplifies the code in the
XaConnectionPool since it doesn't need to try and reset state in
PouledSessions before placing them back as it gets a fresh wrapper each
time with the correct state.
Set all session properties back using a session listener close event so
that the returned session is not modified after it's already been
re-dispatched from the pool.