javax.jms.XAQueueSession Java Examples

The following examples show how to use javax.jms.XAQueueSession. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ManagedSession.java    From ats-framework with Apache License 2.0 6 votes vote down vote up
public static ManagedSession create( Session session ) {

        if ( (session instanceof XAQueueSession) && (session instanceof XATopicSession))
            return new ManagedXAQueueTopicSession(session);
        if (session instanceof XAQueueSession)
            return new ManagedXAQueueSession((XAQueueSession) session);
        if (session instanceof XATopicSession)
            return new ManagedXATopicSession((XATopicSession) session);
        if ( (session instanceof QueueSession) && (session instanceof TopicSession))
            return new ManagedQueueTopicSession(session);
        if (session instanceof QueueSession)
            return new ManagedQueueSession((QueueSession) session);
        if (session instanceof TopicSession)
            return new ManagedTopicSession((TopicSession) session);

        return new ManagedSession(session);
    }
 
Example #2
Source File: ActiveMQRASessionFactoryImpl.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
/**
 * Create a XA queue session
 *
 * @return The XA queue session
 * @throws JMSException Thrown if an error occurs
 */
@Override
public XAQueueSession createXAQueueSession() throws JMSException {
   if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
      ActiveMQRALogger.LOGGER.trace("createXAQueueSession()");
   }

   checkClosed();

   if (type == ActiveMQRAConnectionFactory.CONNECTION || type == ActiveMQRAConnectionFactory.TOPIC_CONNECTION ||
      type == ActiveMQRAConnectionFactory.XA_TOPIC_CONNECTION) {
      throw new IllegalStateException("Can not get a topic session from a queue connection");
   }

   return allocateConnection(type);
}
 
Example #3
Source File: TracingXAConnection.java    From brave with Apache License 2.0 5 votes vote down vote up
@Override public XAQueueSession createXAQueueSession() throws JMSException {
  if ((types & TYPE_XA_QUEUE) != TYPE_XA_QUEUE) {
    throw new IllegalStateException(delegate + " is not an XAQueueConnection");
  }
  XAQueueSession xats = ((XAQueueConnection) delegate).createXAQueueSession();
  return TracingXASession.create(xats, jmsTracing);
}
 
Example #4
Source File: TracingXASession.java    From brave with Apache License 2.0 5 votes vote down vote up
@Override public QueueSession getQueueSession() throws JMSException {
  if ((types & TYPE_XA_QUEUE) != TYPE_XA_QUEUE) {
    throw new IllegalStateException(delegate + " is not an XAQueueSession");
  }
  QueueSession xats = ((XAQueueSession) delegate).getQueueSession();
  return TracingSession.create(xats, jmsTracing);
}
 
Example #5
Source File: TracingSession.java    From brave with Apache License 2.0 5 votes vote down vote up
TracingSession(Session delegate, JmsTracing jmsTracing) {
  this.delegate = delegate;
  this.jmsTracing = jmsTracing;
  int types = 0;
  if (delegate instanceof QueueSession) types |= TYPE_QUEUE;
  if (delegate instanceof TopicSession) types |= TYPE_TOPIC;
  if (delegate instanceof XASession) types |= TYPE_XA;
  if (delegate instanceof XAQueueSession) types |= TYPE_XA_QUEUE;
  if (delegate instanceof XATopicSession) types |= TYPE_XA_TOPIC;
  this.types = types;
}
 
Example #6
Source File: ManagedXAQueueConnection.java    From ats-framework with Apache License 2.0 4 votes vote down vote up
@Override
public XAQueueSession createXAQueueSession() throws JMSException {

    return addSession(xaConnection.createXAQueueSession());
}
 
Example #7
Source File: ManagedXAQueueTopicConnection.java    From ats-framework with Apache License 2.0 4 votes vote down vote up
@Override
public XAQueueSession createXAQueueSession() throws JMSException {

    return addSession( ((XAQueueConnection) connection).createXAQueueSession());
}
 
Example #8
Source File: ManagedXAQueueSession.java    From ats-framework with Apache License 2.0 4 votes vote down vote up
public ManagedXAQueueSession( final XAQueueSession session ) {

        super(session);
        xaQueueSession = session;
    }
 
Example #9
Source File: ManagedXAQueueTopicSession.java    From ats-framework with Apache License 2.0 4 votes vote down vote up
@Override
public QueueSession getQueueSession() throws JMSException {

    return addSession( ((XAQueueSession) session).getQueueSession());
}
 
Example #10
Source File: ActiveMQXAConnection.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
public synchronized XAQueueSession createXAQueueSession() throws JMSException {
   checkClosed();
   return (XAQueueSession) createSessionInternal(isXA(), true, Session.SESSION_TRANSACTED, ActiveMQSession.TYPE_QUEUE_SESSION);

}