/** * Get a connection * * @param subject The security subject * @param cxRequestInfo The request info * @return The connection * @throws ResourceException Thrown if an error occurs */ @Override public synchronized Object getConnection(final Subject subject, final ConnectionRequestInfo cxRequestInfo) throws ResourceException { if (logger.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getConnection(" + subject + ", " + cxRequestInfo + ")"); } // Check user first ActiveMQRACredential credential = ActiveMQRACredential.getCredential(mcf, subject, cxRequestInfo); // Null users are allowed! if (userName != null && !userName.equals(credential.getUserName())) { throw new SecurityException("Password credentials not the same, reauthentication not allowed"); } if (userName == null && credential.getUserName() != null) { throw new SecurityException("Password credentials not the same, reauthentication not allowed"); } if (isDestroyed.get()) { throw new IllegalStateException("The managed connection is already destroyed"); } ActiveMQRASession session = new ActiveMQRASession(this, (ActiveMQRAConnectionRequestInfo) cxRequestInfo); handles.add(session); return session; }
/** * Get a connection * * @param subject The security subject * @param cxRequestInfo The request info * @return The connection * @throws ResourceException Thrown if an error occurs */ @Override public synchronized Object getConnection(final Subject subject, final ConnectionRequestInfo cxRequestInfo) throws ResourceException { if (logger.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getConnection(" + subject + ", " + cxRequestInfo + ")"); } // Check user first ActiveMQRACredential credential = ActiveMQRACredential.getCredential(mcf, subject, cxRequestInfo); // Null users are allowed! if (userName != null && !userName.equals(credential.getUserName())) { throw new SecurityException("Password credentials not the same, reauthentication not allowed"); } if (userName == null && credential.getUserName() != null) { throw new SecurityException("Password credentials not the same, reauthentication not allowed"); } if (isDestroyed.get()) { throw new IllegalStateException("The managed connection is already destroyed"); } ActiveMQRASession session = new ActiveMQRASession(this, (ActiveMQRAConnectionRequestInfo) cxRequestInfo); handles.add(session); return session; }