站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 1.2.9 API 文档英文版

JmsUtils (Spring Framework) - Spring Framework 1.2.9 API 文档英文版


org.springframework.jms.support
Class JmsUtils

java.lang.Object
  extended by org.springframework.jms.support.JmsUtils

public abstract class JmsUtils
extends Object

Generic utility methods for working with JMS. Mainly for internal use within the framework, but also useful for custom JMS access code.

Since:
1.1
Author:
Juergen Hoeller

Constructor Summary
JmsUtils()
           
 
Method Summary
static void closeConnection(Connection con)
          Close the given JMS Connection and ignore any thrown exception.
static void closeMessageConsumer(MessageConsumer consumer)
          Close the given JMS MessageConsumer and ignore any thrown exception.
static void closeMessageProducer(MessageProducer producer)
          Close the given JMS MessageProducer and ignore any thrown exception.
static void closeSession(Session session)
          Close the given JMS Session and ignore any thrown exception.
static void commitIfNecessary(Session session)
          Commit the Session if not within a JTA transaction.
static JmsException convertJmsAccessException(JMSException ex)
          Convert the specified checked JMSException to a Spring runtime JmsException equivalent.
static void rollbackIfNecessary(Session session)
          Rollback the Session if not within a JTA transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JmsUtils

public JmsUtils()
Method Detail

closeConnection

public static void closeConnection(Connection con)
Close the given JMS Connection and ignore any thrown exception. This is useful for typical finally blocks in manual JMS code.

Parameters:
con - the JMS Connection to close (may be null)

closeSession

public static void closeSession(Session session)
Close the given JMS Session and ignore any thrown exception. This is useful for typical finally blocks in manual JMS code.

Parameters:
session - the JMS Session to close (may be null)

closeMessageProducer

public static void closeMessageProducer(MessageProducer producer)
Close the given JMS MessageProducer and ignore any thrown exception. This is useful for typical finally blocks in manual JMS code.

Parameters:
producer - the JMS MessageProducer to close (may be null)

closeMessageConsumer

public static void closeMessageConsumer(MessageConsumer consumer)
Close the given JMS MessageConsumer and ignore any thrown exception. This is useful for typical finally blocks in manual JMS code.

Parameters:
consumer - the JMS MessageConsumer to close (may be null)

commitIfNecessary

public static void commitIfNecessary(Session session)
                              throws JMSException
Commit the Session if not within a JTA transaction.

Parameters:
session - the JMS Session to commit
Throws:
JMSException - if committing failed

rollbackIfNecessary

public static void rollbackIfNecessary(Session session)
                                throws JMSException
Rollback the Session if not within a JTA transaction.

Parameters:
session - the JMS Session to rollback
Throws:
JMSException - if committing failed

convertJmsAccessException

public static JmsException convertJmsAccessException(JMSException ex)
Convert the specified checked JMSException to a Spring runtime JmsException equivalent.

Parameters:
ex - the original checked JMSException to convert
Returns:
the Spring runtime JmsException wrapping the given exception


Copyright (c) 2002-2007 The Spring Framework Project.