package org.jboss.mq;
import java.io.Serializable;
import javax.jms.IllegalStateException;
import javax.jms.JMSException;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TopicSession;
import javax.jms.XAConnection;
import javax.jms.XAQueueConnection;
import javax.jms.XAQueueSession;
import javax.jms.XASession;
import javax.jms.XATopicConnection;
import javax.jms.XATopicSession;
public class SpyXAConnection extends SpyConnection implements Serializable, XAConnection, XATopicConnection, XAQueueConnection
{
static final long serialVersionUID = 1258716704996031025L;
public SpyXAConnection(String userid, String password, GenericConnectionFactory gcf) throws JMSException
{
super(userid, password, gcf);
}
public SpyXAConnection(GenericConnectionFactory gcf) throws JMSException
{
super(gcf);
}
public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException
{
return (QueueSession) createXASession();
}
public QueueSession createQueueSession(boolean transacted, int acknowledgeMode) throws JMSException
{
return (QueueSession) createXAQueueSession();
}
public TopicSession createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException
{
return (TopicSession) createXATopicSession();
}
public XASession createXASession() throws JMSException
{
if (closed)
throw new IllegalStateException("The connection is closed");
checkClientID();
XASession session = new SpySession(this, true, 0, true);
synchronized (createdSessions)
{
createdSessions.add(session);
}
return session;
}
public XAQueueSession createXAQueueSession() throws JMSException
{
if (closed)
throw new IllegalStateException("The connection is closed");
checkClientID();
XAQueueSession session = new SpyQueueSession(this, true, 0, true);
synchronized (createdSessions)
{
createdSessions.add(session);
}
return session;
}
public XATopicSession createXATopicSession() throws javax.jms.JMSException
{
if (closed)
throw new IllegalStateException("The connection is closed");
checkClientID();
XATopicSession session = new SpyTopicSession(this, true, 0, true);
synchronized (createdSessions)
{
createdSessions.add(session);
}
return session;
}
}