public synchronized Object getHandle() { if (connectionTrackingInterceptor == null) { // connection has been closed... send invocations directly to the handle // which will throw an exception or in some clases like JDBC connection.close() // ignore the invocation return handle; } if (released) { try { connectionTrackingInterceptor.reassociateConnection(connectionInfo); } catch (ResourceException e) { throw (IllegalStateException) new IllegalStateException("Could not obtain a physical connection").initCause(e); } released = false; } return handle; } }