Example usage for javax.jms XAConnection setClientID

List of usage examples for javax.jms XAConnection setClientID

Introduction

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

Prototype

void setClientID(String clientID) throws JMSException;

Source Link

Document

Sets the client identifier for this connection.

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 {// w  ww  .  j  a  v  a 2  s  .  co 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;
}