You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2016/11/16 21:58:21 UTC
svn commit: r1770065 - in /qpid/java/trunk/broker-core/src:
main/java/org/apache/qpid/server/model/Queue.java
main/java/org/apache/qpid/server/queue/AbstractQueue.java
test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java
Author: rgodfrey
Date: Wed Nov 16 21:58:21 2016
New Revision: 1770065
URL: http://svn.apache.org/viewvc?rev=1770065&view=rev
Log:
NO-JIRA : Suppress warnings and remove methods only used in tests of those methods
Modified:
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java
Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java?rev=1770065&r1=1770064&r2=1770065&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java Wed Nov 16 21:58:21 2016
@@ -82,14 +82,17 @@ public interface Queue<X extends Queue<X
String QUEUE_MINIMUM_ESTIMATED_MEMORY_FOOTPRINT = "queue.minimumEstimatedMemoryFootprint";
+ @SuppressWarnings("unused")
@ManagedContextDefault( name = QUEUE_MINIMUM_ESTIMATED_MEMORY_FOOTPRINT)
- long DEFAULT_MINIMUM_ESTIMATED_MEMORY_FOOTPRINT = 102400l;
+ long DEFAULT_MINIMUM_ESTIMATED_MEMORY_FOOTPRINT = 102400L;
String QUEUE_ESTIMATED_MESSAGE_MEMORY_OVERHEAD = "queue.estimatedMessageMemoryOverhead";
+ @SuppressWarnings("unused")
@ManagedContextDefault( name = QUEUE_ESTIMATED_MESSAGE_MEMORY_OVERHEAD)
- long DEFAULT_ESTIMATED_MESSAGE_MEMORY_OVERHEAD = 1024l;
+ long DEFAULT_ESTIMATED_MESSAGE_MEMORY_OVERHEAD = 1024L;
String QUEUE_SCAVANGE_COUNT = "qpid.queue.scavenge_count";
+ @SuppressWarnings("unused")
@ManagedContextDefault( name = QUEUE_SCAVANGE_COUNT)
int DEFAULT_QUEUE_SCAVANGE_COUNT = 50;
@@ -104,6 +107,7 @@ public interface Queue<X extends Queue<X
+ "\"image/tiff\":\".tiff\","
+ "\"text/plain\":\".txt\"}";
+ @SuppressWarnings("unused")
@ManagedContextDefault( name = "queue.defaultExclusivityPolicy",
description = "the ExclusivityPolicy to apply to queues where none is explicitly set")
String DEFAULT_EXCLUSIVITY = "NONE";
@@ -114,18 +118,21 @@ public interface Queue<X extends Queue<X
@ManagedAttribute( defaultValue = "${queue.defaultExclusivityPolicy}")
ExclusivityPolicy getExclusive();
+ @SuppressWarnings("unused")
@ManagedContextDefault( name = "queue.defaultEnsureNonDestructiveConsumers",
description = "the value to use for the ensureNondestructiveCnsumers attribute of a queue where "
+ "none is explicitly set")
String DEFAULT_ENSURE_NON_DESTRUCTIVE_CONSUMERS = "false";
+ @SuppressWarnings("unused")
@ManagedAttribute( defaultValue = "${queue.defaultEnsureNonDestructiveConsumers}" )
boolean isEnsureNondestructiveConsumers();
@DerivedAttribute( persist = true )
String getOwner();
+ @SuppressWarnings("unused")
@ManagedAttribute
boolean isNoLocal();
@@ -133,12 +140,14 @@ public interface Queue<X extends Queue<X
@ManagedAttribute
String getMessageGroupKey();
+ @SuppressWarnings("unused")
@ManagedContextDefault( name = "qpid.broker_default-shared-message-group")
String DEFAULT_SHARED_MESSAGE_GROUP = "qpid.no-group";
@ManagedAttribute( defaultValue = "${qpid.broker_default-shared-message-group}")
String getMessageGroupDefaultGroup();
+ @SuppressWarnings("unused")
@ManagedContextDefault( name = "queue.maximumDistinctGroups")
int DEFAULT_MAXIMUM_DISTINCT_GROUPS = 255;
@@ -148,60 +157,69 @@ public interface Queue<X extends Queue<X
@ManagedAttribute
boolean isMessageGroupSharedGroups();
+ @SuppressWarnings("unused")
@ManagedContextDefault( name = "queue.maximumDeliveryAttempts")
int DEFAULT_MAXIMUM_DELIVERY_ATTEMPTS = 0;
@ManagedAttribute( defaultValue = "${queue.maximumDeliveryAttempts}")
int getMaximumDeliveryAttempts();
+ @SuppressWarnings("unused")
@ManagedContextDefault( name = "queue.queueFlowControlSizeBytes")
- long DEFAULT_FLOW_CONTROL_SIZE_BYTES = 0l;
+ long DEFAULT_FLOW_CONTROL_SIZE_BYTES = 0L;
@ManagedAttribute( defaultValue = "${queue.queueFlowControlSizeBytes}")
long getQueueFlowControlSizeBytes();
+ @SuppressWarnings("unused")
@ManagedContextDefault( name = "queue.queueFlowResumeSizeBytes")
- long DEFAULT_FLOW_CONTROL_RESUME_SIZE_BYTES = 0l;
+ long DEFAULT_FLOW_CONTROL_RESUME_SIZE_BYTES = 0L;
@ManagedAttribute( defaultValue = "${queue.queueFlowResumeSizeBytes}")
long getQueueFlowResumeSizeBytes();
- // TODO - this is not an attribute
+ @SuppressWarnings("unused")
@DerivedAttribute
boolean isQueueFlowStopped();
+ @SuppressWarnings("unused")
@ManagedContextDefault( name = "queue.alertThresholdMessageAge")
- long DEFAULT_ALERT_THRESHOLD_MESSAGE_AGE = 0l;
+ long DEFAULT_ALERT_THRESHOLD_MESSAGE_AGE = 0L;
@ManagedAttribute( defaultValue = "${queue.alertThresholdMessageAge}")
long getAlertThresholdMessageAge();
+ @SuppressWarnings("unused")
@ManagedContextDefault( name = "queue.alertThresholdMessageSize")
- long DEFAULT_ALERT_THRESHOLD_MESSAGE_SIZE = 0l;
+ long DEFAULT_ALERT_THRESHOLD_MESSAGE_SIZE = 0L;
@ManagedAttribute( defaultValue = "${queue.alertThresholdMessageSize}")
long getAlertThresholdMessageSize();
+ @SuppressWarnings("unused")
@ManagedContextDefault( name = "queue.alertThresholdQueueDepthBytes")
- long DEFAULT_ALERT_THRESHOLD_QUEUE_DEPTH = 0l;
+ long DEFAULT_ALERT_THRESHOLD_QUEUE_DEPTH = 0L;
@ManagedAttribute( defaultValue = "${queue.alertThresholdQueueDepthBytes}")
long getAlertThresholdQueueDepthBytes();
+ @SuppressWarnings("unused")
@ManagedContextDefault( name = "queue.alertThresholdQueueDepthMessages")
- long DEFAULT_ALERT_THRESHOLD_MESSAGE_COUNT = 0l;
+ long DEFAULT_ALERT_THRESHOLD_MESSAGE_COUNT = 0L;
@ManagedAttribute( defaultValue = "${queue.alertThresholdQueueDepthMessages}")
long getAlertThresholdQueueDepthMessages();
+ @SuppressWarnings("unused")
@ManagedContextDefault( name = "queue.alertRepeatGap")
- long DEFAULT_ALERT_REPEAT_GAP = 30000l;
+ long DEFAULT_ALERT_REPEAT_GAP = 30000L;
@ManagedAttribute( defaultValue = "${queue.alertRepeatGap}")
long getAlertRepeatGap();
+ @SuppressWarnings("unused")
@ManagedContextDefault( name = "queue.defaultMessageDurability",
description = "the value to use for the messageDurability attribute of a queue where "
+ "none is explicitly set")
@@ -212,16 +230,20 @@ public interface Queue<X extends Queue<X
@ManagedAttribute( defaultValue = "${queue.defaultMessageDurability}" )
MessageDurability getMessageDurability();
+ @SuppressWarnings("unused")
@ManagedAttribute
long getMinimumMessageTtl();
+ @SuppressWarnings("unused")
@ManagedAttribute
long getMaximumMessageTtl();
+ @SuppressWarnings("unused")
@ManagedAttribute
Map<String, Map<String,List<String>>> getDefaultFilters();
+ @SuppressWarnings("unused")
@ManagedContextDefault( name = "queue.holdOnPublishEnabled")
boolean DEFAULT_HOLD_ON_PUBLISH_ENABLED = false;
@@ -250,69 +272,90 @@ public interface Queue<X extends Queue<X
void setNotificationListener(QueueNotificationListener listener);
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.COUNT, label = "Bindings")
int getBindingCount();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.COUNT, label = "Consumers")
int getConsumerCount();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.COUNT, label = "Consumers with credit")
int getConsumerCountWithCredit();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.BYTES, label = "Delivered (Persistent)")
long getPersistentDequeuedBytes();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.MESSAGES, label = "Delivered (Persistent)")
long getPersistentDequeuedMessages();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.BYTES, label = "Enqueued (Persistent)")
long getPersistentEnqueuedBytes();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.MESSAGES, label = "Enqueued (Persistent)")
long getPersistentEnqueuedMessages();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.BYTES, label = "Queue Depth")
long getQueueDepthBytes();
@ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.MESSAGES, label = "Queue Depth")
int getQueueDepthMessages();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.BYTES, label = "Delivered")
long getTotalDequeuedBytes();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.MESSAGES, label = "Delivered")
long getTotalDequeuedMessages();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.BYTES, label = "Enqueued")
long getTotalEnqueuedBytes();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.CUMULATIVE, units = StatisticUnit.MESSAGES, label = "Enqueued")
long getTotalEnqueuedMessages();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.MESSAGES, label = "Prefetched")
long getUnacknowledgedBytes();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.MESSAGES, label = "Prefetched")
long getUnacknowledgedMessages();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.BYTES, label = "Available")
long getAvailableBytes();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.MESSAGES, label = "Available")
int getAvailableMessages();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.BYTES, label = "Available HWM")
long getAvailableBytesHighWatermark();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.MESSAGES, label = "Available HWM")
int getAvailableMessagesHighWatermark();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.BYTES, label = "Queue Depth HWM")
long getQueueDepthBytesHighWatermark();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.MESSAGES, label = "Queue Depth HWM")
int getQueueDepthMessagesHighWatermark();
+ @SuppressWarnings("unused")
@ManagedStatistic(statisticType = StatisticType.POINT_IN_TIME, units = StatisticUnit.ABSOLUTE_TIME, label = "Oldest Message")
long getOldestMessageAge();
@@ -389,24 +432,9 @@ public interface Queue<X extends Queue<X
List<? extends QueueEntry> getMessagesOnTheQueue();
- List<Long> getMessagesOnTheQueue(int num);
-
- List<Long> getMessagesOnTheQueue(int num, int offset);
-
QueueEntry getMessageOnTheQueue(long messageId);
/**
- * Returns a list of QueEntries from a given range of queue positions, eg messages 5 to 10 on the queue.
- *
- * The 'queue position' index starts from 1. Using 0 in 'from' will be ignored and continue from 1.
- * Using 0 in the 'to' field will return an empty list regardless of the 'from' value.
- * @param fromPosition
- * @param toPosition
- * @return
- */
- List<? extends QueueEntry> getMessagesRangeOnTheQueue(long fromPosition, long toPosition);
-
- /**
* Checks the status of messages on the queue, purging expired ones, firing age related alerts etc.
*/
void checkMessageStatus();
Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java?rev=1770065&r1=1770064&r2=1770065&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java Wed Nov 16 21:58:21 2016
@@ -1494,7 +1494,7 @@ public abstract class AbstractQueue<X ex
return entries.isEmpty() ? null : entries.get(0);
}
- public List<QueueEntry> getMessagesOnTheQueue(QueueEntryFilter filter)
+ List<QueueEntry> getMessagesOnTheQueue(QueueEntryFilter filter)
{
ArrayList<QueueEntry> entryList = new ArrayList<QueueEntry>();
QueueEntryIterator queueListIterator = getEntries().iterator();
@@ -1549,35 +1549,6 @@ public abstract class AbstractQueue<X ex
}
}
- /**
- * Returns a list of QueueEntries from a given range of queue positions, eg messages 5 to 10 on the queue.
- *
- * The 'queue position' index starts from 1. Using 0 in 'from' will be ignored and continue from 1.
- * Using 0 in the 'to' field will return an empty list regardless of the 'from' value.
- * @param fromPosition first message position
- * @param toPosition last message position
- * @return list of messages
- */
- public List<QueueEntry> getMessagesRangeOnTheQueue(final long fromPosition, final long toPosition)
- {
- return getMessagesOnTheQueue(new QueueEntryFilter()
- {
- private long position = 0;
-
- public boolean accept(QueueEntry entry)
- {
- position++;
- return (position >= fromPosition) && (position <= toPosition);
- }
-
- public boolean filterComplete()
- {
- return position >= toPosition;
- }
- });
-
- }
-
// ------ Management functions
@Override
@@ -2516,28 +2487,6 @@ public abstract class AbstractQueue<X ex
}
}
- public List<Long> getMessagesOnTheQueue(int num)
- {
- return getMessagesOnTheQueue(num, 0);
- }
-
- public List<Long> getMessagesOnTheQueue(int num, int offset)
- {
- ArrayList<Long> ids = new ArrayList<Long>(num);
- QueueEntryIterator it = getEntries().iterator();
- for (int i = 0; i < offset; i++)
- {
- it.advance();
- }
-
- for (int i = 0; i < num && !it.atTail(); i++)
- {
- it.advance();
- ids.add(it.getNode().getMessage().getMessageNumber());
- }
- return ids;
- }
-
public long getTotalEnqueuedBytes()
{
return _queueStatistics.getEnqueueSize();
Modified: qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java?rev=1770065&r1=1770064&r2=1770065&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java (original)
+++ qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/queue/AbstractQueueTestBase.java Wed Nov 16 21:58:21 2016
@@ -61,7 +61,6 @@ import org.apache.qpid.server.model.Brok
import org.apache.qpid.server.model.Exchange;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.model.QueueNotificationListener;
-import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.queue.AbstractQueue.QueueEntryFilter;
import org.apache.qpid.server.store.TransactionLogResource;
import org.apache.qpid.server.util.Action;
@@ -94,7 +93,7 @@ abstract class AbstractQueueTestBase ext
attributes.put(Queue.NAME, _qname);
attributes.put(Queue.OWNER, _owner);
- _queue = _virtualHost.createChild(Queue.class, attributes);
+ _queue = (AbstractQueue<?>) _virtualHost.createChild(Queue.class, attributes);
_exchange = (DirectExchange) _virtualHost.getChildByName(Exchange.class, ExchangeDefaults.DIRECT_EXCHANGE_NAME);
}
@@ -616,126 +615,6 @@ abstract class AbstractQueueTestBase ext
assertNotNull(ex);
}
- public void testGetFirstMessageId() throws Exception
- {
- // Create message
- Long messageId = new Long(23);
- ServerMessage message = createMessage(messageId);
-
- // Put message on queue
- _queue.enqueue(message, null, null);
- // Get message id
- Long testmsgid = _queue.getMessagesOnTheQueue(1).get(0);
-
- // Check message id
- assertEquals("Message ID was wrong", messageId, testmsgid);
- }
-
- public void testGetFirstFiveMessageIds() throws Exception
- {
- for (int i = 0 ; i < 5; i++)
- {
- // Create message
- Long messageId = new Long(i);
- ServerMessage message = createMessage(messageId);
- // Put message on queue
- _queue.enqueue(message, null, null);
- }
- // Get message ids
- List<Long> msgids = _queue.getMessagesOnTheQueue(5);
-
- // Check message id
- for (int i = 0; i < 5; i++)
- {
- Long messageId = new Long(i);
- assertEquals("Message ID was wrong", messageId, msgids.get(i));
- }
- }
-
- public void testGetLastFiveMessageIds() throws Exception
- {
- for (int i = 0 ; i < 10; i++)
- {
- // Create message
- Long messageId = new Long(i);
- ServerMessage message = createMessage(messageId);
- // Put message on queue
- _queue.enqueue(message, null, null);
- }
- // Get message ids
- List<Long> msgids = _queue.getMessagesOnTheQueue(5, 5);
-
- // Check message id
- for (int i = 0; i < 5; i++)
- {
- Long messageId = new Long(i+5);
- assertEquals("Message ID was wrong", messageId, msgids.get(i));
- }
- }
-
- public void testGetMessagesRangeOnTheQueue() throws Exception
- {
- for (int i = 1 ; i <= 10; i++)
- {
- // Create message
- Long messageId = new Long(i);
- ServerMessage message = createMessage(messageId);
- // Put message on queue
- _queue.enqueue(message, null, null);
- }
-
- // Get non-existent 0th QueueEntry & check returned list was empty
- // (the position parameters in this method are indexed from 1)
- List<? extends QueueEntry> entries = _queue.getMessagesRangeOnTheQueue(0, 0);
- assertTrue(entries.size() == 0);
-
- // Check that when 'from' is 0 it is ignored and the range continues from 1
- entries = _queue.getMessagesRangeOnTheQueue(0, 2);
- assertTrue(entries.size() == 2);
- long msgID = entries.get(0).getMessage().getMessageNumber();
- assertEquals("Message ID was wrong", msgID, 1L);
- msgID = entries.get(1).getMessage().getMessageNumber();
- assertEquals("Message ID was wrong", msgID, 2L);
-
- // Check that when 'from' is greater than 'to' the returned list is empty
- entries = _queue.getMessagesRangeOnTheQueue(5, 4);
- assertTrue(entries.size() == 0);
-
- // Get first QueueEntry & check id
- entries = _queue.getMessagesRangeOnTheQueue(1, 1);
- assertTrue(entries.size() == 1);
- msgID = entries.get(0).getMessage().getMessageNumber();
- assertEquals("Message ID was wrong", msgID, 1L);
-
- // Get 5th,6th,7th entries and check id's
- entries = _queue.getMessagesRangeOnTheQueue(5, 7);
- assertTrue(entries.size() == 3);
- msgID = entries.get(0).getMessage().getMessageNumber();
- assertEquals("Message ID was wrong", msgID, 5L);
- msgID = entries.get(1).getMessage().getMessageNumber();
- assertEquals("Message ID was wrong", msgID, 6L);
- msgID = entries.get(2).getMessage().getMessageNumber();
- assertEquals("Message ID was wrong", msgID, 7L);
-
- // Get 10th QueueEntry & check id
- entries = _queue.getMessagesRangeOnTheQueue(10, 10);
- assertTrue(entries.size() == 1);
- msgID = entries.get(0).getMessage().getMessageNumber();
- assertEquals("Message ID was wrong", msgID, 10L);
-
- // Get non-existent 11th QueueEntry & check returned set was empty
- entries = _queue.getMessagesRangeOnTheQueue(11, 11);
- assertTrue(entries.size() == 0);
-
- // Get 9th,10th, and non-existent 11th entries & check result is of size 2 with correct IDs
- entries = _queue.getMessagesRangeOnTheQueue(9, 11);
- assertTrue(entries.size() == 2);
- msgID = entries.get(0).getMessage().getMessageNumber();
- assertEquals("Message ID was wrong", msgID, 9L);
- msgID = entries.get(1).getMessage().getMessageNumber();
- assertEquals("Message ID was wrong", msgID, 10L);
- }
-
/**
* Tests that dequeued message is not present in the list returned form
* {@link AbstractQueue#getMessagesOnTheQueue()}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org