summaryrefslogtreecommitdiff
path: root/java/broker
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2009-12-08 04:03:50 +0000
committerRobert Gemmell <robbie@apache.org>2009-12-08 04:03:50 +0000
commitcb3edd774a322d0b62776ff25f519ecfb08bd77f (patch)
treec6ed01e8ae4c24c8bea20a24fa13675687be0acc /java/broker
parent5d625b8c891840d11891e0d16de016a8f2c162ba (diff)
downloadqpid-python-cb3edd774a322d0b62776ff25f519ecfb08bd77f.tar.gz
QPID-2177: expose Capacity, FlowResumeCapacity, and FlowOverfull as attributes of the Queue MBeans
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@888248 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/broker')
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java2
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java35
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java6
-rw-r--r--java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java5
4 files changed, 47 insertions, 1 deletions
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 c9d20c53e4..a459c64946 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
@@ -186,7 +186,7 @@ public interface AMQQueue extends Managable, Comparable<AMQQueue>, ExchangeRefer
void setFlowResumeCapacity(long flowResumeCapacity);
-
+ boolean isOverfull();
void deleteMessageFromTop();
diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java
index eafc73dc97..021128d2fc 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueueMBean.java
@@ -241,6 +241,41 @@ public class AMQQueueMBean extends AMQManagedObject implements ManagedQueue, Que
return _queue.getQueueDepth();
}
+ public Long getCapacity()
+ {
+ return _queue.getCapacity();
+ }
+
+ public void setCapacity(Long capacity) throws IllegalArgumentException
+ {
+ if( _queue.getFlowResumeCapacity() > capacity )
+ {
+ throw new IllegalArgumentException("Capacity must not be less than FlowResumeCapacity");
+ }
+
+ _queue.setCapacity(capacity);
+ }
+
+ public Long getFlowResumeCapacity()
+ {
+ return _queue.getFlowResumeCapacity();
+ }
+
+ public void setFlowResumeCapacity(Long flowResumeCapacity) throws IllegalArgumentException
+ {
+ if( _queue.getCapacity() < flowResumeCapacity )
+ {
+ throw new IllegalArgumentException("FlowResumeCapacity must not exceed Capacity");
+ }
+
+ _queue.setFlowResumeCapacity(flowResumeCapacity);
+ }
+
+ public boolean isFlowOverfull()
+ {
+ return _queue.isOverfull();
+ }
+
/**
* Checks if there is any notification to be send to the listeners
*/
diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java b/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
index d7d0414936..b4cebda09a 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
@@ -1799,8 +1799,14 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener
public void setFlowResumeCapacity(long flowResumeCapacity)
{
_flowResumeCapacity = flowResumeCapacity;
+
+ checkCapacity();
}
+ public boolean isOverfull()
+ {
+ return _overfull.get();
+ }
public Set<NotificationCheck> getNotificationChecks()
{
diff --git a/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java b/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java
index 7c1f728664..910c7d42ed 100644
--- a/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java
+++ b/java/broker/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java
@@ -426,4 +426,9 @@ public class MockAMQQueue implements AMQQueue
{
return _name.toString();
}
+
+ public boolean isOverfull()
+ {
+ return false;
+ }
}