Spring Framework

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(javax.jms.ConnectionFactory connectionFactory)
          Create a new JmsResourceHolder that is open for resources to be added.
JmsResourceHolder(javax.jms.ConnectionFactory connectionFactory, javax.jms.Connection connection, javax.jms.Session session)
          Create a new JmsResourceHolder for the given JMS resources.
JmsResourceHolder(javax.jms.Connection connection, javax.jms.Session session)
          Create a new JmsResourceHolder for the given JMS resources.
JmsResourceHolder(javax.jms.Session session)
          Create a new JmsResourceHolder for the given JMS Session.
 
Method Summary
 void addConnection(javax.jms.Connection connection)
           
 void addSession(javax.jms.Session session)
           
 void addSession(javax.jms.Session session, javax.jms.Connection connection)
           
 void closeAll()
           
 void commitAll()
           
 boolean containsSession(javax.jms.Session session)
           
 javax.jms.Connection getConnection()
           
 javax.jms.Connection getConnection(java.lang.Class<? extends javax.jms.Connection> connectionType)
           
 javax.jms.Session getSession()
           
 javax.jms.Session getSession(java.lang.Class<? extends javax.jms.Session> sessionType)
           
 javax.jms.Session getSession(java.lang.Class<? extends javax.jms.Session> sessionType, javax.jms.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(javax.jms.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(javax.jms.Session session)
Create a new JmsResourceHolder for the given JMS Session.

Parameters:
session - the JMS Session

JmsResourceHolder

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

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

JmsResourceHolder

public JmsResourceHolder(javax.jms.ConnectionFactory connectionFactory,
                         javax.jms.Connection connection,
                         javax.jms.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(javax.jms.Connection connection)

addSession

public final void addSession(javax.jms.Session session)

addSession

public final void addSession(javax.jms.Session session,
                             javax.jms.Connection connection)

containsSession

public boolean containsSession(javax.jms.Session session)

getConnection

public javax.jms.Connection getConnection()

getConnection

public javax.jms.Connection getConnection(java.lang.Class<? extends javax.jms.Connection> connectionType)

getSession

public javax.jms.Session getSession()

getSession

public javax.jms.Session getSession(java.lang.Class<? extends javax.jms.Session> sessionType)

getSession

public javax.jms.Session getSession(java.lang.Class<? extends javax.jms.Session> sessionType,
                                    javax.jms.Connection connection)

commitAll

public void commitAll()
               throws javax.jms.JMSException
Throws:
javax.jms.JMSException

closeAll

public void closeAll()

Spring Framework