Package org.apache.activemq.ra
Class ActiveMQManagedConnection
- java.lang.Object
-
- org.apache.activemq.ra.ActiveMQManagedConnection
-
- All Implemented Interfaces:
ExceptionListener,ManagedConnection
public class ActiveMQManagedConnection extends Object implements ManagedConnection, 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
Constructors Constructor Description ActiveMQManagedConnection(Subject subject, ActiveMQConnection physicalConnection, ActiveMQConnectionRequestInfo info)
-
Method Summary
-
-
-
Constructor Detail
-
ActiveMQManagedConnection
public ActiveMQManagedConnection(Subject subject, ActiveMQConnection physicalConnection, ActiveMQConnectionRequestInfo info) throws ResourceException
- Throws:
ResourceException
-
-
Method Detail
-
isInManagedTx
public boolean isInManagedTx()
-
associate
public void associate(Subject subject, ActiveMQConnectionRequestInfo info) throws JMSException
- Throws:
JMSException
-
getPhysicalConnection
public Connection getPhysicalConnection()
-
getConnection
public Object getConnection(Subject subject, ConnectionRequestInfo info) throws ResourceException
- Specified by:
getConnectionin interfaceManagedConnection- Throws:
ResourceException- See Also:
ManagedConnection.getConnection(javax.security.auth.Subject, javax.resource.spi.ConnectionRequestInfo)
-
destroy
public void destroy() throws ResourceExceptionClose down the physical connection to the server.- Specified by:
destroyin interfaceManagedConnection- Throws:
ResourceException- See Also:
ManagedConnection.destroy()
-
cleanup
public void cleanup() throws ResourceExceptionCleans up all proxy handles attached to this physical connection so that they cannot be used anymore.- Specified by:
cleanupin interfaceManagedConnection- Throws:
ResourceException- See Also:
ManagedConnection.cleanup()
-
associateConnection
public void associateConnection(Object connection) throws ResourceException
- Specified by:
associateConnectionin interfaceManagedConnection- Throws:
ResourceException- See Also:
ManagedConnection.associateConnection(java.lang.Object)
-
addConnectionEventListener
public void addConnectionEventListener(ConnectionEventListener listener)
- Specified by:
addConnectionEventListenerin interfaceManagedConnection- See Also:
ManagedConnection.addConnectionEventListener(javax.resource.spi.ConnectionEventListener)
-
removeConnectionEventListener
public void removeConnectionEventListener(ConnectionEventListener listener)
- Specified by:
removeConnectionEventListenerin interfaceManagedConnection- See Also:
ManagedConnection.removeConnectionEventListener(javax.resource.spi.ConnectionEventListener)
-
getXAResource
public XAResource getXAResource() throws ResourceException
- Specified by:
getXAResourcein interfaceManagedConnection- Throws:
ResourceException- See Also:
ManagedConnection.getXAResource()
-
getLocalTransaction
public LocalTransaction getLocalTransaction() throws ResourceException
- Specified by:
getLocalTransactionin interfaceManagedConnection- Throws:
ResourceException- See Also:
ManagedConnection.getLocalTransaction()
-
getMetaData
public ManagedConnectionMetaData getMetaData() throws ResourceException
- Specified by:
getMetaDatain interfaceManagedConnection- Throws:
ResourceException- See Also:
ManagedConnection.getMetaData()
-
setLogWriter
public void setLogWriter(PrintWriter logWriter) throws ResourceException
- Specified by:
setLogWriterin interfaceManagedConnection- Throws:
ResourceException- See Also:
ManagedConnection.setLogWriter(java.io.PrintWriter)
-
getLogWriter
public PrintWriter getLogWriter() throws ResourceException
- Specified by:
getLogWriterin interfaceManagedConnection- Throws:
ResourceException- See Also:
ManagedConnection.getLogWriter()
-
matches
public boolean matches(Subject subject, ConnectionRequestInfo info)
- 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
public void proxyClosedEvent(ManagedConnectionProxy proxy)
When a proxy is closed this cleans up the proxy and notifies the ConnectionEventListeners that a connection closed.- Parameters:
proxy-
-
onException
public void onException(JMSException e)
- Specified by:
onExceptionin interfaceExceptionListener
-
getTransactionContext
public TransactionContext getTransactionContext()
- Returns:
- Returns the transactionContext.
-
-