/** * Get a connection request info instance * * @param info The instance that should be updated; may be <code>null</code> * @return The instance */ private ActiveMQRAConnectionRequestInfo getCRI(final ActiveMQRAConnectionRequestInfo info) { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getCRI(" + info + ")"); } if (info == null) { // Create a default one return new ActiveMQRAConnectionRequestInfo(ra.getProperties(), mcfProperties.getType()); } else { // Fill the one with any defaults info.setDefaults(ra.getProperties()); return info; } }
/** * Indicates whether some other object is "equal to" this one. * * @param obj Object with which to compare * @return True if this object is the same as the obj argument; false otherwise. */ @Override public boolean equals(final Object obj) { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("equals(" + obj + ")"); } if (obj == null) { return false; } if (obj instanceof ActiveMQRAConnectionRequestInfo) { ActiveMQRAConnectionRequestInfo you = (ActiveMQRAConnectionRequestInfo) obj; return ActiveMQRaUtils.compare(userName, you.getUserName()) && ActiveMQRaUtils.compare(password, you.getPassword()) && ActiveMQRaUtils.compare(clientID, you.getClientID()) && type == you.getType() && transacted == you.isTransacted() && acknowledgeMode == you.getAcknowledgeMode(); } else { return false; } }
/** * Commit * * @throws JMSException Failed to close session. */ @Override public void commit() throws JMSException { if (cri.getType() == ActiveMQRAConnectionFactory.XA_CONNECTION || cri.getType() == ActiveMQRAConnectionFactory.XA_QUEUE_CONNECTION || cri.getType() == ActiveMQRAConnectionFactory.XA_TOPIC_CONNECTION) { throw new TransactionInProgressException("XA connection"); } lock(); try { Session session = getSessionInternal(); if (cri.isTransacted() == false) { throw new IllegalStateException("Session is not transacted"); } if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Commit session " + this); } session.commit(); } finally { unlock(); } }
ActiveMQRAConnectionRequestInfo info = new ActiveMQRAConnectionRequestInfo(transacted, acknowledgeMode, sessionType); info.setUserName(userName); info.setPassword(password); info.setClientID(clientID); info.setDefaults(((ActiveMQResourceAdapter) mcf.getResourceAdapter()).getProperties());
/** * Get the queue session * * @return The queue session * @throws JMSException Thrown if an error occurs */ @Override public QueueSession getQueueSession() throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getQueueSession()"); } if (cri.getType() == ActiveMQRAConnectionFactory.CONNECTION || cri.getType() == ActiveMQRAConnectionFactory.QUEUE_CONNECTION || cri.getType() == ActiveMQRAConnectionFactory.TOPIC_CONNECTION) { throw new IllegalStateException("Non XA connection"); } lock(); try { return this; } finally { unlock(); } }
jc.setUserName(((ActiveMQRAConnectionRequestInfo) info).getUserName()); jc.setPassword(((ActiveMQRAConnectionRequestInfo) info).getPassword()); } else if (subject != null) { PasswordCredential pwdc = GetCredentialAction.getCredential(subject, mcf);
/** * Get transacted * * @return True if transacted; otherwise false * @throws JMSException Thrown if an error occurs */ @Override public boolean getTransacted() throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getTransacted()"); } getSessionInternal(); return cri.isTransacted(); }
/** * Get the acknowledge mode * * @return The mode * @throws JMSException Thrown if an error occurs */ @Override public int getAcknowledgeMode() throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getAcknowledgeMode()"); } getSessionInternal(); return cri.getAcknowledgeMode(); }
if (cri.equals(mc.getCRI())) { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Found matching connection: " + mc);
ActiveMQRAConnectionRequestInfo info = new ActiveMQRAConnectionRequestInfo(transacted, acknowledgeMode, sessionType); info.setUserName(userName); info.setPassword(password); info.setClientID(clientID); info.setDefaults(((ActiveMQResourceAdapter) mcf.getResourceAdapter()).getProperties());
/** * Get the XA resource */ @Override public XAResource getXAResource() { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getXAResource()"); } if (cri.getType() == ActiveMQRAConnectionFactory.CONNECTION || cri.getType() == ActiveMQRAConnectionFactory.QUEUE_CONNECTION || cri.getType() == ActiveMQRAConnectionFactory.TOPIC_CONNECTION) { return null; } try { lock(); return getXAResourceInternal(); } catch (Throwable t) { return null; } finally { unlock(); } }
/** * Rollback * * @throws JMSException Failed to close session. */ @Override public void rollback() throws JMSException { if (cri.getType() == ActiveMQRAConnectionFactory.XA_CONNECTION || cri.getType() == ActiveMQRAConnectionFactory.XA_QUEUE_CONNECTION || cri.getType() == ActiveMQRAConnectionFactory.XA_TOPIC_CONNECTION) { throw new TransactionInProgressException("XA connection"); } lock(); try { Session session = getSessionInternal(); if (cri.isTransacted() == false) { throw new IllegalStateException("Session is not transacted"); } if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Rollback session " + this); } session.rollback(); } finally { unlock(); } }
jc.setUserName(((ActiveMQRAConnectionRequestInfo) info).getUserName()); jc.setPassword(((ActiveMQRAConnectionRequestInfo) info).getPassword()); } else if (subject != null) { PasswordCredential pwdc = GetCredentialAction.getCredential(subject, mcf);
/** * Get transacted * * @return True if transacted; otherwise false * @throws JMSException Thrown if an error occurs */ @Override public boolean getTransacted() throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getTransacted()"); } getSessionInternal(); return cri.isTransacted(); }
/** * Get the acknowledge mode * * @return The mode * @throws JMSException Thrown if an error occurs */ @Override public int getAcknowledgeMode() throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getAcknowledgeMode()"); } getSessionInternal(); return cri.getAcknowledgeMode(); }
if (cri.equals(mc.getCRI())) { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Found matching connection: " + mc);
/** * Indicates whether some other object is "equal to" this one. * * @param obj Object with which to compare * @return True if this object is the same as the obj argument; false otherwise. */ @Override public boolean equals(final Object obj) { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("equals(" + obj + ")"); } if (obj == null) { return false; } if (obj instanceof ActiveMQRAConnectionRequestInfo) { ActiveMQRAConnectionRequestInfo you = (ActiveMQRAConnectionRequestInfo) obj; return ActiveMQRaUtils.compare(userName, you.getUserName()) && ActiveMQRaUtils.compare(password, you.getPassword()) && ActiveMQRaUtils.compare(clientID, you.getClientID()) && type == you.getType() && transacted == you.isTransacted() && acknowledgeMode == you.getAcknowledgeMode(); } else { return false; } }
/** * Get the XA resource */ @Override public XAResource getXAResource() { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getXAResource()"); } if (cri.getType() == ActiveMQRAConnectionFactory.CONNECTION || cri.getType() == ActiveMQRAConnectionFactory.QUEUE_CONNECTION || cri.getType() == ActiveMQRAConnectionFactory.TOPIC_CONNECTION) { return null; } try { lock(); return getXAResourceInternal(); } catch (Throwable t) { return null; } finally { unlock(); } }
/** * Commit * * @throws JMSException Failed to close session. */ @Override public void commit() throws JMSException { if (cri.getType() == ActiveMQRAConnectionFactory.XA_CONNECTION || cri.getType() == ActiveMQRAConnectionFactory.XA_QUEUE_CONNECTION || cri.getType() == ActiveMQRAConnectionFactory.XA_TOPIC_CONNECTION) { throw new TransactionInProgressException("XA connection"); } lock(); try { Session session = getSessionInternal(); if (cri.isTransacted() == false) { throw new IllegalStateException("Session is not transacted"); } if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("Commit session " + this); } session.commit(); } finally { unlock(); } }
/** * Get a connection request info instance * * @param info The instance that should be updated; may be <code>null</code> * @return The instance */ private ActiveMQRAConnectionRequestInfo getCRI(final ActiveMQRAConnectionRequestInfo info) { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getCRI(" + info + ")"); } if (info == null) { // Create a default one return new ActiveMQRAConnectionRequestInfo(ra.getProperties(), mcfProperties.getType()); } else { // Fill the one with any defaults info.setDefaults(ra.getProperties()); return info; } }