You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2016/01/26 03:13:11 UTC
[2/2] activemq-artemis git commit: ARTEMIS-358 topic mistakenly
removed with sub
ARTEMIS-358 topic mistakenly removed with sub
The problem here is that the management notification listener was mistakenly
removing the topic itself instead of just the non-durable subscription. In
general I can't see why StompProtocolManager even needs to keep track of the
destinations when the broker already does that. As far as I can tell it is
redundant and it's clearly error-prone. Therefore I'm removing the destination
tracking from StompProtocolManager altogether.
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/ddc95a0f
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/ddc95a0f
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/ddc95a0f
Branch: refs/heads/master
Commit: ddc95a0f28e5a55bb8abd04661ec09b0ac5432fc
Parents: 0f9c379
Author: jbertram <jb...@apache.org>
Authored: Mon Jan 25 16:36:02 2016 -0600
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Jan 25 21:04:00 2016 -0500
----------------------------------------------------------------------
.../protocol/stomp/StompProtocolManager.java | 60 +-------------------
1 file changed, 2 insertions(+), 58 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ddc95a0f/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java
index 951bb89..0cad259 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java
@@ -22,7 +22,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.Set;
import java.util.concurrent.Executor;
import io.netty.channel.ChannelPipeline;
@@ -31,20 +30,13 @@ import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
import org.apache.activemq.artemis.api.core.BaseInterceptor;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
-import org.apache.activemq.artemis.api.core.management.CoreNotificationType;
-import org.apache.activemq.artemis.api.core.management.ManagementHelper;
import org.apache.activemq.artemis.core.io.IOCallback;
-import org.apache.activemq.artemis.core.postoffice.BindingType;
import org.apache.activemq.artemis.core.remoting.impl.netty.NettyServerConnection;
import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
-import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.server.ServerSession;
import org.apache.activemq.artemis.core.server.impl.ServerMessageImpl;
-import org.apache.activemq.artemis.core.server.management.ManagementService;
-import org.apache.activemq.artemis.core.server.management.Notification;
-import org.apache.activemq.artemis.core.server.management.NotificationListener;
import org.apache.activemq.artemis.spi.core.protocol.ConnectionEntry;
import org.apache.activemq.artemis.spi.core.protocol.MessageConverter;
import org.apache.activemq.artemis.spi.core.protocol.ProtocolManager;
@@ -53,8 +45,6 @@ import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.spi.core.remoting.Acceptor;
import org.apache.activemq.artemis.spi.core.remoting.Connection;
import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
-import org.apache.activemq.artemis.utils.ConcurrentHashSet;
-import org.apache.activemq.artemis.utils.TypedProperties;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import static org.apache.activemq.artemis.core.protocol.stomp.ActiveMQStompProtocolMessageBundle.BUNDLE;
@@ -62,7 +52,7 @@ import static org.apache.activemq.artemis.core.protocol.stomp.ActiveMQStompProto
/**
* StompProtocolManager
*/
-class StompProtocolManager implements ProtocolManager<StompFrameInterceptor>, NotificationListener {
+class StompProtocolManager implements ProtocolManager<StompFrameInterceptor> {
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
@@ -78,8 +68,6 @@ class StompProtocolManager implements ProtocolManager<StompFrameInterceptor>, No
// key => connection ID, value => Stomp session
private final Map<Object, StompSession> sessions = new HashMap<>();
- private final Set<String> destinations = new ConcurrentHashSet<>();
-
private final List<StompFrameInterceptor> incomingInterceptors;
private final List<StompFrameInterceptor> outgoingInterceptors;
@@ -94,12 +82,6 @@ class StompProtocolManager implements ProtocolManager<StompFrameInterceptor>, No
this.factory = factory;
this.server = server;
this.executor = server.getExecutorFactory().getExecutor();
- ManagementService service = server.getManagementService();
- if (service != null) {
- //allow management message to pass
- destinations.add(service.getManagementAddress().toString());
- service.addNotificationListener(this);
- }
this.incomingInterceptors = incomingInterceptors;
this.outgoingInterceptors = outgoingInterceptors;
}
@@ -422,45 +404,7 @@ class StompProtocolManager implements ProtocolManager<StompFrameInterceptor>, No
}
public boolean destinationExists(String destination) {
- return destinations.contains(destination);
- }
-
- @Override
- public void onNotification(Notification notification) {
- if (!(notification.getType() instanceof CoreNotificationType))
- return;
-
- CoreNotificationType type = (CoreNotificationType) notification.getType();
-
- TypedProperties props = notification.getProperties();
-
- switch (type) {
- case BINDING_ADDED: {
- if (!props.containsProperty(ManagementHelper.HDR_BINDING_TYPE)) {
- throw ActiveMQMessageBundle.BUNDLE.bindingTypeNotSpecified();
- }
-
- Integer bindingType = props.getIntProperty(ManagementHelper.HDR_BINDING_TYPE);
-
- if (bindingType == BindingType.DIVERT_INDEX) {
- return;
- }
-
- SimpleString address = props.getSimpleStringProperty(ManagementHelper.HDR_ADDRESS);
-
- destinations.add(address.toString());
-
- break;
- }
- case BINDING_REMOVED: {
- SimpleString address = props.getSimpleStringProperty(ManagementHelper.HDR_ADDRESS);
- destinations.remove(address.toString());
- break;
- }
- default:
- //ignore all others
- break;
- }
+ return server.getPostOffice().getAddresses().contains(SimpleString.toSimpleString(destination));
}
public ActiveMQServer getServer() {