bitronix.tm.resource.jms
Class JmsPooledConnection

java.lang.Object
  extended by bitronix.tm.resource.common.AbstractXAStatefulHolder
      extended by bitronix.tm.resource.jms.JmsPooledConnection
All Implemented Interfaces:
XAStatefulHolder, JmsPooledConnectionMBean

public class JmsPooledConnection
extends AbstractXAStatefulHolder
implements JmsPooledConnectionMBean

Implementation of a JMS pooled connection wrapping vendor's XAConnection implementation.

Author:
lorban TODO: how can the JMS connection be accurately tested?

Field Summary
 
Fields inherited from interface bitronix.tm.resource.common.XAStatefulHolder
STATE_ACCESSIBLE, STATE_CLOSED, STATE_IN_POOL, STATE_NOT_ACCESSIBLE
 
Constructor Summary
protected JmsPooledConnection(PoolingConnectionFactory poolingConnectionFactory, javax.jms.XAConnection connection)
           
 
Method Summary
 void close()
          Close the physical connection that this XAStatefulHolder represents.
 RecoveryXAResourceHolder createRecoveryXAResourceHolder()
           
protected  javax.jms.Session createSession(boolean transacted, int acknowledgeMode)
           
 Date getAcquisitionDate()
           
 Object getConnectionHandle()
          Create a disposable handler used to drive a pooled instance of XAStatefulHolder.
 Date getLastReleaseDate()
          Get the date at which this object was last released to the pool.
 PoolingConnectionFactory getPoolingConnectionFactory()
           
 String getStateDescription()
           
 Collection<String> getTransactionGtridsCurrentlyHoldingThis()
           
 javax.jms.XAConnection getXAConnection()
           
 List<XAResourceHolder> getXAResourceHolders()
          Get the list of XAResourceHolders created by this XAStatefulHolder that are still open.
protected  void release()
           
 String toString()
           
 
Methods inherited from class bitronix.tm.resource.common.AbstractXAStatefulHolder
addStateChangeEventListener, getState, removeStateChangeEventListener, setState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JmsPooledConnection

protected JmsPooledConnection(PoolingConnectionFactory poolingConnectionFactory,
                              javax.jms.XAConnection connection)
Method Detail

getXAConnection

public javax.jms.XAConnection getXAConnection()

getPoolingConnectionFactory

public PoolingConnectionFactory getPoolingConnectionFactory()

createRecoveryXAResourceHolder

public RecoveryXAResourceHolder createRecoveryXAResourceHolder()
                                                        throws javax.jms.JMSException
Throws:
javax.jms.JMSException

close

public void close()
           throws javax.jms.JMSException
Description copied from interface: XAStatefulHolder
Close the physical connection that this XAStatefulHolder represents.

Specified by:
close in interface XAStatefulHolder
Throws:
javax.jms.JMSException

getXAResourceHolders

public List<XAResourceHolder> getXAResourceHolders()
Description copied from interface: XAStatefulHolder
Get the list of XAResourceHolders created by this XAStatefulHolder that are still open.

This method is thread-safe.

Specified by:
getXAResourceHolders in interface XAStatefulHolder
Returns:
the list of XAResourceHolders created by this XAStatefulHolder that are still open.

getConnectionHandle

public Object getConnectionHandle()
                           throws Exception
Description copied from interface: XAStatefulHolder
Create a disposable handler used to drive a pooled instance of XAStatefulHolder.

This method is thread-safe.

Specified by:
getConnectionHandle in interface XAStatefulHolder
Returns:
a resource-specific disaposable connection object.
Throws:
Exception - a resource-specific exception thrown when the disaposable connection cannot be created.

release

protected void release()
                throws javax.jms.JMSException
Throws:
javax.jms.JMSException

createSession

protected javax.jms.Session createSession(boolean transacted,
                                          int acknowledgeMode)
                                   throws javax.jms.JMSException
Throws:
javax.jms.JMSException

getLastReleaseDate

public Date getLastReleaseDate()
Description copied from interface: XAStatefulHolder
Get the date at which this object was last released to the pool. This is required to check if it is eligible for discard when the containing pool needs to shrink.

Specified by:
getLastReleaseDate in interface XAStatefulHolder
Returns:
the date at which this object was last released to the pool or null if it never left the pool.

toString

public String toString()
Overrides:
toString in class Object

getStateDescription

public String getStateDescription()
Specified by:
getStateDescription in interface JmsPooledConnectionMBean

getAcquisitionDate

public Date getAcquisitionDate()
Specified by:
getAcquisitionDate in interface JmsPooledConnectionMBean

getTransactionGtridsCurrentlyHoldingThis

public Collection<String> getTransactionGtridsCurrentlyHoldingThis()
Specified by:
getTransactionGtridsCurrentlyHoldingThis in interface JmsPooledConnectionMBean


Copyright © 2006-2013 Bitronix Software. All Rights Reserved.