Class JmsUtils
java.lang.Object
org.springframework.jms.support.JmsUtils
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, Sam Brannen
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionBuild a descriptive exception message for the given JMSException, incorporating a linked exception's message if appropriate.static voidClose the given JMS Connection and ignore any thrown exception.static voidcloseConnection(@Nullable Connection con, boolean stop) Close the given JMS Connection and ignore any thrown exception.static voidcloseMessageConsumer(@Nullable MessageConsumer consumer) Close the given JMS MessageConsumer and ignore any thrown exception.static voidcloseMessageProducer(@Nullable MessageProducer producer) Close the given JMS MessageProducer and ignore any thrown exception.static voidcloseQueueBrowser(@Nullable QueueBrowser browser) Close the given JMS QueueBrowser and ignore any thrown exception.static voidcloseQueueRequestor(@Nullable QueueRequestor requestor) Close the given JMS QueueRequestor and ignore any thrown exception.static voidcloseSession(@Nullable Session session) Close the given JMS Session and ignore any thrown exception.static voidcommitIfNecessary(Session session) Commit the Session if not within a JTA transaction.static JmsExceptionConvert the specified checkedJMSExceptionto a Spring runtimeJmsExceptionequivalent.static voidrollbackIfNecessary(Session session) Roll back the Session if not within a JTA transaction.
- 
Constructor Details- 
JmsUtilspublic JmsUtils()
 
- 
- 
Method Details- 
closeConnectionClose the given JMS Connection and ignore any thrown exception.This is useful for typical finallyblocks in manual JMS code.- Parameters:
- con- the JMS Connection to close (may be- null)
 
- 
closeConnectionClose the given JMS Connection and ignore any thrown exception.This is useful for typical finallyblocks in manual JMS code.- Parameters:
- con- the JMS Connection to close (may be- null)
- stop- whether to call- stop()before closing
 
- 
closeSession
- 
closeMessageProducerClose the given JMS MessageProducer and ignore any thrown exception.This is useful for typical finallyblocks in manual JMS code.- Parameters:
- producer- the JMS MessageProducer to close (may be- null)
 
- 
closeMessageConsumerClose the given JMS MessageConsumer and ignore any thrown exception.This is useful for typical finallyblocks in manual JMS code.- Parameters:
- consumer- the JMS MessageConsumer to close (may be- null)
 
- 
closeQueueBrowserClose the given JMS QueueBrowser and ignore any thrown exception.This is useful for typical finallyblocks in manual JMS code.- Parameters:
- browser- the JMS QueueBrowser to close (may be- null)
 
- 
closeQueueRequestorClose the given JMS QueueRequestor and ignore any thrown exception.This is useful for typical finallyblocks in manual JMS code.- Parameters:
- requestor- the JMS QueueRequestor to close (may be- null)
 
- 
commitIfNecessaryCommit the Session if not within a JTA transaction.- Parameters:
- session- the JMS Session to commit
- Throws:
- JMSException- if committing failed
 
- 
rollbackIfNecessaryRoll back the Session if not within a JTA transaction.- Parameters:
- session- the JMS Session to rollback
- Throws:
- JMSException- if committing failed
 
- 
buildExceptionMessageBuild a descriptive exception message for the given JMSException, incorporating a linked exception's message if appropriate.- Parameters:
- ex- the JMSException to build a message for
- Returns:
- the descriptive message String
- See Also:
 
- 
convertJmsAccessExceptionConvert the specified checkedJMSExceptionto a Spring runtimeJmsExceptionequivalent.- Parameters:
- ex- the original checked JMSException to convert
- Returns:
- the Spring runtime JmsException wrapping the given exception
 
 
-