org.springframework.jms.connection
Class JmsResourceHolder

java.lang.Object
  extended by org.springframework.transaction.support.ResourceHolderSupport
      extended by org.springframework.jms.connection.JmsResourceHolder
All Implemented Interfaces:
ResourceHolder

public class JmsResourceHolder
extends ResourceHolderSupport

JMS resource holder, wrapping a JMS Connection and a JMS Session. JmsTransactionManager binds instances of this class to the thread, for a given JMS ConnectionFactory.

Note: This is an SPI class, not intended to be used by applications.

Since:
1.1
Author:
Juergen Hoeller
See Also:
JmsTransactionManager, JmsTemplate

Constructor Summary
JmsResourceHolder()
          Create a new JmsResourceHolder that is open for resources to be added.
JmsResourceHolder(ConnectionFactory connectionFactory)
          Create a new JmsResourceHolder that is open for resources to be added.
JmsResourceHolder(ConnectionFactory connectionFactory, Connection connection, Session session)
          Create a new JmsResourceHolder for the given JMS resources.
JmsResourceHolder(Connection connection, Session session)
          Create a new JmsResourceHolder for the given JMS resources.
JmsResourceHolder(Session session)
          Create a new JmsResourceHolder for the given JMS Session.
 
Method Summary
 void addConnection(Connection connection)
           
 void addSession(Session session)
           
 void addSession(Session session, Connection connection)
           
 void closeAll()
           
 void commitAll()
           
 boolean containsSession(Session session)
           
 Connection getConnection()
           
 Connection getConnection(Class<? extends Connection> connectionType)
           
 Session getSession()
           
 Session getSession(Class<? extends Session> sessionType)
           
 Session getSession(Class<? extends Session> sessionType, Connection connection)
           
 boolean isFrozen()
           
 
Methods inherited from class org.springframework.transaction.support.ResourceHolderSupport
clear, getDeadline, getTimeToLiveInMillis, getTimeToLiveInSeconds, hasTimeout, isOpen, isRollbackOnly, isSynchronizedWithTransaction, isVoid, released, requested, reset, setRollbackOnly, setSynchronizedWithTransaction, setTimeoutInMillis, setTimeoutInSeconds, unbound
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JmsResourceHolder

public JmsResourceHolder()
Create a new JmsResourceHolder that is open for resources to be added.

See Also:
addConnection(javax.jms.Connection), addSession(javax.jms.Session)

JmsResourceHolder

public JmsResourceHolder(ConnectionFactory connectionFactory)
Create a new JmsResourceHolder that is open for resources to be added.

Parameters:
connectionFactory - the JMS ConnectionFactory that this resource holder is associated with (may be null)

JmsResourceHolder

public JmsResourceHolder(Session session)
Create a new JmsResourceHolder for the given JMS Session.

Parameters:
session - the JMS Session

JmsResourceHolder

public JmsResourceHolder(Connection connection,
                         Session session)
Create a new JmsResourceHolder for the given JMS resources.

Parameters:
connection - the JMS Connection
session - the JMS Session

JmsResourceHolder

public JmsResourceHolder(ConnectionFactory connectionFactory,
                         Connection connection,
                         Session session)
Create a new JmsResourceHolder for the given JMS resources.

Parameters:
connectionFactory - the JMS ConnectionFactory that this resource holder is associated with (may be null)
connection - the JMS Connection
session - the JMS Session
Method Detail

isFrozen

public final boolean isFrozen()

addConnection

public final void addConnection(Connection connection)

addSession

public final void addSession(Session session)

addSession

public final void addSession(Session session,
                             Connection connection)

containsSession

public boolean containsSession(Session session)

getConnection

public Connection getConnection()

getConnection

public Connection getConnection(Class<? extends Connection> connectionType)

getSession

public Session getSession()

getSession

public Session getSession(Class<? extends Session> sessionType)

getSession

public Session getSession(Class<? extends Session> sessionType,
                          Connection connection)

commitAll

public void commitAll()
               throws JMSException
Throws:
JMSException

closeAll

public void closeAll()