synchronized ( this ) {
//a session has terminated -> check reusability of all remaining
Configuration.logDebug ( this + ": a session has terminated, is connection now available ? " + isAvailable() );
if ( isAvailable() ) {
if ( currentProxy != null ) {
DynamicProxy dproxy = ( DynamicProxy ) currentProxy;
AtomikosJmsConnectionProxy proxy = (AtomikosJmsConnectionProxy) dproxy.getInvocationHandler();
if ( proxy.isErroneous() ) erroneous = true;
proxy.destroy();
}
fireTerminatedEvent = true;
} else {
//not yet available, but check if the connection is erroneous
//which happens if the session being terminated is erroneous
if ( currentProxy != null ) {
DynamicProxy dproxy = ( DynamicProxy ) currentProxy;
AtomikosJmsConnectionProxy proxy = (AtomikosJmsConnectionProxy) dproxy.getInvocationHandler();
if ( proxy.isErroneous() ) erroneous = true;
}
}
}