diff options
47 files changed, 549 insertions, 211 deletions
diff --git a/java/broker/src/main/java/org/apache/qpid/server/RequiredDeliveryException.java b/java/broker/src/main/java/org/apache/qpid/server/RequiredDeliveryException.java index ff933d3c0b..d61bb8916a 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/RequiredDeliveryException.java +++ b/java/broker/src/main/java/org/apache/qpid/server/RequiredDeliveryException.java @@ -25,9 +25,17 @@ import org.apache.qpid.protocol.AMQConstant; import org.apache.qpid.server.queue.AMQMessage; /** - * Signals that a required delivery could not be made. This could be bacuse of - * the immediate flag being set and the queue having no consumers, or the mandatory - * flag being set and the exchange having no valid bindings. + * Signals that a required delivery could not be made. This could be bacuse of the immediate flag being set and the + * queue having no consumers, or the mandatory flag being set and the exchange having no valid bindings. + * + * <p/>The failed message is associated with this error condition, by taking a reference to it. This enables the + * correct compensating action to be taken against the message, for example, bouncing it back to the sender. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represent failure to deliver a message that must be delivered. + * <tr><td> Associate the failed message with the error condition. <td> {@link AMQMessage} + * </table> */ public abstract class RequiredDeliveryException extends AMQException { @@ -40,10 +48,10 @@ public abstract class RequiredDeliveryException extends AMQException // Increment the reference as this message is in the routing phase // and so will have the ref decremented as routing fails. // we need to keep this message around so we can return it in the - // handler. So increment here. - _amqMessage = payload.takeReference(); - - //payload.incrementReference(); + // handler. So increment here. + _amqMessage = payload.takeReference(); + + // payload.incrementReference(); } public AMQMessage getAMQMessage() diff --git a/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeInUseException.java b/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeInUseException.java index 6b2891c573..c77f114428 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeInUseException.java +++ b/java/broker/src/main/java/org/apache/qpid/server/exchange/ExchangeInUseException.java @@ -7,9 +7,9 @@ * 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 @@ -22,6 +22,20 @@ package org.apache.qpid.server.exchange; import org.apache.qpid.AMQException; +/** + * ExchangeInUseRegistry indicates that an exchange cannot be unregistered because it is currently being used. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represents failure to unregister exchange that is in use. + * </table> + * + * @todo Not an AMQP exception as no status code. + * + * @todo This exception is not used. However, it is part of the ExchangeRegistry interface, and looks like code is + * going to need to be added to throw/deal with this. Alternatively ExchangeResitries may be able to handle the + * issue internally. + */ public class ExchangeInUseException extends AMQException { public ExchangeInUseException(String exchangeName) diff --git a/java/broker/src/main/java/org/apache/qpid/server/exchange/NoRouteException.java b/java/broker/src/main/java/org/apache/qpid/server/exchange/NoRouteException.java index c972b9d078..1d6ab3842d 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/exchange/NoRouteException.java +++ b/java/broker/src/main/java/org/apache/qpid/server/exchange/NoRouteException.java @@ -7,9 +7,9 @@ * 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 @@ -25,8 +25,14 @@ import org.apache.qpid.server.RequiredDeliveryException; import org.apache.qpid.server.queue.AMQMessage; /** - * Thrown by an exchange if there is no way to route a message with the - * mandatory flag set. + * NoRouteException is a {@link RequiredDeliveryException} that represents the failure case where a manadatory message + * cannot be delivered because there is no route for the message. The AMQP status code, 312, is always used to report + * this condition. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represent failure to deliver a message that must be delivered. + * </table> */ public class NoRouteException extends RequiredDeliveryException { diff --git a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQNoMethodHandlerException.java b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQNoMethodHandlerException.java index 16d74b6fc0..a7599a3e0d 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQNoMethodHandlerException.java +++ b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQNoMethodHandlerException.java @@ -20,13 +20,25 @@ */
package org.apache.qpid.server.protocol;
+import org.apache.qpid.AMQException;
import org.apache.qpid.framing.AMQMethodBody;
import org.apache.qpid.protocol.AMQMethodEvent;
-import org.apache.qpid.AMQException;
+/**
+ * AMQNoMethodHandlerException represents the case where no method handler exists to handle an AQMP method.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represents failure to handle an AMQP method.
+ * </table>
+ *
+ * @todo Not an AMQP exception as no status code.
+ *
+ * @todo Missing method handler. Unlikely to ever happen, and if it does its a coding error. Consider replacing with a
+ * Runtime.
+ */
public class AMQNoMethodHandlerException extends AMQException
{
-
public AMQNoMethodHandlerException(AMQMethodEvent<AMQMethodBody> evt)
{
super("AMQMethodEvent " + evt + " was not processed by any listener on Broker.");
diff --git a/java/broker/src/main/java/org/apache/qpid/server/protocol/UnknnownMessageTypeException.java b/java/broker/src/main/java/org/apache/qpid/server/protocol/UnknnownMessageTypeException.java index 45d09e8f3e..6e72aa062f 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/protocol/UnknnownMessageTypeException.java +++ b/java/broker/src/main/java/org/apache/qpid/server/protocol/UnknnownMessageTypeException.java @@ -20,14 +20,27 @@ */
package org.apache.qpid.server.protocol;
-import org.apache.qpid.framing.AMQDataBlock;
import org.apache.qpid.AMQException;
+import org.apache.qpid.framing.AMQDataBlock;
+/**
+ * UnknnownMessageTypeException represents a failure when Mina passes an unexpected frame type.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represents failure to cast a frame to its expected type.
+ * </table>
+ *
+ * @todo Not an AMQP exception as no status code.
+ *
+ * @todo Seems like this exception was created to handle an unsafe type cast that will never happen in practice. Would
+ * be better just to leave that as a ClassCastException. However, check the framing layer catches this error
+ * first.
+ */
public class UnknnownMessageTypeException extends AMQException
{
public UnknnownMessageTypeException(AMQDataBlock message)
{
super("Unknown message type: " + message.getClass().getName() + ": " + message);
-
}
}
diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java index 0adf6153f8..66a14f3bfb 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java +++ b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java @@ -31,6 +31,7 @@ import java.util.concurrent.atomic.AtomicLong; import javax.management.JMException; import org.apache.log4j.Logger; + import org.apache.qpid.AMQException; import org.apache.qpid.configuration.Configured; import org.apache.qpid.framing.AMQShortString; @@ -49,7 +50,19 @@ import org.apache.qpid.server.virtualhost.VirtualHost; */ public class AMQQueue implements Managable, Comparable { - + /** + * ExistingExclusiveSubscription signals a failure to create a subscription, because an exclusive subscription + * already exists. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represent failure to create a subscription, because an exclusive subscription already exists. + * </table> + * + * @todo Not an AMQP exception as no status code. + * + * @todo Move to top level, used outside this class. + */ public static final class ExistingExclusiveSubscription extends AMQException { @@ -59,19 +72,27 @@ public class AMQQueue implements Managable, Comparable } } + /** + * ExistingSubscriptionPreventsExclusive signals a failure to create an exclusize subscription, as a subscription + * already exists. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represent failure to create an exclusize subscription, as a subscription already exists. + * </table> + * + * @todo Not an AMQP exception as no status code. + * + * @todo Move to top level, used outside this class. + */ public static final class ExistingSubscriptionPreventsExclusive extends AMQException { - public ExistingSubscriptionPreventsExclusive() { super(""); } } - private static final ExistingExclusiveSubscription EXISTING_EXCLUSIVE = new ExistingExclusiveSubscription(); - private static final ExistingSubscriptionPreventsExclusive EXISTING_SUBSCRIPTION = new ExistingSubscriptionPreventsExclusive(); - - private static final Logger _logger = Logger.getLogger(AMQQueue.class); private final AMQShortString _name; @@ -110,7 +131,6 @@ public class AMQQueue implements Managable, Comparable private final VirtualHost _virtualHost; - /** max allowed size(KB) of a single message */ @Configured(path = "maximumMessageSize", defaultValue = "0") public long _maximumMessageSize; @@ -139,37 +159,34 @@ public class AMQQueue implements Managable, Comparable return _name.compareTo(((AMQQueue) o).getName()); } - public AMQQueue(AMQShortString name, boolean durable, AMQShortString owner, - boolean autoDelete, VirtualHost virtualHost) - throws AMQException + public AMQQueue(AMQShortString name, boolean durable, AMQShortString owner, boolean autoDelete, VirtualHost virtualHost) + throws AMQException { - this(name, durable, owner, autoDelete, virtualHost, - AsyncDeliveryConfig.getAsyncDeliveryExecutor(), new SubscriptionSet(), new SubscriptionImpl.Factory()); + this(name, durable, owner, autoDelete, virtualHost, AsyncDeliveryConfig.getAsyncDeliveryExecutor(), + new SubscriptionSet(), new SubscriptionImpl.Factory()); } - - protected AMQQueue(AMQShortString name, boolean durable, AMQShortString owner, - boolean autoDelete, VirtualHost virtualHost, - SubscriptionSet subscribers) - throws AMQException + protected AMQQueue(AMQShortString name, boolean durable, AMQShortString owner, boolean autoDelete, + VirtualHost virtualHost, SubscriptionSet subscribers) throws AMQException { - this(name, durable, owner, autoDelete, virtualHost, - AsyncDeliveryConfig.getAsyncDeliveryExecutor(), subscribers, new SubscriptionImpl.Factory()); + this(name, durable, owner, autoDelete, virtualHost, AsyncDeliveryConfig.getAsyncDeliveryExecutor(), subscribers, + new SubscriptionImpl.Factory()); } - protected AMQQueue(AMQShortString name, boolean durable, AMQShortString owner, - boolean autoDelete, VirtualHost virtualHost, - Executor asyncDelivery, SubscriptionSet subscribers, SubscriptionFactory subscriptionFactory) - throws AMQException + protected AMQQueue(AMQShortString name, boolean durable, AMQShortString owner, boolean autoDelete, + VirtualHost virtualHost, Executor asyncDelivery, SubscriptionSet subscribers, + SubscriptionFactory subscriptionFactory) throws AMQException { if (name == null) { throw new IllegalArgumentException("Queue name must not be null"); } + if (virtualHost == null) { throw new IllegalArgumentException("Virtual Host must not be null"); } + _name = name; _durable = durable; _owner = owner; @@ -260,10 +277,11 @@ public class AMQQueue implements Managable, Comparable public AMQMessage getMessageOnTheQueue(long messageId) { List<AMQMessage> list = getMessagesOnTheQueue(messageId, messageId); - if (list == null || list.size() == 0) + if ((list == null) || (list.size() == 0)) { return null; } + return list.get(0); } @@ -280,7 +298,7 @@ public class AMQQueue implements Managable, Comparable * @param storeContext */ public synchronized void moveMessagesToAnotherQueue(long fromMessageId, long toMessageId, String queueName, - StoreContext storeContext) + StoreContext storeContext) { // prepare the delivery manager for moving messages by stopping the async delivery and creating a lock AMQQueue anotherQueue = getVirtualHost().getQueueRegistry().getQueue(new AMQShortString(queueName)); @@ -398,6 +416,7 @@ public class AMQQueue implements Managable, Comparable { _virtualHost.getMessageStore().bindQueue(exchange, routingKey, this, arguments); } + _bindings.addBinding(routingKey, arguments, exchange); } @@ -408,25 +427,24 @@ public class AMQQueue implements Managable, Comparable { _virtualHost.getMessageStore().unbindQueue(exchange, routingKey, this, arguments); } + _bindings.remove(routingKey, arguments, exchange); } - public void registerProtocolSession(AMQProtocolSession ps, int channel, AMQShortString consumerTag, boolean acks, - FieldTable filters, boolean noLocal, boolean exclusive) - throws AMQException + FieldTable filters, boolean noLocal, boolean exclusive) throws AMQException { if (incrementSubscriberCount() > 1) { if (isExclusive()) { decrementSubscriberCount(); - throw EXISTING_EXCLUSIVE; + throw new ExistingExclusiveSubscription(); } else if (exclusive) { decrementSubscriberCount(); - throw EXISTING_SUBSCRIPTION; + throw new ExistingSubscriptionPreventsExclusive(); } } @@ -437,12 +455,13 @@ public class AMQQueue implements Managable, Comparable if (_logger.isDebugEnabled()) { - _logger.debug(MessageFormat.format("Registering protocol session {0} with channel {1} and " + - "consumer tag {2} with {3}", ps, channel, consumerTag, this)); + _logger.debug(MessageFormat.format( + "Registering protocol session {0} with channel {1} and " + "consumer tag {2} with {3}", ps, channel, + consumerTag, this)); } - Subscription subscription = _subscriptionFactory.createSubscription(channel, ps, consumerTag, acks, - filters, noLocal, this); + Subscription subscription = + _subscriptionFactory.createSubscription(channel, ps, consumerTag, acks, filters, noLocal, this); if (subscription.filtersMessages()) { @@ -455,7 +474,6 @@ public class AMQQueue implements Managable, Comparable _subscribers.addSubscriber(subscription); } - private boolean isExclusive() { return _isExclusive.get(); @@ -476,23 +494,22 @@ public class AMQQueue implements Managable, Comparable return _subscriberCount.decrementAndGet(); } - public void unregisterProtocolSession(AMQProtocolSession ps, int channel, AMQShortString consumerTag) throws AMQException { if (_logger.isDebugEnabled()) { - _logger.debug(MessageFormat.format("Unregistering protocol session {0} with channel {1} and consumer tag {2} from {3}", ps, channel, consumerTag, - this)); + _logger.debug(MessageFormat.format( + "Unregistering protocol session {0} with channel {1} and consumer tag {2} from {3}", ps, channel, + consumerTag, this)); } Subscription removedSubscription; - if ((removedSubscription = _subscribers.removeSubscriber(_subscriptionFactory.createSubscription(channel, - ps, - consumerTag))) - == null) + if ((removedSubscription = + _subscribers.removeSubscriber(_subscriptionFactory.createSubscription(channel, ps, consumerTag))) + == null) { - throw new AMQException("Protocol session with channel " + channel + " and consumer tag " + consumerTag + - " and protocol session key " + ps.getKey() + " not registered with queue " + this); + throw new AMQException("Protocol session with channel " + channel + " and consumer tag " + consumerTag + + " and protocol session key " + ps.getKey() + " not registered with queue " + this); } removedSubscription.close(); @@ -506,6 +523,7 @@ public class AMQQueue implements Managable, Comparable { _logger.info("Auto-deleteing queue:" + this); } + autodelete(); // we need to manually fire the event to the removed subscription (which was the last one left for this // queue. This is because the delete method uses the subscription set which has just been cleared @@ -523,22 +541,24 @@ public class AMQQueue implements Managable, Comparable return !_deliveryMgr.hasQueuedMessages(); } - public int delete(boolean checkUnused, boolean checkEmpty) throws AMQException { if (checkUnused && !_subscribers.isEmpty()) { _logger.info("Will not delete " + this + " as it is in use."); + return 0; } else if (checkEmpty && _deliveryMgr.hasQueuedMessages()) { _logger.info("Will not delete " + this + " as it is not empty."); + return 0; } else { delete(); + return _deliveryMgr.getQueueMessageCount(); } } @@ -555,6 +575,7 @@ public class AMQQueue implements Managable, Comparable { task.doTask(this); } + _deleteTaskList.clear(); } } @@ -565,12 +586,13 @@ public class AMQQueue implements Managable, Comparable { _logger.debug(MessageFormat.format("autodeleting {0}", this)); } + delete(); } public void processGet(StoreContext storeContext, AMQMessage msg, boolean deliverFirst) throws AMQException { - //fixme not sure what this is doing. should we be passing deliverFirst through here? + // fixme not sure what this is doing. should we be passing deliverFirst through here? // This code is not used so when it is perhaps it should _deliveryMgr.deliver(storeContext, getName(), msg, deliverFirst); try @@ -586,10 +608,10 @@ public class AMQQueue implements Managable, Comparable } } -// public DeliveryManager getDeliveryManager() -// { -// return _deliveryMgr; -// } + // public DeliveryManager getDeliveryManager() + // { + // return _deliveryMgr; + // } public void process(StoreContext storeContext, AMQMessage msg, boolean deliverFirst) throws AMQException { @@ -615,10 +637,10 @@ public class AMQQueue implements Managable, Comparable } catch (MessageCleanupException e) { - //Message was dequeued, but could not then be deleted - //though it is no longer referenced. This should be very - //rare and can be detected and cleaned up on recovery or - //done through some form of manual intervention. + // Message was dequeued, but could not then be deleted + // though it is no longer referenced. This should be very + // rare and can be detected and cleaned up on recovery or + // done through some form of manual intervention. _logger.error(e, e); } catch (AMQException e) @@ -660,7 +682,8 @@ public class AMQQueue implements Managable, Comparable { return true; } - if (o == null || getClass() != o.getClass()) + + if ((o == null) || (getClass() != o.getClass())) { return false; } diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/FailedDequeueException.java b/java/broker/src/main/java/org/apache/qpid/server/queue/FailedDequeueException.java index b74c49e6e1..6466e81dd2 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/queue/FailedDequeueException.java +++ b/java/broker/src/main/java/org/apache/qpid/server/queue/FailedDequeueException.java @@ -7,9 +7,9 @@ * 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 @@ -23,7 +23,18 @@ package org.apache.qpid.server.queue; import org.apache.qpid.AMQException; /** - * Signals that the dequeue of a message from a queue failed + * Signals that the dequeue of a message from a queue failed. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Indicates the a message could not be dequeued from a queue. + * <tr><td> + * </table> + * + * @todo Not an AMQP exception as no status code. + * + * @todo Happens as a consequence of a message store failure, or reference counting error. Both of which migh become + * runtime exceptions, as unrecoverable conditions? In which case this one might be dropped too. */ public class FailedDequeueException extends AMQException { diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/MessageCleanupException.java b/java/broker/src/main/java/org/apache/qpid/server/queue/MessageCleanupException.java index 1e7e6f03d2..090096d3c3 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/queue/MessageCleanupException.java +++ b/java/broker/src/main/java/org/apache/qpid/server/queue/MessageCleanupException.java @@ -7,9 +7,9 @@ * 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 @@ -23,8 +23,20 @@ package org.apache.qpid.server.queue; import org.apache.qpid.AMQException; /** - * Signals that the removal of a message once its refcount reached - * zero failed. + * MessageCleanupException represents the failure to perform reference counting on messages correctly. This should not + * happen, but there may be programming errors giving race conditions that cause the reference counting to go wrong. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Signals that the reference count of a message has gone below zero. + * <tr><td> Indicates that a message store has lost a message which is still referenced. + * </table> + * + * @todo Not an AMQP exception as no status code. + * + * @todo The race conditions leading to this error should be cleaned up, and a runtime exception used instead. If the + * message store loses messages, then something is seriously wrong and it would be sensible to terminate the + * broker. This may be disguising out of memory errors. */ public class MessageCleanupException extends AMQException { @@ -32,6 +44,7 @@ public class MessageCleanupException extends AMQException { super("Failed to cleanup message with id " + messageId, e); } + public MessageCleanupException(String message) { super(message); diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/NoConsumersException.java b/java/broker/src/main/java/org/apache/qpid/server/queue/NoConsumersException.java index c63490f019..d6fd1eec89 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/queue/NoConsumersException.java +++ b/java/broker/src/main/java/org/apache/qpid/server/queue/NoConsumersException.java @@ -7,9 +7,9 @@ * 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 @@ -24,9 +24,14 @@ import org.apache.qpid.protocol.AMQConstant; import org.apache.qpid.server.RequiredDeliveryException; /** - * Signals that no consumers exist for a message at a given point in time. - * Used if a message has immediate=true and there are no consumers registered - * with the queue. + * NoConsumersException is a {@link RequiredDeliveryException} that represents the failure case where an immediate + * message cannot be delivered because there are presently no consumers for the message. The AMQP status code, 313, is + * always used to report this condition. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represent failure to deliver a message that must be delivered. + * </table> */ public class NoConsumersException extends RequiredDeliveryException { diff --git a/java/broker/src/main/java/org/apache/qpid/server/state/AMQStateManager.java b/java/broker/src/main/java/org/apache/qpid/server/state/AMQStateManager.java index 50129ec274..f96900d0a9 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/state/AMQStateManager.java +++ b/java/broker/src/main/java/org/apache/qpid/server/state/AMQStateManager.java @@ -26,6 +26,7 @@ import java.util.Map; import java.util.concurrent.CopyOnWriteArraySet; import org.apache.log4j.Logger; + import org.apache.qpid.AMQException; import org.apache.qpid.framing.AMQMethodBody; import org.apache.qpid.framing.BasicAckBody; @@ -35,6 +36,7 @@ import org.apache.qpid.framing.BasicGetBody; import org.apache.qpid.framing.BasicPublishBody; import org.apache.qpid.framing.BasicQosBody; import org.apache.qpid.framing.BasicRecoverBody; +import org.apache.qpid.framing.BasicRejectBody; import org.apache.qpid.framing.ChannelCloseBody; import org.apache.qpid.framing.ChannelCloseOkBody; import org.apache.qpid.framing.ChannelFlowBody; @@ -55,7 +57,6 @@ import org.apache.qpid.framing.QueuePurgeBody; import org.apache.qpid.framing.TxCommitBody; import org.apache.qpid.framing.TxRollbackBody; import org.apache.qpid.framing.TxSelectBody; -import org.apache.qpid.framing.BasicRejectBody; import org.apache.qpid.protocol.AMQMethodEvent; import org.apache.qpid.protocol.AMQMethodListener; import org.apache.qpid.server.handler.BasicAckMethodHandler; @@ -65,6 +66,7 @@ import org.apache.qpid.server.handler.BasicGetMethodHandler; import org.apache.qpid.server.handler.BasicPublishMethodHandler; import org.apache.qpid.server.handler.BasicQosHandler; import org.apache.qpid.server.handler.BasicRecoverMethodHandler; +import org.apache.qpid.server.handler.BasicRejectMethodHandler; import org.apache.qpid.server.handler.ChannelCloseHandler; import org.apache.qpid.server.handler.ChannelCloseOkHandler; import org.apache.qpid.server.handler.ChannelFlowHandler; @@ -83,9 +85,8 @@ import org.apache.qpid.server.handler.QueueDeclareHandler; import org.apache.qpid.server.handler.QueueDeleteHandler; import org.apache.qpid.server.handler.QueuePurgeHandler; import org.apache.qpid.server.handler.TxCommitHandler; -import org.apache.qpid.server.handler.BasicRejectMethodHandler; -import org.apache.qpid.server.handler.TxSelectHandler; import org.apache.qpid.server.handler.TxRollbackHandler; +import org.apache.qpid.server.handler.TxSelectHandler; import org.apache.qpid.server.protocol.AMQProtocolSession; import org.apache.qpid.server.virtualhost.VirtualHostRegistry; @@ -107,18 +108,18 @@ public class AMQStateManager implements AMQMethodListener * AMQFrame. */ private final EnumMap<AMQState, Map<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>> _state2HandlersMap = - new EnumMap<AMQState, Map<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>>(AMQState.class); - + new EnumMap<AMQState, Map<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>>( + AMQState.class); private CopyOnWriteArraySet<StateListener> _stateListeners = new CopyOnWriteArraySet<StateListener>(); - public AMQStateManager(VirtualHostRegistry virtualHostRegistry, AMQProtocolSession protocolSession) { this(AMQState.CONNECTION_NOT_STARTED, true, virtualHostRegistry, protocolSession); } - protected AMQStateManager(AMQState initial, boolean register, VirtualHostRegistry virtualHostRegistry, AMQProtocolSession protocolSession) + protected AMQStateManager(AMQState initial, boolean register, VirtualHostRegistry virtualHostRegistry, + AMQProtocolSession protocolSession) { _virtualHostRegistry = virtualHostRegistry; _protocolSession = protocolSession; @@ -220,37 +221,38 @@ public class AMQStateManager implements AMQMethodListener checkChannel(evt, _protocolSession); handler.methodReceived(this, evt); + return true; } + return false; } private <B extends AMQMethodBody> void checkChannel(AMQMethodEvent<B> evt, AMQProtocolSession protocolSession) - throws AMQException + throws AMQException { - if (evt.getChannelId() != 0 - && !(evt.getMethod() instanceof ChannelOpenBody) - && (protocolSession.getChannel(evt.getChannelId()) == null) - && !protocolSession.channelAwaitingClosure(evt.getChannelId())) + if ((evt.getChannelId() != 0) && !(evt.getMethod() instanceof ChannelOpenBody) + && (protocolSession.getChannel(evt.getChannelId()) == null) + && !protocolSession.channelAwaitingClosure(evt.getChannelId())) { throw evt.getMethod().getChannelNotFoundException(evt.getChannelId()); } } protected <B extends AMQMethodBody> StateAwareMethodListener<B> findStateTransitionHandler(AMQState currentState, - B frame) - throws IllegalStateTransitionException + B frame) + // throws IllegalStateTransitionException { - final Map<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>> - classToHandlerMap = _state2HandlersMap.get(currentState); + final Map<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>> classToHandlerMap = + _state2HandlersMap.get(currentState); - final StateAwareMethodListener<B> handler = classToHandlerMap == null - ? null - : (StateAwareMethodListener<B>) classToHandlerMap.get(frame.getClass()); + final StateAwareMethodListener<B> handler = + (classToHandlerMap == null) ? null : (StateAwareMethodListener<B>) classToHandlerMap.get(frame.getClass()); if (handler == null) { _logger.debug("No state transition handler defined for receiving frame " + frame); + return null; } else diff --git a/java/broker/src/main/java/org/apache/qpid/server/state/IllegalStateTransitionException.java b/java/broker/src/main/java/org/apache/qpid/server/state/IllegalStateTransitionException.java index 2d7cc27a85..cec67a8a6d 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/state/IllegalStateTransitionException.java +++ b/java/broker/src/main/java/org/apache/qpid/server/state/IllegalStateTransitionException.java @@ -7,9 +7,9 @@ * 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 @@ -22,6 +22,11 @@ package org.apache.qpid.server.state; import org.apache.qpid.AMQException; +/** + * @todo Not an AMQP exception as no status code. + * + * @todo Not used! Delete. + */ public class IllegalStateTransitionException extends AMQException { private AMQState _originalState; @@ -30,8 +35,7 @@ public class IllegalStateTransitionException extends AMQException public IllegalStateTransitionException(AMQState originalState, Class frame) { - super("No valid state transition defined for receiving frame " + frame + - " from state " + originalState); + super("No valid state transition defined for receiving frame " + frame + " from state " + originalState); _originalState = originalState; _frame = frame; } diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQAuthenticationException.java b/java/client/src/main/java/org/apache/qpid/client/AMQAuthenticationException.java index 0bc474f6e6..b6fbb6c6bf 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQAuthenticationException.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQAuthenticationException.java @@ -7,9 +7,9 @@ * 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 @@ -23,10 +23,20 @@ package org.apache.qpid.client; import org.apache.qpid.AMQException; import org.apache.qpid.protocol.AMQConstant; +/** + * AMQAuthenticationException represents all failures to authenticate access to a broker. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represent failure to authenticate the client. + * </table> + * + * @todo Will this alwyas have the same status code, NOT_ALLOWED 530? Might set this up to always use that code. + */ public class AMQAuthenticationException extends AMQException { public AMQAuthenticationException(AMQConstant error, String msg) { - super(error,msg); + super(error, msg); } } diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQNoConsumersException.java b/java/client/src/main/java/org/apache/qpid/client/AMQNoConsumersException.java index bec2958cb9..54d5a0426f 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQNoConsumersException.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQNoConsumersException.java @@ -7,9 +7,9 @@ * 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 @@ -23,15 +23,18 @@ package org.apache.qpid.client; import org.apache.qpid.AMQUndeliveredException; import org.apache.qpid.protocol.AMQConstant; - +/** + * AMQNoConsumersException indicates failure to pass an immediate message to a consumer. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represents failure to pass an immediate message to a consumer. + * <tr><td> + */ public class AMQNoConsumersException extends AMQUndeliveredException { public AMQNoConsumersException(String msg, Object bounced) { super(AMQConstant.NO_CONSUMERS, msg, bounced); } - - } - - diff --git a/java/client/src/main/java/org/apache/qpid/client/AMQNoRouteException.java b/java/client/src/main/java/org/apache/qpid/client/AMQNoRouteException.java index 6ea8413446..a314101acf 100644 --- a/java/client/src/main/java/org/apache/qpid/client/AMQNoRouteException.java +++ b/java/client/src/main/java/org/apache/qpid/client/AMQNoRouteException.java @@ -7,9 +7,9 @@ * 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 @@ -23,15 +23,18 @@ package org.apache.qpid.client; import org.apache.qpid.AMQUndeliveredException; import org.apache.qpid.protocol.AMQConstant; - +/** + * AMQNoRouteException indicates that a mandatory message could not be routed. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represents failure to route a mandatory message. + * <tr><td> + */ public class AMQNoRouteException extends AMQUndeliveredException { public AMQNoRouteException(String msg, Object bounced) { super(AMQConstant.NO_ROUTE, msg, bounced); } - - } - - diff --git a/java/client/src/main/java/org/apache/qpid/client/message/UnexpectedBodyReceivedException.java b/java/client/src/main/java/org/apache/qpid/client/message/UnexpectedBodyReceivedException.java index 54a8283763..1f61a661d4 100644 --- a/java/client/src/main/java/org/apache/qpid/client/message/UnexpectedBodyReceivedException.java +++ b/java/client/src/main/java/org/apache/qpid/client/message/UnexpectedBodyReceivedException.java @@ -23,6 +23,9 @@ package org.apache.qpid.client.message; import org.apache.qpid.AMQException; import org.apache.qpid.protocol.AMQConstant; +/** + * @todo Not used! Delete! + */ public class UnexpectedBodyReceivedException extends AMQException { public UnexpectedBodyReceivedException(String msg, Throwable t) diff --git a/java/client/src/main/java/org/apache/qpid/client/message/UnprocessedMessage.java b/java/client/src/main/java/org/apache/qpid/client/message/UnprocessedMessage.java index b176df87fe..5b199f2478 100644 --- a/java/client/src/main/java/org/apache/qpid/client/message/UnprocessedMessage.java +++ b/java/client/src/main/java/org/apache/qpid/client/message/UnprocessedMessage.java @@ -63,7 +63,7 @@ public class UnprocessedMessage _bounceBody = bounceBody; } - public void receiveBody(ContentBody body) throws UnexpectedBodyReceivedException + public void receiveBody(ContentBody body) //throws UnexpectedBodyReceivedException { if (body.payload != null) diff --git a/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java b/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java index a557fc8027..386aae4ad1 100644 --- a/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java +++ b/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java @@ -39,7 +39,7 @@ import org.apache.qpid.AMQException; import org.apache.qpid.client.AMQConnection; import org.apache.qpid.client.AMQSession; import org.apache.qpid.client.ConnectionTuneParameters; -import org.apache.qpid.client.message.UnexpectedBodyReceivedException; +// import org.apache.qpid.client.message.UnexpectedBodyReceivedException; import org.apache.qpid.client.message.UnprocessedMessage; import org.apache.qpid.client.state.AMQStateManager; import org.apache.qpid.framing.AMQDataBlock; @@ -106,10 +106,9 @@ public class AMQProtocolSession implements AMQVersionAwareProtocolSession private final AMQConnection _connection; - public AMQProtocolSession(AMQProtocolHandler protocolHandler, IoSession protocolSession, AMQConnection connection) { - this(protocolHandler,protocolSession,connection, new AMQStateManager()); + this(protocolHandler, protocolSession, connection, new AMQStateManager()); } @@ -269,15 +268,15 @@ public class AMQProtocolSession implements AMQVersionAwareProtocolSession throw new AMQException("Error: received content body without having received a ContentHeader frame first"); } - try - { - msg.receiveBody(contentBody); - } + /*try + {*/ + msg.receiveBody(contentBody); + /*} catch (UnexpectedBodyReceivedException e) { _channelId2UnprocessedMsgMap.remove(channelId); throw e; - } + }*/ if (msg.isAllBodyDataReceived()) { @@ -328,7 +327,6 @@ public class AMQProtocolSession implements AMQVersionAwareProtocolSession } } - /** * Starts the process of closing a session * diff --git a/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java b/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java index 825baf95d1..0f43115841 100644 --- a/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java +++ b/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java @@ -186,7 +186,7 @@ public class AMQStateManager implements AMQMethodListener protected StateAwareMethodListener findStateTransitionHandler(AMQState currentState, AMQMethodBody frame) - throws IllegalStateTransitionException + // throws IllegalStateTransitionException { final Class clazz = frame.getClass(); if (_logger.isDebugEnabled()) diff --git a/java/client/src/main/java/org/apache/qpid/client/state/IllegalStateTransitionException.java b/java/client/src/main/java/org/apache/qpid/client/state/IllegalStateTransitionException.java index bd1145da9f..41fa1ba704 100644 --- a/java/client/src/main/java/org/apache/qpid/client/state/IllegalStateTransitionException.java +++ b/java/client/src/main/java/org/apache/qpid/client/state/IllegalStateTransitionException.java @@ -22,6 +22,11 @@ package org.apache.qpid.client.state; import org.apache.qpid.AMQException; +/** + * @todo Not an AMQP exception as no status code. + * + * @todo Not used! Delete. + */ public class IllegalStateTransitionException extends AMQException { private AMQState _originalState; diff --git a/java/client/src/main/java/org/apache/qpid/client/transport/AMQNoTransportForProtocolException.java b/java/client/src/main/java/org/apache/qpid/client/transport/AMQNoTransportForProtocolException.java index 1ec3adc2eb..da16baaad9 100644 --- a/java/client/src/main/java/org/apache/qpid/client/transport/AMQNoTransportForProtocolException.java +++ b/java/client/src/main/java/org/apache/qpid/client/transport/AMQNoTransportForProtocolException.java @@ -22,6 +22,16 @@ package org.apache.qpid.client.transport; import org.apache.qpid.jms.BrokerDetails; +/** + * AMQNoTransportForProtocolException represents a connection failure where there is no transport medium to connect + * to the broker available. This may be the case if their is a error in the connection url, or an unsupported transport + * type is specified. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represent absence of a transport medium. + * </table> + */ public class AMQNoTransportForProtocolException extends AMQTransportConnectionException { BrokerDetails _details; diff --git a/java/client/src/main/java/org/apache/qpid/client/transport/AMQTransportConnectionException.java b/java/client/src/main/java/org/apache/qpid/client/transport/AMQTransportConnectionException.java index fec7ff693c..24b4e03b39 100644 --- a/java/client/src/main/java/org/apache/qpid/client/transport/AMQTransportConnectionException.java +++ b/java/client/src/main/java/org/apache/qpid/client/transport/AMQTransportConnectionException.java @@ -23,6 +23,15 @@ package org.apache.qpid.client.transport; import org.apache.qpid.AMQException; import org.apache.qpid.protocol.AMQConstant; +/** + * AMQTransportConnectionException indicates a failure to establish a connection through the transporting medium, to + * an AMQP broker. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represent failure to connect through the transport medium. + * </table> + */ public class AMQTransportConnectionException extends AMQException { public AMQTransportConnectionException(AMQConstant errorCode, String message, Throwable cause) diff --git a/java/client/src/main/java/org/apache/qpid/client/vmbroker/AMQVMBrokerCreationException.java b/java/client/src/main/java/org/apache/qpid/client/vmbroker/AMQVMBrokerCreationException.java index 4b2982fe9c..1791e7ede3 100644 --- a/java/client/src/main/java/org/apache/qpid/client/vmbroker/AMQVMBrokerCreationException.java +++ b/java/client/src/main/java/org/apache/qpid/client/vmbroker/AMQVMBrokerCreationException.java @@ -23,6 +23,14 @@ package org.apache.qpid.client.vmbroker; import org.apache.qpid.client.transport.AMQTransportConnectionException; import org.apache.qpid.protocol.AMQConstant; +/** + * AMQVMBrokerCreationException represents failure to create an in VM broker on the vm transport medium. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represent failure to create an in VM broker. + * </table> + */ public class AMQVMBrokerCreationException extends AMQTransportConnectionException { private int _port; diff --git a/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQConnectionWaitException.java b/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQConnectionWaitException.java index 4d2737edce..2baaa344ef 100644 --- a/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQConnectionWaitException.java +++ b/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQConnectionWaitException.java @@ -22,6 +22,16 @@ package org.apache.qpid.server.cluster; import org.apache.qpid.AMQException;
+/**
+ * AMQConnectionWaitException represents a failure to connect to a cluster peer in a timely manner.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represents failure to connect to a cluster peer in a timely manner.
+ * </table>
+ *
+ * @todo Not an AMQP exception as no status code.
+ */
public class AMQConnectionWaitException extends AMQException
{
public AMQConnectionWaitException(String s, Throwable e)
diff --git a/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQUnexpectedBodyTypeException.java b/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQUnexpectedBodyTypeException.java index 22a94d3c75..951bd22df0 100644 --- a/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQUnexpectedBodyTypeException.java +++ b/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQUnexpectedBodyTypeException.java @@ -23,9 +23,22 @@ package org.apache.qpid.server.cluster; import org.apache.qpid.AMQException;
import org.apache.qpid.framing.AMQBody;
+/**
+ * AMQUnexpectedBodyTypeException represents a failure where a message body does not match its expected type. For example,
+ * and AMQP method should have a method body.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represents a failure where a message body does not match its expected type.
+ * </table>
+ *
+ * @todo Not an AMQP exception as no status code.
+ *
+ * @todo Seems like this exception was created to handle an unsafe type cast that will never happen in practice. Would
+ * be better just to leave that as a ClassCastException. Check that the framing layer will pick up the error first.
+ */
public class AMQUnexpectedBodyTypeException extends AMQException
{
-
public AMQUnexpectedBodyTypeException(Class<? extends AMQBody> expectedClass, AMQBody body)
{
super("Unexpected body type. Expected: " + expectedClass.getName() + "; got: " + body.getClass().getName());
diff --git a/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQUnexpectedFrameTypeException.java b/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQUnexpectedFrameTypeException.java index 721da24d53..4dd318f90d 100644 --- a/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQUnexpectedFrameTypeException.java +++ b/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQUnexpectedFrameTypeException.java @@ -22,6 +22,20 @@ package org.apache.qpid.server.cluster; import org.apache.qpid.AMQException;
+/**
+ * AMQUnexpectedFrameTypeException represents a failure when Mina passes an unexpected frame type.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represents failure to cast a frame to its expected type.
+ * </table>
+ *
+ * @todo Not an AMQP exception as no status code.
+ *
+ * @todo Seems like this exception was created to handle an unsafe type cast that will never happen in practice. Would
+ * be better just to leave that as a ClassCastException. However, check the framing layer catches this error
+ * first.
+ */
public class AMQUnexpectedFrameTypeException extends AMQException
{
public AMQUnexpectedFrameTypeException(String s)
diff --git a/java/cluster/src/main/java/org/apache/qpid/server/cluster/ClientHandlerRegistry.java b/java/cluster/src/main/java/org/apache/qpid/server/cluster/ClientHandlerRegistry.java index 5300912716..c1caf8bbff 100644 --- a/java/cluster/src/main/java/org/apache/qpid/server/cluster/ClientHandlerRegistry.java +++ b/java/cluster/src/main/java/org/apache/qpid/server/cluster/ClientHandlerRegistry.java @@ -27,7 +27,7 @@ import org.apache.qpid.client.handler.ConnectionStartMethodHandler; import org.apache.qpid.client.handler.ConnectionTuneMethodHandler; import org.apache.qpid.client.state.AMQState; import org.apache.qpid.client.state.AMQStateManager; -import org.apache.qpid.client.state.IllegalStateTransitionException; +// import org.apache.qpid.client.state.IllegalStateTransitionException; import org.apache.qpid.client.state.StateAwareMethodListener; import org.apache.qpid.client.protocol.AMQProtocolSession; import org.apache.qpid.framing.*; @@ -78,7 +78,7 @@ public class ClientHandlerRegistry extends AMQStateManager return registry; } - protected StateAwareMethodListener findStateTransitionHandler(AMQState state, AMQMethodBody frame) throws IllegalStateTransitionException + protected StateAwareMethodListener findStateTransitionHandler(AMQState state, AMQMethodBody frame) //throws IllegalStateTransitionException { ClientRegistry registry = _handlers.get(state); return registry == null ? null : registry.getHandler(frame); diff --git a/java/cluster/src/main/java/org/apache/qpid/server/cluster/ServerHandlerRegistry.java b/java/cluster/src/main/java/org/apache/qpid/server/cluster/ServerHandlerRegistry.java index 03b0dc7f2e..aadcfa4b4c 100644 --- a/java/cluster/src/main/java/org/apache/qpid/server/cluster/ServerHandlerRegistry.java +++ b/java/cluster/src/main/java/org/apache/qpid/server/cluster/ServerHandlerRegistry.java @@ -24,7 +24,7 @@ import org.apache.log4j.Logger; import org.apache.qpid.framing.AMQMethodBody; import org.apache.qpid.server.state.AMQState; import org.apache.qpid.server.state.AMQStateManager; -import org.apache.qpid.server.state.IllegalStateTransitionException; +//import org.apache.qpid.server.state.IllegalStateTransitionException; import org.apache.qpid.server.state.StateAwareMethodListener; import org.apache.qpid.server.cluster.util.LogMessage; import org.apache.qpid.server.queue.QueueRegistry; @@ -74,7 +74,7 @@ class ServerHandlerRegistry extends AMQStateManager } } - protected <B extends AMQMethodBody> StateAwareMethodListener<B> findStateTransitionHandler(AMQState state, B frame) throws IllegalStateTransitionException + protected <B extends AMQMethodBody> StateAwareMethodListener<B> findStateTransitionHandler(AMQState state, B frame) //throws IllegalStateTransitionException { MethodHandlerRegistry registry = _handlers.get(state); StateAwareMethodListener<B> handler = (registry == null) ? null : registry.getHandler(frame); diff --git a/java/common/src/main/java/org/apache/qpid/AMQChannelClosedException.java b/java/common/src/main/java/org/apache/qpid/AMQChannelClosedException.java index 272933ca04..251e91c1b9 100644 --- a/java/common/src/main/java/org/apache/qpid/AMQChannelClosedException.java +++ b/java/common/src/main/java/org/apache/qpid/AMQChannelClosedException.java @@ -7,9 +7,9 @@ * 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 @@ -23,7 +23,14 @@ package org.apache.qpid; import org.apache.qpid.protocol.AMQConstant; /** - * AMQ channel closed exception. + * AMQChannelClosedException indicates that an operation cannot be performed becauase a channel has been closed. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represents a failed operation on a closed channel. + * </table> + * + * @todo Does this duplicate AMQChannelException? */ public class AMQChannelClosedException extends AMQException { @@ -32,5 +39,3 @@ public class AMQChannelClosedException extends AMQException super(errorCode, msg); } } - - diff --git a/java/common/src/main/java/org/apache/qpid/AMQChannelException.java b/java/common/src/main/java/org/apache/qpid/AMQChannelException.java index d8c9b287bd..9efd271e4d 100644 --- a/java/common/src/main/java/org/apache/qpid/AMQChannelException.java +++ b/java/common/src/main/java/org/apache/qpid/AMQChannelException.java @@ -25,6 +25,16 @@ import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.framing.ChannelCloseBody; import org.apache.qpid.protocol.AMQConstant; +/** + * AMQChannelException indicates that an error that requires the channel to be closed has occurred. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represents an error that rquires the channel to be closed. + * </table> + * + * @todo Does this duplicate AMQChannelClosedException? + */ public class AMQChannelException extends AMQException { private final int _classId; diff --git a/java/common/src/main/java/org/apache/qpid/AMQConnectionClosedException.java b/java/common/src/main/java/org/apache/qpid/AMQConnectionClosedException.java index e0ed16a9f0..931c6cd87a 100644 --- a/java/common/src/main/java/org/apache/qpid/AMQConnectionClosedException.java +++ b/java/common/src/main/java/org/apache/qpid/AMQConnectionClosedException.java @@ -7,9 +7,9 @@ * 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 @@ -23,7 +23,14 @@ package org.apache.qpid; import org.apache.qpid.protocol.AMQConstant; /** - * AMQ channel closed exception. + * AMQConnectionClosedException indicates that an operation cannot be performed becauase a connection has been closed. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represents a failed operation on a closed conneciton. + * </table> + * + * @todo Does this duplicate AMQConnectionException? */ public class AMQConnectionClosedException extends AMQException { @@ -32,5 +39,3 @@ public class AMQConnectionClosedException extends AMQException super(errorCode, msg); } } - - diff --git a/java/common/src/main/java/org/apache/qpid/AMQConnectionException.java b/java/common/src/main/java/org/apache/qpid/AMQConnectionException.java index c4f80191a3..7edfa648ed 100644 --- a/java/common/src/main/java/org/apache/qpid/AMQConnectionException.java +++ b/java/common/src/main/java/org/apache/qpid/AMQConnectionException.java @@ -7,9 +7,9 @@ * 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 @@ -26,6 +26,16 @@ import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.framing.ConnectionCloseBody; import org.apache.qpid.protocol.AMQConstant; +/** + * AMQConnectionException indicates that an error that requires the channel to be closed has occurred. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represents an error that rquires the channel to be closed. + * </table> + * + * @todo Does this duplicate AMQChannelClosedException? + */ public class AMQConnectionException extends AMQException { private final int _classId; @@ -35,7 +45,8 @@ public class AMQConnectionException extends AMQException private final byte minor; boolean _closeConnetion; - public AMQConnectionException(AMQConstant errorCode, String msg, int classId, int methodId, byte major, byte minor, Throwable t) + public AMQConnectionException(AMQConstant errorCode, String msg, int classId, int methodId, byte major, byte minor, + Throwable t) { super(errorCode, msg, t); _classId = classId; @@ -53,12 +64,10 @@ public class AMQConnectionException extends AMQException this.minor = minor; } - - public AMQFrame getCloseFrame(int channel) { - return ConnectionCloseBody.createAMQFrame(channel, major, minor, _classId, _methodId, getErrorCode().getCode(), new AMQShortString(getMessage())); + return ConnectionCloseBody.createAMQFrame(channel, major, minor, _classId, _methodId, getErrorCode().getCode(), + new AMQShortString(getMessage())); } - } diff --git a/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java b/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java index 9513cfc468..72fa2ae984 100644 --- a/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java +++ b/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java @@ -1,5 +1,15 @@ package org.apache.qpid;
+/**
+ * AMQConnectionFailureException indicates that a connection to a broker could not be formed.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represents failure to connect to a broker.
+ * </table>
+ *
+ * @todo Not an AMQP exception as no status code.
+ */
public class AMQConnectionFailureException extends AMQException
{
public AMQConnectionFailureException(String message)
diff --git a/java/common/src/main/java/org/apache/qpid/AMQDisconnectedException.java b/java/common/src/main/java/org/apache/qpid/AMQDisconnectedException.java index b142eea73c..e62b2c10a2 100644 --- a/java/common/src/main/java/org/apache/qpid/AMQDisconnectedException.java +++ b/java/common/src/main/java/org/apache/qpid/AMQDisconnectedException.java @@ -7,9 +7,9 @@ * 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 @@ -21,7 +21,14 @@ package org.apache.qpid; /** - * AMQ disconnected exception. + * AMQDisconnectedException indicates that a broker disconnected without failover. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represents disconnection without failover by the broker. + * </table> + * + * @todo Not an AMQP exception as no status code. */ public class AMQDisconnectedException extends AMQException { @@ -30,5 +37,3 @@ public class AMQDisconnectedException extends AMQException super(msg); } } - - diff --git a/java/common/src/main/java/org/apache/qpid/AMQException.java b/java/common/src/main/java/org/apache/qpid/AMQException.java index 2f04a01f53..41599ed880 100644 --- a/java/common/src/main/java/org/apache/qpid/AMQException.java +++ b/java/common/src/main/java/org/apache/qpid/AMQException.java @@ -24,11 +24,11 @@ import org.apache.qpid.protocol.AMQConstant; /** * AMQException forms the root exception of all exceptions relating to the AMQ protocol. It provides space to associate - * an AMQ error code with the exception, which is a numberic value, with a meaning defined by the protocol. + * a required AMQ error code with the exception, which is a numeric value, with a meaning defined by the protocol. * * <p/><table id="crc"><caption>CRC Card</caption> * <tr><th> Responsibilities <th> Collaborations - * <tr><td> Represents an exception condition associated with an AMQ protocol error code. + * <tr><td> Represents an exception condition associated with an AMQ protocol status code. * </table> * * @todo This exception class is also used as a generic exception throughout Qpid code. This usage may not be strictly diff --git a/java/common/src/main/java/org/apache/qpid/AMQInvalidArgumentException.java b/java/common/src/main/java/org/apache/qpid/AMQInvalidArgumentException.java index 9406921d88..278128f924 100644 --- a/java/common/src/main/java/org/apache/qpid/AMQInvalidArgumentException.java +++ b/java/common/src/main/java/org/apache/qpid/AMQInvalidArgumentException.java @@ -14,14 +14,22 @@ * "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. + * under the License. + * * - * */ package org.apache.qpid; import org.apache.qpid.protocol.AMQConstant; +/** + * AMQInvalidArgumentException indicates that an invalid argument has been passed to an AMQP method. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represents an error due to an invalid argument being passed to an AMQP method. + * </table> + */ public class AMQInvalidArgumentException extends AMQException { public AMQInvalidArgumentException(String message) diff --git a/java/common/src/main/java/org/apache/qpid/AMQInvalidRoutingKeyException.java b/java/common/src/main/java/org/apache/qpid/AMQInvalidRoutingKeyException.java index caf8f3a572..b5ec9845d6 100644 --- a/java/common/src/main/java/org/apache/qpid/AMQInvalidRoutingKeyException.java +++ b/java/common/src/main/java/org/apache/qpid/AMQInvalidRoutingKeyException.java @@ -22,6 +22,14 @@ package org.apache.qpid; import org.apache.qpid.protocol.AMQConstant; +/** + * AMQInvalidRoutingKeyException indicates an error with a routing key having an invalid format. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represents a format error in a routing key. + * </table> + */ public class AMQInvalidRoutingKeyException extends AMQException { public AMQInvalidRoutingKeyException(String message) diff --git a/java/common/src/main/java/org/apache/qpid/AMQTimeoutException.java b/java/common/src/main/java/org/apache/qpid/AMQTimeoutException.java index f1f973542d..0f8d9c47db 100644 --- a/java/common/src/main/java/org/apache/qpid/AMQTimeoutException.java +++ b/java/common/src/main/java/org/apache/qpid/AMQTimeoutException.java @@ -14,14 +14,22 @@ * "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. + * under the License. + * * - * */ package org.apache.qpid; import org.apache.qpid.protocol.AMQConstant; +/** + * AMQTimeoutException indicates that an expected response from a broker took too long. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Indicates that an expected response from a broker took too long. + * </table> + */ public class AMQTimeoutException extends AMQException { public AMQTimeoutException(String message) diff --git a/java/common/src/main/java/org/apache/qpid/AMQUndeliveredException.java b/java/common/src/main/java/org/apache/qpid/AMQUndeliveredException.java index ad5aff7bb6..03220cc95e 100644 --- a/java/common/src/main/java/org/apache/qpid/AMQUndeliveredException.java +++ b/java/common/src/main/java/org/apache/qpid/AMQUndeliveredException.java @@ -7,9 +7,9 @@ * 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 @@ -23,7 +23,12 @@ package org.apache.qpid; import org.apache.qpid.protocol.AMQConstant; /** - * Generic AMQ exception. + * AMQUndeliveredException indicates that a message, marked immediate or mandatory, could not be delivered. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represents failure to delivery a message that must be delivered. + * </table> */ public class AMQUndeliveredException extends AMQException { @@ -40,7 +45,4 @@ public class AMQUndeliveredException extends AMQException { return _bounced; } - } - - diff --git a/java/common/src/main/java/org/apache/qpid/AMQUnknownExchangeType.java b/java/common/src/main/java/org/apache/qpid/AMQUnknownExchangeType.java index ed1d2e8beb..c4aa992a01 100644 --- a/java/common/src/main/java/org/apache/qpid/AMQUnknownExchangeType.java +++ b/java/common/src/main/java/org/apache/qpid/AMQUnknownExchangeType.java @@ -1,5 +1,18 @@ package org.apache.qpid;
+/**
+ * AMQUnknownExchangeType represents coding error where unknown exchange type requested from exchange factory.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represents unknown exchange type request.
+ * <tr><td>
+ *
+ * @todo Not an AMQP exception as no status code.
+ *
+ * @todo Represent coding error, where unknown exchange type is requested by passing a string parameter. Use a type safe
+ * enum for the exchange type, or replace with IllegalArgumentException. Should be runtime.
+ */
public class AMQUnknownExchangeType extends AMQException
{
public AMQUnknownExchangeType(String message)
diff --git a/java/common/src/main/java/org/apache/qpid/AMQUnresolvedAddressException.java b/java/common/src/main/java/org/apache/qpid/AMQUnresolvedAddressException.java index 2201903ded..6cc9c3fe00 100644 --- a/java/common/src/main/java/org/apache/qpid/AMQUnresolvedAddressException.java +++ b/java/common/src/main/java/org/apache/qpid/AMQUnresolvedAddressException.java @@ -7,9 +7,9 @@ * 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 @@ -20,6 +20,19 @@ */ package org.apache.qpid; +/** + * AMQUnresolvedAddressException indicates failure to resolve a socket address. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represents failre to resolve a socket address. + * </table> + * + * @todo Not an AMQP exception as no status code. + * + * @todo Why replace java.nio.UnresolvedAddressException with this? This is checked, which may explain why, but it + * doesn't wrap the underlying exception. + */ public class AMQUnresolvedAddressException extends AMQException { String _broker; @@ -32,6 +45,6 @@ public class AMQUnresolvedAddressException extends AMQException public String toString() { - return super.toString() + " Broker, \"" + _broker +"\""; + return super.toString() + " Broker, \"" + _broker + "\""; } } diff --git a/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java b/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java index 76225778e3..1e5cc57fff 100644 --- a/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java +++ b/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java @@ -32,8 +32,7 @@ import org.apache.qpid.protocol.AMQConstant; * <tr><td> Represent failure to expand a property name into a value. * </table> * - * @todo AMQException is to be reserved for protocol related conditions. This exception does not have a status code, so - * don't inherit from AMQException. + * @todo Not an AMQP exception as no status code. */ public class PropertyException extends AMQException { diff --git a/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java b/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java index 171da76771..cd5ccf8e04 100644 --- a/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java +++ b/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java @@ -23,13 +23,17 @@ package org.apache.qpid.framing; import org.apache.qpid.AMQException; import org.apache.qpid.protocol.AMQConstant; +/** + * AMQFrameDecodingException indicates that an AMQP frame cannot be decoded because it does not have the correct + * format as defined by the protocol. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represents a format error in a protocol frame. + * </table> + */ public class AMQFrameDecodingException extends AMQException { - /*public AMQFrameDecodingException(String message) - { - super(message); - }*/ - public AMQFrameDecodingException(AMQConstant errorCode, String message, Throwable t) { super(errorCode, message, t); diff --git a/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolClassException.java b/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolClassException.java index e6acad502f..e48fd2e7f9 100644 --- a/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolClassException.java +++ b/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolClassException.java @@ -7,9 +7,9 @@ * 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 @@ -20,10 +20,20 @@ */ package org.apache.qpid.framing; +/** + * AMQProtocolInstanceException indicates that the protocol class is incorrect in a header. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represent incorrect protocol class in frame header. + * </table> + * + * @todo Not an AMQP exception as no status code. + */ public class AMQProtocolClassException extends AMQProtocolHeaderException { - public AMQProtocolClassException(String message) - { - super(message); - } -}
\ No newline at end of file + public AMQProtocolClassException(String message) + { + super(message); + } +} diff --git a/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolHeaderException.java b/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolHeaderException.java index 888ed14faf..1ce49aba83 100644 --- a/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolHeaderException.java +++ b/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolHeaderException.java @@ -7,9 +7,9 @@ * 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 @@ -22,10 +22,20 @@ package org.apache.qpid.framing; import org.apache.qpid.AMQException; +/** + * AMQProtocolHeaderException indicates a format error in an AMQP frame header. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represent format error in frame header. + * </table> + * + * @todo Not an AMQP exception as no status code. + */ public class AMQProtocolHeaderException extends AMQException { - public AMQProtocolHeaderException(String message) - { - super(message); - } + public AMQProtocolHeaderException(String message) + { + super(message); + } } diff --git a/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolInstanceException.java b/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolInstanceException.java index c58979f876..9049eace2a 100644 --- a/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolInstanceException.java +++ b/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolInstanceException.java @@ -7,9 +7,9 @@ * 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 @@ -20,10 +20,20 @@ */ package org.apache.qpid.framing; +/** + * AMQProtocolInstanceException indicates that the protocol instance is incorrect in a header. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represent incorrect protocol instance in frame header. + * </table> + * + * @todo Not an AMQP exception as no status code. + */ public class AMQProtocolInstanceException extends AMQProtocolHeaderException { - public AMQProtocolInstanceException(String message) - { - super(message); - } + public AMQProtocolInstanceException(String message) + { + super(message); + } } diff --git a/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolVersionException.java b/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolVersionException.java index 7b326a0dc4..9074931617 100644 --- a/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolVersionException.java +++ b/java/common/src/main/java/org/apache/qpid/framing/AMQProtocolVersionException.java @@ -7,9 +7,9 @@ * 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 @@ -21,13 +21,19 @@ package org.apache.qpid.framing; /** - * Exception that is thrown when the client and server differ on expected protocol version (header) information. + * AMQProtocolInstanceException indicates that the client and server differ on expected protocol version in a header. + * + * <p/><table id="crc"><caption>CRC Card</caption> + * <tr><th> Responsibilities <th> Collaborations + * <tr><td> Represent incorrect protocol version in frame header. + * </table> * + * @todo Not an AMQP exception as no status code. */ public class AMQProtocolVersionException extends AMQProtocolHeaderException { - public AMQProtocolVersionException(String message) - { - super(message); - } + public AMQProtocolVersionException(String message) + { + super(message); + } } diff --git a/java/common/src/main/java/org/apache/qpid/pool/PoolingFilter.java b/java/common/src/main/java/org/apache/qpid/pool/PoolingFilter.java index 90c09ea99e..ffc8f1643a 100644 --- a/java/common/src/main/java/org/apache/qpid/pool/PoolingFilter.java +++ b/java/common/src/main/java/org/apache/qpid/pool/PoolingFilter.java @@ -68,7 +68,13 @@ import org.apache.qpid.pool.Event.CloseEvent; * @todo Why set an event limit of 10 on the Job? This also seems bizarre, as the job can have more than 10 events in * it. Its just that it runs them 10 at a time, but the completion hander here checks if there are more to run * and trips off another batch of 10 until they are all done. Why not just have a straight forward - * consumer/producer queue scenario without the batches of 10? + * consumer/producer queue scenario without the batches of 10? So instead of having many jobs with batches of 10 + * in them, just have one queue of events and worker threads taking the next event. There will be coordination + * between worker threads and new events arriving on the job anyway, so the simpler scenario may have the same + * amount of contention. I can see that the batches of 10 is done, so that no job is allowed to hog the worker + * pool for too long. I'm not convinced this fairly complex scheme will actually add anything, and it might be + * better to encapsulate it under a Queue interface anyway, so that different queue implementations can easily + * be substituted in. * * @todo The static helper methods are pointless. Could just call new. */ |