public abstract class JmsUtils
extends java.lang.Object
Constructor and Description |
---|
JmsUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.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 checked
JMSException to a
Spring runtime JmsException equivalent. |
static void |
rollbackIfNecessary(Session session)
Rollback the Session if not within a JTA transaction.
|
public static void closeConnection(Connection con)
finally
blocks in manual JMS code.con
- the JMS Connection to close (may be null
)public static void closeConnection(Connection con, boolean stop)
finally
blocks in manual JMS code.con
- the JMS Connection to close (may be null
)stop
- whether to call stop()
before closingpublic static void closeSession(Session session)
finally
blocks in manual JMS code.session
- the JMS Session to close (may be null
)public static void closeMessageProducer(MessageProducer producer)
finally
blocks in manual JMS code.producer
- the JMS MessageProducer to close (may be null
)public static void closeMessageConsumer(MessageConsumer consumer)
finally
blocks in manual JMS code.consumer
- the JMS MessageConsumer to close (may be null
)public static void closeQueueBrowser(QueueBrowser browser)
finally
blocks in manual JMS code.browser
- the JMS QueueBrowser to close (may be null
)public static void closeQueueRequestor(QueueRequestor requestor)
finally
blocks in manual JMS code.requestor
- the JMS QueueRequestor to close (may be null
)public static void commitIfNecessary(Session session) throws JMSException
session
- the JMS Session to commitJMSException
- if committing failedpublic static void rollbackIfNecessary(Session session) throws JMSException
session
- the JMS Session to rollbackJMSException
- if committing failedpublic static java.lang.String buildExceptionMessage(JMSException ex)
ex
- the JMSException to build a message forJMSException.getLinkedException()
public static JmsException convertJmsAccessException(JMSException ex)
JMSException
to a
Spring runtime JmsException
equivalent.ex
- the original checked JMSException to convert