Example usage for javax.jms XAConnection createXASession

List of usage examples for javax.jms XAConnection createXASession

Introduction

In this page you can find the example usage for javax.jms XAConnection createXASession.

Prototype


XASession createXASession() throws JMSException;

Source Link

Document

Creates an XASession object.

Usage

From source file:org.codehaus.stomp.jms.ProtocolConverter.java

protected StompSession getXASession(Xid xid) throws JMSException {
    StompSession xaSession = xaSessions.get(xid);
    if (xaSession == null) {

        XAConnection xaConnection;
        if (login != null) {
            xaConnection = xaConnectionFactory.createXAConnection(login, passcode);
        } else {/*from   ww  w. j  a v  a  2 s . c  o  m*/
            xaConnection = xaConnectionFactory.createXAConnection();
        }
        if (clientId != null) {
            xaConnection.setClientID(clientId);
        }
        xaConnection.start();
        Session session = xaConnection.createXASession();
        if (log.isDebugEnabled()) {
            log.debug("Created XA session");
        }
        xaSession = new StompSession(initialContext, this, session, xaConnection);
        log.trace("Created XA Session");
        xaSessions.put(xid, xaSession);
    } else {
        log.trace("Returned existing XA session");
    }
    return xaSession;
}