/** * Removes any TempDestinations that this connection has cached, ignoring * any exceptions generated because the destination is in use as they should * not be removed. * Used from a pooled connection, b/c it will not be explicitly closed. */ public void cleanUpTempDestinations() { if (this.activeTempDestinations == null || this.activeTempDestinations.isEmpty()) { return; } Iterator<ConcurrentMap.Entry<ActiveMQTempDestination, ActiveMQTempDestination>> entries = this.activeTempDestinations.entrySet().iterator(); while(entries.hasNext()) { ConcurrentMap.Entry<ActiveMQTempDestination, ActiveMQTempDestination> entry = entries.next(); try { // Only delete this temp destination if it was created from this connection. The connection used // for the advisory consumer may also have a reference to this temp destination. ActiveMQTempDestination dest = entry.getValue(); String thisConnectionId = (info.getConnectionId() == null) ? "" : info.getConnectionId().toString(); if (dest.getConnectionId() != null && dest.getConnectionId().equals(thisConnectionId)) { this.deleteTempDestination(entry.getValue()); } } catch (Exception ex) { // the temp dest is in use so it can not be deleted. // it is ok to leave it to connection tear down phase } } }
@Override public void addSubscription(ConnectionContext context, Subscription sub) throws Exception { // Only consumers on the same connection can consume from // the temporary destination // However, we could have failed over - and we do this // check client side anyways .... if (!context.isFaultTolerant() && (!context.isNetworkConnection() && !tempDest .getConnectionId().equals( sub.getConsumerInfo().getConsumerId() .getConnectionId()))) { tempDest.setConnectionId(sub.getConsumerInfo().getConsumerId().getConnectionId()); LOG.debug("changed ownership of {} to {}", this, tempDest.getConnectionId()); } super.addSubscription(context, sub); }
public void addSubscription(ConnectionContext context, Subscription sub) throws Exception { // Only consumers on the same connection can consume from // the temporary destination // However, we could have failed over - and we do this // check client side anyways .... if (!context.isFaultTolerant() && (!context.isNetworkConnection() && !tempDest .getConnectionId().equals( sub.getConsumerInfo().getConsumerId() .getConnectionId()))) { tempDest.setConnectionId(sub.getConsumerInfo().getConsumerId().getConnectionId()); if (LOG.isDebugEnabled()) { LOG.debug(" changed ownership of " + this + " to "+ tempDest.getConnectionId()); } } super.addSubscription(context, sub); }
/** * Removes any TempDestinations that this connection has cached, ignoring * any exceptions generated because the destination is in use as they should * not be removed. * Used from a pooled connection, b/c it will not be explicitly closed. */ public void cleanUpTempDestinations() { if (this.activeTempDestinations == null || this.activeTempDestinations.isEmpty()) { return; } Iterator<ConcurrentMap.Entry<ActiveMQTempDestination, ActiveMQTempDestination>> entries = this.activeTempDestinations.entrySet().iterator(); while(entries.hasNext()) { ConcurrentMap.Entry<ActiveMQTempDestination, ActiveMQTempDestination> entry = entries.next(); try { // Only delete this temp destination if it was created from this connection. The connection used // for the advisory consumer may also have a reference to this temp destination. ActiveMQTempDestination dest = entry.getValue(); String thisConnectionId = (info.getConnectionId() == null) ? "" : info.getConnectionId().toString(); if (dest.getConnectionId() != null && dest.getConnectionId().equals(thisConnectionId)) { this.deleteTempDestination(entry.getValue()); } } catch (Exception ex) { // the temp dest is in use so it can not be deleted. // it is ok to leave it to connection tear down phase } } }
/** * Removes any TempDestinations that this connection has cached, ignoring * any exceptions generated because the destination is in use as they should * not be removed. * Used from a pooled connection, b/c it will not be explicitly closed. */ public void cleanUpTempDestinations() { if (this.activeTempDestinations == null || this.activeTempDestinations.isEmpty()) { return; } Iterator<ConcurrentMap.Entry<ActiveMQTempDestination, ActiveMQTempDestination>> entries = this.activeTempDestinations.entrySet().iterator(); while(entries.hasNext()) { ConcurrentMap.Entry<ActiveMQTempDestination, ActiveMQTempDestination> entry = entries.next(); try { // Only delete this temp destination if it was created from this connection. The connection used // for the advisory consumer may also have a reference to this temp destination. ActiveMQTempDestination dest = entry.getValue(); String thisConnectionId = (info.getConnectionId() == null) ? "" : info.getConnectionId().toString(); if (dest.getConnectionId() != null && dest.getConnectionId().equals(thisConnectionId)) { this.deleteTempDestination(entry.getValue()); } } catch (Exception ex) { // the temp dest is in use so it can not be deleted. // it is ok to leave it to connection tear down phase } } }
/** * Removes any TempDestinations that this connection has cached, ignoring * any exceptions generated because the destination is in use as they should * not be removed. * Used from a pooled connection, b/c it will not be explicitly closed. */ public void cleanUpTempDestinations() { if (this.activeTempDestinations == null || this.activeTempDestinations.isEmpty()) { return; } Iterator<ConcurrentMap.Entry<ActiveMQTempDestination, ActiveMQTempDestination>> entries = this.activeTempDestinations.entrySet().iterator(); while(entries.hasNext()) { ConcurrentMap.Entry<ActiveMQTempDestination, ActiveMQTempDestination> entry = entries.next(); try { // Only delete this temp destination if it was created from this connection. The connection used // for the advisory consumer may also have a reference to this temp destination. ActiveMQTempDestination dest = entry.getValue(); String thisConnectionId = (info.getConnectionId() == null) ? "" : info.getConnectionId().toString(); if (dest.getConnectionId() != null && dest.getConnectionId().equals(thisConnectionId)) { this.deleteTempDestination(entry.getValue()); } } catch (Exception ex) { // the temp dest is in use so it can not be deleted. // it is ok to leave it to connection tear down phase } } }
public Destination addDestination(ConnectionContext context, ActiveMQDestination destination) throws Exception { final SecurityContext securityContext = context.getSecurityContext(); if (securityContext == null) throw new SecurityException("User is not authenticated."); // You don't need to be an admin to create temp destinations. if (!destination.isTemporary() || !((ActiveMQTempDestination) destination).getConnectionId().equals(context.getConnectionId().getValue())) { if (destination.getPhysicalName().equals(Constants.NOTIFICATION_UPDATES_QUEUE) || destination.getPhysicalName().equals(Constants.NOTIFICATION_CONTROL_QUEUE)) { if (!securityContext.getPrincipals().contains(Constants.defaultSystemRole)) { throw new SecurityException("User " + securityContext.getUserName() + " is not authorized to create: " + destination); } } } return super.addDestination(context, destination); }
public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception { final SecurityContext securityContext = context.getSecurityContext(); if (securityContext == null) throw new SecurityException("User is not authenticated."); // You don't need to be an admin to remove temp destinations. if (!destination.isTemporary() || !((ActiveMQTempDestination) destination).getConnectionId().equals(context.getConnectionId().getValue())) { if (destination.getPhysicalName().equals(Constants.NOTIFICATION_UPDATES_QUEUE) || destination.getPhysicalName().equals(Constants.NOTIFICATION_CONTROL_QUEUE)) { if (!securityContext.getPrincipals().contains(Constants.defaultSystemRole)) { throw new SecurityException("User " + securityContext.getUserName() + " is not authorized to remove: " + destination); } } } super.removeDestination(context, destination, timeout); }
public void addSubscription(ConnectionContext context, Subscription sub) throws Exception { // Only consumers on the same connection can consume from // the temporary destination // However, we could have failed over - and we do this // check client side anyways .... if (!context.isFaultTolerant() && (!context.isNetworkConnection() && !tempDest .getConnectionId().equals( sub.getConsumerInfo().getConsumerId() .getConnectionId()))) { tempDest.setConnectionId(sub.getConsumerInfo().getConsumerId().getConnectionId()); if (LOG.isDebugEnabled()) { LOG.debug(" changed ownership of " + this + " to "+ tempDest.getConnectionId()); } } super.addSubscription(context, sub); }
public void addSubscription(ConnectionContext context, Subscription sub) throws Exception { // Only consumers on the same connection can consume from // the temporary destination // However, we could have failed over - and we do this // check client side anyways .... if (!context.isFaultTolerant() && (!context.isNetworkConnection() && !tempDest .getConnectionId().equals( sub.getConsumerInfo().getConsumerId() .getConnectionId()))) { tempDest.setConnectionId(sub.getConsumerInfo().getConsumerId().getConnectionId()); LOG.debug(" changed ownership of " + this + " to "+ tempDest.getConnectionId()); } super.addSubscription(context, sub); }
public void addSubscription(ConnectionContext context, Subscription sub) throws Exception { // Only consumers on the same connection can consume from // the temporary destination // However, we could have failed over - and we do this // check client side anyways .... if (!context.isFaultTolerant() && (!context.isNetworkConnection() && !tempDest .getConnectionId().equals( sub.getConsumerInfo().getConsumerId() .getConnectionId()))) { tempDest.setConnectionId(sub.getConsumerInfo().getConsumerId().getConnectionId()); if (LOG.isDebugEnabled()) { LOG.debug(" changed ownership of " + this + " to "+ tempDest.getConnectionId()); } } super.addSubscription(context, sub); }
@Override public void addSubscription(ConnectionContext context, Subscription sub) throws Exception { // Only consumers on the same connection can consume from // the temporary destination // However, we could have failed over - and we do this // check client side anyways .... if (!context.isFaultTolerant() && (!context.isNetworkConnection() && !tempDest .getConnectionId().equals( sub.getConsumerInfo().getConsumerId() .getConnectionId()))) { tempDest.setConnectionId(sub.getConsumerInfo().getConsumerId().getConnectionId()); LOG.debug("changed ownership of {} to {}", this, tempDest.getConnectionId()); } super.addSubscription(context, sub); }
public void addSubscription(ConnectionContext context, Subscription sub) throws Exception { // Only consumers on the same connection can consume from // the temporary destination // However, we could have failed over - and we do this // check client side anyways .... if (!context.isFaultTolerant() && (!context.isNetworkConnection() && !tempDest .getConnectionId().equals( sub.getConsumerInfo().getConsumerId() .getConnectionId()))) { tempDest.setConnectionId(sub.getConsumerInfo().getConsumerId().getConnectionId()); if (LOG.isDebugEnabled()) { LOG.debug(" changed ownership of " + this + " to "+ tempDest.getConnectionId()); } } super.addSubscription(context, sub); }
@Override public void addSubscription(ConnectionContext context, Subscription sub) throws Exception { // Only consumers on the same connection can consume from // the temporary destination // However, we could have failed over - and we do this // check client side anyways .... if (!context.isFaultTolerant() && (!context.isNetworkConnection() && !tempDest .getConnectionId().equals( sub.getConsumerInfo().getConsumerId() .getConnectionId()))) { tempDest.setConnectionId(sub.getConsumerInfo().getConsumerId().getConnectionId()); LOG.debug("changed ownership of {} to {}", this, tempDest.getConnectionId()); } super.addSubscription(context, sub); }
@Override public void addSubscription(ConnectionContext context, Subscription sub) throws Exception { // Only consumers on the same connection can consume from // the temporary destination // However, we could have failed over - and we do this // check client side anyways .... if (!context.isFaultTolerant() && (!context.isNetworkConnection() && !tempDest .getConnectionId().equals( sub.getConsumerInfo().getConsumerId() .getConnectionId()))) { tempDest.setConnectionId(sub.getConsumerInfo().getConsumerId().getConnectionId()); LOG.debug("changed ownership of {} to {}", this, tempDest.getConnectionId()); } super.addSubscription(context, sub); }
@Override public void addSubscription(ConnectionContext context, Subscription sub) throws Exception { // Only consumers on the same connection can consume from // the temporary destination // However, we could have failed over - and we do this // check client side anyways .... if (!context.isFaultTolerant() && (!context.isNetworkConnection() && !tempDest .getConnectionId().equals( sub.getConsumerInfo().getConsumerId() .getConnectionId()))) { tempDest.setConnectionId(sub.getConsumerInfo().getConsumerId().getConnectionId()); LOG.debug(" changed ownership of " + this + " to "+ tempDest.getConnectionId()); } super.addSubscription(context, sub); }
public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception { final SecurityContext subject = context.getSecurityContext(); if (subject == null) throw new SecurityException("User is not authenticated."); if (info.getDestination().getPhysicalName().equals(Constants.NOTIFICATION_UPDATES_QUEUE)) { if (!subject.getPrincipals().contains(Constants.defaultSystemRole)) { throw new SecurityException("User " + subject.getUserName() + " is not authorized to read from: " + info.getDestination()); } } else if (info.getDestination().getPhysicalName().equals(Constants.NOTIFICATION_CONTROL_QUEUE)) { if (!subject.getPrincipals().contains(Constants.defaultSystemRole)) { throw new SecurityException("User " + subject.getUserName() + " is not authorized to read from: " + info.getDestination()); } } if (info.getDestination().isTemporary() && !((ActiveMQTempDestination) info.getDestination()).getConnectionId().equals(context.getConnectionId().getValue())) { throw new SecurityException("User " + subject.getUserName() + " is not authorized to read from: " + info.getDestination()); } subject.getAuthorizedReadDests().put(info.getDestination(), info.getDestination()); return super.addConsumer(context, info); }
destination = createDestination(source); if (destination.isTemporary()) { String connectionId = ((ActiveMQTempDestination) destination).getConnectionId(); if (connectionId == null) { throw new AmqpProtocolException(AmqpError.INVALID_FIELD.toString(), "Not a broker created temp destination");
destination = createDestination(remoteTarget); if (destination.isTemporary()) { String connectionId = ((ActiveMQTempDestination) destination).getConnectionId(); if (connectionId == null) { throw new AmqpProtocolException(AmqpError.PRECONDITION_FAILED.toString(), "Not a broker created temp destination");
destination = createDestination(remoteTarget); if (destination.isTemporary()) { String connectionId = ((ActiveMQTempDestination) destination).getConnectionId(); if (connectionId == null) { throw new AmqpProtocolException(AmqpError.PRECONDITION_FAILED.toString(), "Not a broker created temp destination");