Package org.apache.activemq.ra
Class ActiveMQManagedConnection
java.lang.Object
org.apache.activemq.ra.ActiveMQManagedConnection
- All Implemented Interfaces:
jakarta.jms.ExceptionListener,jakarta.resource.spi.ManagedConnection
public class ActiveMQManagedConnection
extends Object
implements jakarta.resource.spi.ManagedConnection, jakarta.jms.ExceptionListener
ActiveMQManagedConnection maps to real physical connection to the server.
Since a ManagedConnection has to provide a transaction managment interface to
the physical connection, and sessions are the objects implement transaction
managment interfaces in the JMS API, this object also maps to a singe
physical JMS session. The side-effect is that JMS connection the
application gets will allways create the same session object. This is good if
running in an app server since the sessions are elisted in the context
transaction. This is bad if used outside of an app server since the user may
be trying to create 2 different sessions to coordinate 2 different uow.
-
Constructor Summary
ConstructorsConstructorDescriptionActiveMQManagedConnection(Subject subject, org.apache.activemq.ActiveMQConnection physicalConnection, ActiveMQConnectionRequestInfo info) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConnectionEventListener(jakarta.resource.spi.ConnectionEventListener listener) voidassociate(Subject subject, ActiveMQConnectionRequestInfo info) voidassociateConnection(Object connection) voidcleanup()Cleans up all proxy handles attached to this physical connection so that they cannot be used anymore.voiddestroy()Close down the physical connection to the server.getConnection(Subject subject, jakarta.resource.spi.ConnectionRequestInfo info) jakarta.resource.spi.LocalTransactionjakarta.resource.spi.ManagedConnectionMetaDatajakarta.jms.Connectionorg.apache.activemq.TransactionContextbooleanstatic booleanbooleanvoidonException(jakarta.jms.JMSException e) voidWhen a proxy is closed this cleans up the proxy and notifies the ConnectionEventListeners that a connection closed.voidremoveConnectionEventListener(jakarta.resource.spi.ConnectionEventListener listener) voidsetLogWriter(PrintWriter logWriter) toString()
-
Constructor Details
-
ActiveMQManagedConnection
public ActiveMQManagedConnection(Subject subject, org.apache.activemq.ActiveMQConnection physicalConnection, ActiveMQConnectionRequestInfo info) throws jakarta.resource.ResourceException - Throws:
jakarta.resource.ResourceException
-
-
Method Details
-
isInManagedTx
public boolean isInManagedTx() -
matches
-
associate
public void associate(Subject subject, ActiveMQConnectionRequestInfo info) throws jakarta.jms.JMSException - Throws:
jakarta.jms.JMSException
-
getPhysicalConnection
public jakarta.jms.Connection getPhysicalConnection() -
getConnection
public Object getConnection(Subject subject, jakarta.resource.spi.ConnectionRequestInfo info) throws jakarta.resource.ResourceException - Specified by:
getConnectionin interfacejakarta.resource.spi.ManagedConnection- Throws:
jakarta.resource.ResourceException- See Also:
-
javax.resource.spi.ManagedConnection#getConnection(javax.security.auth.Subject, javax.resource.spi.ConnectionRequestInfo)
-
destroy
public void destroy() throws jakarta.resource.ResourceExceptionClose down the physical connection to the server.- Specified by:
destroyin interfacejakarta.resource.spi.ManagedConnection- Throws:
jakarta.resource.ResourceException- See Also:
-
javax.resource.spi.ManagedConnection#destroy()
-
cleanup
public void cleanup() throws jakarta.resource.ResourceExceptionCleans up all proxy handles attached to this physical connection so that they cannot be used anymore.- Specified by:
cleanupin interfacejakarta.resource.spi.ManagedConnection- Throws:
jakarta.resource.ResourceException- See Also:
-
javax.resource.spi.ManagedConnection#cleanup()
-
associateConnection
- Specified by:
associateConnectionin interfacejakarta.resource.spi.ManagedConnection- Throws:
jakarta.resource.ResourceException- See Also:
-
javax.resource.spi.ManagedConnection#associateConnection(java.lang.Object)
-
addConnectionEventListener
public void addConnectionEventListener(jakarta.resource.spi.ConnectionEventListener listener) - Specified by:
addConnectionEventListenerin interfacejakarta.resource.spi.ManagedConnection- See Also:
-
javax.resource.spi.ManagedConnection#addConnectionEventListener(javax.resource.spi.ConnectionEventListener)
-
removeConnectionEventListener
public void removeConnectionEventListener(jakarta.resource.spi.ConnectionEventListener listener) - Specified by:
removeConnectionEventListenerin interfacejakarta.resource.spi.ManagedConnection- See Also:
-
javax.resource.spi.ManagedConnection#removeConnectionEventListener(javax.resource.spi.ConnectionEventListener)
-
getXAResource
- Specified by:
getXAResourcein interfacejakarta.resource.spi.ManagedConnection- Throws:
jakarta.resource.ResourceException- See Also:
-
javax.resource.spi.ManagedConnection#getXAResource()
-
getLocalTransaction
public jakarta.resource.spi.LocalTransaction getLocalTransaction() throws jakarta.resource.ResourceException- Specified by:
getLocalTransactionin interfacejakarta.resource.spi.ManagedConnection- Throws:
jakarta.resource.ResourceException- See Also:
-
javax.resource.spi.ManagedConnection#getLocalTransaction()
-
getMetaData
public jakarta.resource.spi.ManagedConnectionMetaData getMetaData() throws jakarta.resource.ResourceException- Specified by:
getMetaDatain interfacejakarta.resource.spi.ManagedConnection- Throws:
jakarta.resource.ResourceException- See Also:
-
javax.resource.spi.ManagedConnection#getMetaData()
-
setLogWriter
- Specified by:
setLogWriterin interfacejakarta.resource.spi.ManagedConnection- Throws:
jakarta.resource.ResourceException- See Also:
-
javax.resource.spi.ManagedConnection#setLogWriter(java.io.PrintWriter)
-
getLogWriter
- Specified by:
getLogWriterin interfacejakarta.resource.spi.ManagedConnection- Throws:
jakarta.resource.ResourceException- See Also:
-
javax.resource.spi.ManagedConnection#getLogWriter()
-
matches
- Parameters:
subject- subject to matchinfo- cri to match- Returns:
- whether the subject and cri match sufficiently to allow using this connection under the new circumstances
-
proxyClosedEvent
When a proxy is closed this cleans up the proxy and notifies the ConnectionEventListeners that a connection closed.- Parameters:
proxy-
-
onException
public void onException(jakarta.jms.JMSException e) - Specified by:
onExceptionin interfacejakarta.jms.ExceptionListener
-
getTransactionContext
public org.apache.activemq.TransactionContext getTransactionContext()- Returns:
- Returns the transactionContext.
-
toString
-