Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.jms.support
Class JmsUtils

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

    public abstract class JmsUtils

extends java.lang.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 java.lang.String` | `buildExceptionMessage(javax.jms.JMSException ex)` Build a descriptive exception message for the given JMSException, incorporating a linked exception's message if appropriate.
`static void` | `closeConnection(javax.jms.Connection con)` Close the given JMS Connection and ignore any thrown exception.
`static void` | `closeConnection(javax.jms.Connection con, boolean stop)` Close the given JMS Connection and ignore any thrown exception.
`static void` | `closeMessageConsumer(javax.jms.MessageConsumer consumer)` Close the given JMS MessageConsumer and ignore any thrown exception.
`static void` | `closeMessageProducer(javax.jms.MessageProducer producer)` Close the given JMS MessageProducer and ignore any thrown exception.
`static void` | `closeQueueBrowser(javax.jms.QueueBrowser browser)` Close the given JMS QueueBrowser and ignore any thrown exception.
`static void` | `closeQueueRequestor(javax.jms.QueueRequestor requestor)` Close the given JMS QueueRequestor and ignore any thrown exception.
`static void` | `closeSession(javax.jms.Session session)` Close the given JMS Session and ignore any thrown exception.
`static void` | `commitIfNecessary(javax.jms.Session session)` Commit the Session if not within a JTA transaction.
`static JmsException` | `convertJmsAccessException(javax.jms.JMSException ex)` Convert the specified checked `JMSException` to a Spring runtime `JmsException` equivalent.
`static void` | `rollbackIfNecessary(javax.jms.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(javax.jms.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`)

### closeConnection

    public static void closeConnection(javax.jms.Connection con,
                                       boolean stop)

  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`)
    `stop` - whether to call `stop()` before closing

### closeSession

    public static void closeSession(javax.jms.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(javax.jms.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(javax.jms.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`)

### closeQueueBrowser

    public static void closeQueueBrowser(javax.jms.QueueBrowser browser)

  Close the given JMS QueueBrowser and ignore any thrown exception. This is useful for typical `finally` blocks in manual JMS code.

  Parameters:
    `browser` - the JMS QueueBrowser to close (may be `null`)

### closeQueueRequestor

    public static void closeQueueRequestor(javax.jms.QueueRequestor requestor)

  Close the given JMS QueueRequestor and ignore any thrown exception. This is useful for typical `finally` blocks in manual JMS code.

  Parameters:
    `requestor` - the JMS QueueRequestor to close (may be `null`)

### commitIfNecessary

    public static void commitIfNecessary(javax.jms.Session session)
                                  throws javax.jms.JMSException

  Commit the Session if not within a JTA transaction.

  Parameters:
    `session` - the JMS Session to commit
  Throws:
    `javax.jms.JMSException` - if committing failed

### rollbackIfNecessary

    public static void rollbackIfNecessary(javax.jms.Session session)
                                    throws javax.jms.JMSException

  Rollback the Session if not within a JTA transaction.

  Parameters:
    `session` - the JMS Session to rollback
  Throws:
    `javax.jms.JMSException` - if committing failed

### buildExceptionMessage

    public static java.lang.String buildExceptionMessage(javax.jms.JMSException ex)

  Build 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:
    `JMSException.getLinkedException()`

### convertJmsAccessException

    public static JmsException convertJmsAccessException(javax.jms.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

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD