类 JmsUtils
- java.lang.Object
- org.springframework.jms.support.JmsUtils
构造器概要
构造器 构造器 说明 JmsUtils()
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static String
buildExceptionMessage(JMSException ex)
Build a descriptive exception message for the given JMSException, incorporating a linked exception's message if appropriate.static void
closeConnection(Connection con)
Close the given JMS Connection and ignore any thrown exception.static void
closeConnection(Connection con, boolean stop)
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
closeQueueBrowser(QueueBrowser browser)
Close the given JMS QueueBrowser and ignore any thrown exception.static void
closeQueueRequestor(QueueRequestor requestor)
Close the given JMS QueueRequestor 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 checkedJMSException
to a Spring runtimeJmsException
equivalent.static void
rollbackIfNecessary(Session session)
Rollback the Session if not within a JTA transaction.
构造器详细资料
JmsUtils
public JmsUtils()
方法详细资料
closeConnection
public static void closeConnection(Connection con)
Close the given JMS Connection and ignore any thrown exception. This is useful for typicalfinally
blocks in manual JMS code.- 参数:
con
- the JMS Connection to close (may benull
)
closeConnection
public static void closeConnection(Connection con, boolean stop)
Close the given JMS Connection and ignore any thrown exception. This is useful for typicalfinally
blocks in manual JMS code.- 参数:
con
- the JMS Connection to close (may benull
)stop
- whether to callstop()
before closing
closeSession
public static void closeSession(Session session)
Close the given JMS Session and ignore any thrown exception. This is useful for typicalfinally
blocks in manual JMS code.- 参数:
session
- the JMS Session to close (may benull
)
closeMessageProducer
public static void closeMessageProducer(MessageProducer producer)
Close the given JMS MessageProducer and ignore any thrown exception. This is useful for typicalfinally
blocks in manual JMS code.- 参数:
producer
- the JMS MessageProducer to close (may benull
)
closeMessageConsumer
public static void closeMessageConsumer(MessageConsumer consumer)
Close the given JMS MessageConsumer and ignore any thrown exception. This is useful for typicalfinally
blocks in manual JMS code.- 参数:
consumer
- the JMS MessageConsumer to close (may benull
)
closeQueueBrowser
public static void closeQueueBrowser(QueueBrowser browser)
Close the given JMS QueueBrowser and ignore any thrown exception. This is useful for typicalfinally
blocks in manual JMS code.- 参数:
browser
- the JMS QueueBrowser to close (may benull
)
closeQueueRequestor
public static void closeQueueRequestor(QueueRequestor requestor)
Close the given JMS QueueRequestor and ignore any thrown exception. This is useful for typicalfinally
blocks in manual JMS code.- 参数:
requestor
- the JMS QueueRequestor to close (may benull
)
commitIfNecessary
public static void commitIfNecessary(Session session) throws JMSException
Commit the Session if not within a JTA transaction.- 参数:
session
- the JMS Session to commit- 抛出:
JMSException
- if committing failed
rollbackIfNecessary
public static void rollbackIfNecessary(Session session) throws JMSException
Rollback the Session if not within a JTA transaction.- 参数:
session
- the JMS Session to rollback- 抛出:
JMSException
- if committing failed
buildExceptionMessage
public static String buildExceptionMessage(JMSException ex)
Build a descriptive exception message for the given JMSException, incorporating a linked exception's message if appropriate.- 参数:
ex
- the JMSException to build a message for- 返回:
- the descriptive message String
- 另请参阅:
JMSException.getLinkedException()
convertJmsAccessException
public static JmsException convertJmsAccessException(JMSException ex)
Convert the specified checkedJMSException
to a Spring runtimeJmsException
equivalent.- 参数:
ex
- the original checked JMSException to convert- 返回:
- the Spring runtime JmsException wrapping the given exception