mirror of https://github.com/apache/activemq.git
Connection state tracking would cause a CCE if temp destinations were in use.
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@405206 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
89d6fd0a80
commit
9614aa9b4e
|
@ -25,7 +25,6 @@ import java.util.List;
|
|||
|
||||
import org.apache.activemq.Service;
|
||||
import org.apache.activemq.broker.region.ConnectionStatistics;
|
||||
import org.apache.activemq.command.ActiveMQDestination;
|
||||
import org.apache.activemq.command.BrokerInfo;
|
||||
import org.apache.activemq.command.Command;
|
||||
import org.apache.activemq.command.ConnectionControl;
|
||||
|
@ -372,7 +371,7 @@ public abstract class AbstractConnection implements Service, Connection, Task, C
|
|||
ConnectionState cs = lookupConnectionState(info.getConnectionId());
|
||||
broker.addDestinationInfo(cs.getContext(), info);
|
||||
if( info.getDestination().isTemporary() ) {
|
||||
cs.addTempDestination(info.getDestination());
|
||||
cs.addTempDestination(info);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -532,11 +531,11 @@ public abstract class AbstractConnection implements Service, Connection, Task, C
|
|||
|
||||
// Cascade the connection stop to temp destinations.
|
||||
for (Iterator iter = cs.getTempDesinations().iterator(); iter.hasNext();) {
|
||||
ActiveMQDestination dest = (ActiveMQDestination) iter.next();
|
||||
DestinationInfo di = (DestinationInfo) iter.next();
|
||||
try{
|
||||
broker.removeDestination(cs.getContext(), dest, 0);
|
||||
broker.removeDestination(cs.getContext(), di.getDestination(), 0);
|
||||
}catch(Throwable e){
|
||||
serviceLog.warn("Failed to remove tmp destination " + dest,e);
|
||||
serviceLog.warn("Failed to remove tmp destination " + di.getDestination(), e);
|
||||
}
|
||||
iter.remove();
|
||||
}
|
||||
|
|
|
@ -20,11 +20,13 @@ package org.apache.activemq.state;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.activemq.command.ActiveMQDestination;
|
||||
import org.apache.activemq.command.ConnectionInfo;
|
||||
import org.apache.activemq.command.DestinationInfo;
|
||||
import org.apache.activemq.command.SessionId;
|
||||
import org.apache.activemq.command.SessionInfo;
|
||||
|
||||
|
@ -46,12 +48,17 @@ public class ConnectionState {
|
|||
return info.toString();
|
||||
}
|
||||
|
||||
public void addTempDestination(ActiveMQDestination destination) {
|
||||
tempDestinations.add(destination);
|
||||
public void addTempDestination(DestinationInfo info) {
|
||||
tempDestinations.add(info);
|
||||
}
|
||||
|
||||
public void removeTempDestination(ActiveMQDestination destination) {
|
||||
tempDestinations.remove(destination);
|
||||
for (Iterator iter = tempDestinations.iterator(); iter.hasNext();) {
|
||||
DestinationInfo di = (DestinationInfo) iter.next();
|
||||
if( di.getDestination().equals(destination) ) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addSession(SessionInfo info) {
|
||||
|
|
|
@ -147,7 +147,7 @@ public class ConnectionStateTracker implements CommandVisitor {
|
|||
public Response processAddDestination(DestinationInfo info) throws Exception {
|
||||
ConnectionState cs = (ConnectionState) connectionStates.get(info.getConnectionId());
|
||||
if( info.getDestination().isTemporary() ) {
|
||||
cs.addTempDestination(info.getDestination());
|
||||
cs.addTempDestination(info);
|
||||
}
|
||||
return TRACKED_RESPONSE_MARKER;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue