Example usage for javax.jms Session recover

List of usage examples for javax.jms Session recover

Introduction

In this page you can find the example usage for javax.jms Session recover.

Prototype


void recover() throws JMSException;

Source Link

Document

Stops message delivery in this session, and restarts message delivery with the oldest unacknowledged message.

Usage

From source file:org.apache.qpid.disttest.jms.ClientJmsDelegate.java

public void rollbackOrRecoverIfNecessary(String sessionName) {
    try {// www  .  j  av  a  2s  .  c  o m
        final Session session = _testSessions.get(sessionName);
        synchronized (session) {
            if (session.getTransacted()) {
                session.rollback();
            } else if (session.getAcknowledgeMode() == Session.CLIENT_ACKNOWLEDGE) {
                session.recover();
            }
        }
    } catch (final JMSException jmse) {
        throw new DistributedTestException("Unable to rollback or recover on session: " + sessionName, jmse);
    }
}