From 738b15d0ae8a4611da1f123771b169d963b3dd1c Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Fri, 28 Aug 2015 14:53:01 -0400 Subject: [PATCH] Removing deadcode on openwire AMQSubscription --- .../openwire/amq/AMQConnectionContext.java | 7 +- .../amq/AMQConsumerBrokerExchange.java | 15 -- .../openwire/amq/AMQSubscription.java | 233 ------------------ .../openwire/amq/AMQSubscriptionRecovery.java | 43 ---- 4 files changed, 2 insertions(+), 296 deletions(-) delete mode 100644 artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSubscription.java delete mode 100644 artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSubscriptionRecovery.java diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConnectionContext.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConnectionContext.java index 120e60a603..54501e9259 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConnectionContext.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConnectionContext.java @@ -16,19 +16,16 @@ */ package org.apache.activemq.artemis.core.protocol.openwire.amq; -import java.io.IOException; -import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicBoolean; -import org.apache.activemq.broker.region.MessageReference; +import org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection; +import org.apache.activemq.artemis.core.protocol.openwire.OpenWireProtocolManager; import org.apache.activemq.command.ConnectionId; import org.apache.activemq.command.ConnectionInfo; import org.apache.activemq.command.WireFormatInfo; import org.apache.activemq.command.XATransactionId; import org.apache.activemq.filter.MessageEvaluationContext; import org.apache.activemq.state.ConnectionState; -import org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection; -import org.apache.activemq.artemis.core.protocol.openwire.OpenWireProtocolManager; public class AMQConnectionContext { diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumerBrokerExchange.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumerBrokerExchange.java index d92cd1579a..800ee3f355 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumerBrokerExchange.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumerBrokerExchange.java @@ -23,7 +23,6 @@ public abstract class AMQConsumerBrokerExchange { protected final AMQSession amqSession; private AMQConnectionContext connectionContext; - private AMQSubscription subscription; private boolean wildcard; public AMQConsumerBrokerExchange(AMQSession amqSession) { @@ -44,20 +43,6 @@ public abstract class AMQConsumerBrokerExchange { this.connectionContext = connectionContext; } - /** - * @return the subscription - */ - public AMQSubscription getSubscription() { - return this.subscription; - } - - /** - * @param subscription the subscription to set - */ - public void setSubscription(AMQSubscription subscription) { - this.subscription = subscription; - } - /** * @return the wildcard */ diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSubscription.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSubscription.java deleted file mode 100644 index abf492d943..0000000000 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSubscription.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.artemis.core.protocol.openwire.amq; - -import javax.jms.InvalidSelectorException; -import javax.management.ObjectName; -import java.io.IOException; - -import org.apache.activemq.broker.region.MessageReference; -import org.apache.activemq.command.ActiveMQDestination; -import org.apache.activemq.command.ConsumerInfo; -import org.apache.activemq.command.MessageAck; -import org.apache.activemq.command.MessageDispatchNotification; -import org.apache.activemq.command.MessagePull; -import org.apache.activemq.command.Response; -import org.apache.activemq.filter.MessageEvaluationContext; - -public interface AMQSubscription extends AMQSubscriptionRecovery { - - /** - * Used to add messages that match the subscription. - * - * @param node - * @throws Exception - * @throws InterruptedException - * @throws IOException - */ - void add(MessageReference node) throws Exception; - - /** - * Used when client acknowledge receipt of dispatched message. - * - * @throws IOException - * @throws Exception - */ - void acknowledge(AMQConnectionContext context, final MessageAck ack) throws Exception; - - /** - * Allows a consumer to pull a message on demand - */ - Response pullMessage(AMQConnectionContext context, MessagePull pull) throws Exception; - - /** - * Returns true if this subscription is a Wildcard subscription. - * - * @return true if wildcard subscription. - */ - boolean isWildcard(); - - /** - * Is the subscription interested in the message? - * - * @param node - * @param context - * @return - * @throws IOException - */ - boolean matches(MessageReference node, MessageEvaluationContext context) throws IOException; - - /** - * Is the subscription interested in messages in the destination? - * - * @param destination - * @return - */ - boolean matches(ActiveMQDestination destination); - - /** - * The ConsumerInfo object that created the subscription. - */ - ConsumerInfo getConsumerInfo(); - - /** - * The subscription should release as may references as it can to help the garbage collector - * reclaim memory. - */ - void gc(); - - /** - * Used by a Slave Broker to update dispatch information - * - * @param mdn - * @throws Exception - */ - void processMessageDispatchNotification(MessageDispatchNotification mdn) throws Exception; - - /** - * @return number of messages pending delivery - */ - int getPendingQueueSize(); - - /** - * @return number of messages dispatched to the client - */ - int getDispatchedQueueSize(); - - /** - * @return number of messages dispatched to the client - */ - long getDispatchedCounter(); - - /** - * @return number of messages that matched the subscription - */ - long getEnqueueCounter(); - - /** - * @return number of messages queued by the client - */ - long getDequeueCounter(); - - /** - * @return the JMS selector on the current subscription - */ - String getSelector(); - - /** - * Attempts to change the current active selector on the subscription. - * This operation is not supported for persistent topics. - */ - void setSelector(String selector) throws InvalidSelectorException, UnsupportedOperationException; - - /** - * @return the JMX object name that this subscription was registered as if applicable - */ - ObjectName getObjectName(); - - /** - * Set when the subscription is registered in JMX - */ - void setObjectName(ObjectName objectName); - - /** - * @return true when 60% or more room is left for dispatching messages - */ - boolean isLowWaterMark(); - - /** - * @return true when 10% or less room is left for dispatching messages - */ - boolean isHighWaterMark(); - - /** - * @return true if there is no space to dispatch messages - */ - boolean isFull(); - - /** - * inform the MessageConsumer on the client to change it's prefetch - * - * @param newPrefetch - */ - void updateConsumerPrefetch(int newPrefetch); - - /** - * Called when the subscription is destroyed. - */ - void destroy(); - - /** - * @return the prefetch size that is configured for the subscription - */ - int getPrefetchSize(); - - /** - * @return the number of messages awaiting acknowledgement - */ - int getInFlightSize(); - - /** - * @return the in flight messages as a percentage of the prefetch size - */ - int getInFlightUsage(); - - /** - * Informs the Broker if the subscription needs to intervention to recover it's state - * e.g. DurableTopicSubscriber may do - * - * @return true if recovery required - */ - boolean isRecoveryRequired(); - - /** - * @return true if a browser - */ - boolean isBrowser(); - - /** - * @return the number of messages this subscription can accept before its full - */ - int countBeforeFull(); - - AMQConnectionContext getContext(); - - int getCursorMemoryHighWaterMark(); - - void setCursorMemoryHighWaterMark(int cursorMemoryHighWaterMark); - - boolean isSlowConsumer(); - - void unmatched(MessageReference node) throws IOException; - - /** - * Returns the time since the last Ack message was received by this subscription. - * - * If there has never been an ack this value should be set to the creation time of the - * subscription. - * - * @return time of last received Ack message or Subscription create time if no Acks. - */ - long getTimeOfLastMessageAck(); - - long getConsumedCount(); - - void incrementConsumedCount(); - - void resetConsumedCount(); - -} diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSubscriptionRecovery.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSubscriptionRecovery.java deleted file mode 100644 index 1af2357824..0000000000 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSubscriptionRecovery.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.activemq.artemis.core.protocol.openwire.amq; - -import org.apache.activemq.broker.region.MessageReference; -import org.apache.activemq.command.ActiveMQDestination; - -/** - * An interface for recoverying transient messages held by the broker for - * retractive recovery for subscribers - */ -public interface AMQSubscriptionRecovery { - - /** - * Add a message to the SubscriptionRecovery - * - * @param context - * @param message - * @return true if the message is accepted - * @throws Exception - */ - boolean addRecoveredMessage(AMQConnectionContext context, MessageReference message) throws Exception; - - /** - * @return the Destination associated with this Subscription - */ - ActiveMQDestination getActiveMQDestination(); - -}