/** * Create a XA session * * @return The XA session * @throws JMSException Thrown if an error occurs */ @Override public XASession createXASession() throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createXASession()"); } checkClosed(); return allocateConnection(type); }
@Override public Session createSession() throws JMSException { return createSession(Session.AUTO_ACKNOWLEDGE); }
@Override public XAJMSContext createXAContext() { incrementRefCounter(); return new ActiveMQRAXAJMSContext(this, threadAwareContext); }
/** * Create a connection * * @param userName The user name * @param password The password * @return The connection * @throws JMSException Thrown if the operation fails */ @Override public Connection createConnection(final String userName, final String password) throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createConnection(" + userName + ", ****)"); } ActiveMQRASessionFactoryImpl s = new ActiveMQRASessionFactoryImpl(mcf, cm, getResourceAdapter().getTM(), ActiveMQRAConnectionFactory.CONNECTION); s.setUserName(userName); s.setPassword(password); validateUser(s); if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created connection: " + s); } return s; }
@Override public JMSContext createContext(String userName, String password, int sessionMode) { @SuppressWarnings("resource") ActiveMQRASessionFactoryImpl conn = new ActiveMQRASessionFactoryImpl(mcf, cm, getResourceAdapter().getTM(), ActiveMQRAConnectionFactory.CONNECTION); conn.setUserName(userName); conn.setPassword(password); try { validateUser(conn); } catch (JMSSecurityException e) { JMSSecurityRuntimeException e2 = new JMSSecurityRuntimeException(e.getMessage()); e2.initCause(e); throw e2; } catch (JMSException e) { JMSRuntimeException e2 = new JMSRuntimeException(e.getMessage()); e2.initCause(e); throw e2; } return conn.createContext(sessionMode); }
@Override public XAJMSContext createXAContext(String userName, String password) { ActiveMQRASessionFactoryImpl conn = new ActiveMQRASessionFactoryImpl(mcf, cm, getResourceAdapter().getTM(), ActiveMQRAConnectionFactory.XA_CONNECTION); conn.setUserName(userName); conn.setPassword(password); try { validateUser(conn); } catch (JMSSecurityException e) { JMSSecurityRuntimeException e2 = new JMSSecurityRuntimeException(e.getMessage()); e2.initCause(e); throw e2; } catch (JMSException e) { JMSRuntimeException e2 = new JMSRuntimeException(e.getMessage()); e2.initCause(e); throw e2; } return conn.createXAContext(); }
/** * Create a queue connection * * @return The connection * @throws JMSException Thrown if the operation fails */ @Override public QueueConnection createQueueConnection() throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createQueueConnection()"); } ActiveMQRASessionFactoryImpl s = new ActiveMQRASessionFactoryImpl(mcf, cm, getResourceAdapter().getTM(), ActiveMQRAConnectionFactory.QUEUE_CONNECTION); if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created queue connection: " + s); } return s; }
@Override public JMSContext createContext(int sessionMode) { boolean inJtaTx = inJtaTransaction(); int sessionModeToUse; switch (sessionMode) { case Session.AUTO_ACKNOWLEDGE: case Session.DUPS_OK_ACKNOWLEDGE: case ActiveMQJMSConstants.INDIVIDUAL_ACKNOWLEDGE: case ActiveMQJMSConstants.PRE_ACKNOWLEDGE: sessionModeToUse = sessionMode; break; //these are prohibited in JEE unless not in a JTA tx where they should be ignored and auto_ack used case Session.CLIENT_ACKNOWLEDGE: if (!inJtaTx) { throw ActiveMQRABundle.BUNDLE.invalidSessionTransactedModeRuntime(); } sessionModeToUse = Session.AUTO_ACKNOWLEDGE; break; case Session.SESSION_TRANSACTED: if (!inJtaTx) { throw ActiveMQRABundle.BUNDLE.invalidClientAcknowledgeModeRuntime(); } sessionModeToUse = Session.AUTO_ACKNOWLEDGE; break; default: throw ActiveMQRABundle.BUNDLE.invalidAcknowledgeMode(sessionMode); } incrementRefCounter(); return new ActiveMQRAJMSContext(this, sessionModeToUse, threadAwareContext); }
/** * Get the connection metadata * * @return The connection metadata * @throws JMSException Thrown if an error occurs */ @Override public ConnectionMetaData getMetaData() throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getMetaData()"); } checkClosed(); return mcf.getMetaData(); }
/** * Allocation a connection * * @param sessionType The session type * @return The session * @throws JMSException Thrown if an error occurs */ protected ActiveMQRASession allocateConnection(final int sessionType) throws JMSException { return allocateConnection(false, Session.AUTO_ACKNOWLEDGE, sessionType); }
if (!mcf.isIgnoreJTA() && inJtaTransaction()) { transacted = true;
/** * Create a queue connection * * @param userName The user name * @param password The password * @return The connection * @throws JMSException Thrown if the operation fails */ @Override public QueueConnection createQueueConnection(final String userName, final String password) throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createQueueConnection(" + userName + ", ****)"); } ActiveMQRASessionFactoryImpl s = new ActiveMQRASessionFactoryImpl(mcf, cm, getResourceAdapter().getTM(), ActiveMQRAConnectionFactory.QUEUE_CONNECTION); s.setUserName(userName); s.setPassword(password); validateUser(s); if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created queue connection: " + s); } return s; }
@Override public JMSContext createContext(String userName, String password, int sessionMode) { @SuppressWarnings("resource") ActiveMQRASessionFactoryImpl conn = new ActiveMQRASessionFactoryImpl(mcf, cm, getResourceAdapter().getTM(), ActiveMQRAConnectionFactory.CONNECTION); conn.setUserName(userName); conn.setPassword(password); try { validateUser(conn); } catch (JMSSecurityException e) { JMSSecurityRuntimeException e2 = new JMSSecurityRuntimeException(e.getMessage()); e2.initCause(e); throw e2; } catch (JMSException e) { JMSRuntimeException e2 = new JMSRuntimeException(e.getMessage()); e2.initCause(e); throw e2; } return conn.createContext(sessionMode); }
@Override public XAJMSContext createXAContext(String userName, String password) { ActiveMQRASessionFactoryImpl conn = new ActiveMQRASessionFactoryImpl(mcf, cm, getResourceAdapter().getTM(), ActiveMQRAConnectionFactory.XA_CONNECTION); conn.setUserName(userName); conn.setPassword(password); try { validateUser(conn); } catch (JMSSecurityException e) { JMSSecurityRuntimeException e2 = new JMSSecurityRuntimeException(e.getMessage()); e2.initCause(e); throw e2; } catch (JMSException e) { JMSRuntimeException e2 = new JMSRuntimeException(e.getMessage()); e2.initCause(e); throw e2; } return conn.createXAContext(); }
/** * Create a topic connection * * @return The connection * @throws JMSException Thrown if the operation fails */ @Override public TopicConnection createTopicConnection() throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createTopicConnection()"); } ActiveMQRASessionFactoryImpl s = new ActiveMQRASessionFactoryImpl(mcf, cm, getResourceAdapter().getTM(), ActiveMQRAConnectionFactory.TOPIC_CONNECTION); if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created topic connection: " + s); } return s; }
@Override public JMSContext createContext(int sessionMode) { boolean inJtaTx = inJtaTransaction(); int sessionModeToUse; switch (sessionMode) { case Session.AUTO_ACKNOWLEDGE: case Session.DUPS_OK_ACKNOWLEDGE: case ActiveMQJMSConstants.INDIVIDUAL_ACKNOWLEDGE: case ActiveMQJMSConstants.PRE_ACKNOWLEDGE: sessionModeToUse = sessionMode; break; //these are prohibited in JEE unless not in a JTA tx where they should be ignored and auto_ack used case Session.CLIENT_ACKNOWLEDGE: if (!inJtaTx) { throw ActiveMQRABundle.BUNDLE.invalidSessionTransactedModeRuntime(); } sessionModeToUse = Session.AUTO_ACKNOWLEDGE; break; case Session.SESSION_TRANSACTED: if (!inJtaTx) { throw ActiveMQRABundle.BUNDLE.invalidClientAcknowledgeModeRuntime(); } sessionModeToUse = Session.AUTO_ACKNOWLEDGE; break; default: throw ActiveMQRABundle.BUNDLE.invalidAcknowledgeMode(sessionMode); } incrementRefCounter(); return new ActiveMQRAJMSContext(this, sessionModeToUse, threadAwareContext); }
/** * Get the connection metadata * * @return The connection metadata * @throws JMSException Thrown if an error occurs */ @Override public ConnectionMetaData getMetaData() throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getMetaData()"); } checkClosed(); return mcf.getMetaData(); }
/** * Allocation a connection * * @param sessionType The session type * @return The session * @throws JMSException Thrown if an error occurs */ protected ActiveMQRASession allocateConnection(final int sessionType) throws JMSException { return allocateConnection(false, Session.AUTO_ACKNOWLEDGE, sessionType); }
if (!mcf.isIgnoreJTA() && inJtaTransaction()) { transacted = true;
/** * Create a XA queue connection * * @param userName The user name * @param password The password * @return The connection * @throws JMSException Thrown if the operation fails */ @Override public XAQueueConnection createXAQueueConnection(final String userName, final String password) throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("createXAQueueConnection(" + userName + ", ****)"); } ActiveMQRASessionFactoryImpl s = new ActiveMQRASessionFactoryImpl(mcf, cm, getResourceAdapter().getTM(), ActiveMQRAConnectionFactory.XA_QUEUE_CONNECTION); s.setUserName(userName); s.setPassword(password); validateUser(s); if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Created queue connection: " + s); } return s; }