activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r661224 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker: jmx/ region/cursors/
Date Thu, 29 May 2008 06:41:36 GMT
Author: rajdavies
Date: Wed May 28 23:41:35 2008
New Revision: 661224

URL: http://svn.apache.org/viewvc?rev=661224&view=rev
Log:
Fix for https://issues.apache.org/activemq/browse/AMQ-1755

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationView.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationViewMBean.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionView.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/InactiveDurableSubscriptionView.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueView.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueViewMBean.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/PendingMessageCursor.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationView.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationView.java?rev=661224&r1=661223&r2=661224&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationView.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationView.java
Wed May 28 23:41:35 2008
@@ -37,6 +37,7 @@
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.jmx.OpenTypeSupport.OpenTypeFactory;
 import org.apache.activemq.broker.region.Destination;
+import org.apache.activemq.broker.region.Queue;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQMessage;
 import org.apache.activemq.command.ActiveMQTextMessage;
@@ -317,5 +318,21 @@
     public void setProducerFlowControl(boolean producerFlowControl) {
       destination.setProducerFlowControl(producerFlowControl);      
     }
+
+    public int getMaxPageSize() {
+        return destination.getMaxPageSize();
+    }
+    
+    public void setMaxPageSize(int pageSize) {
+        destination.setMaxPageSize(pageSize);
+    }
+    
+    public boolean isUseCache() {
+        return destination.isUseCache();
+    }
+
+    public void setUseCache(boolean value) {
+        destination.setUseCache(value);    
+    }
   
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationViewMBean.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationViewMBean.java?rev=661224&r1=661223&r2=661224&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationViewMBean.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationViewMBean.java
Wed May 28 23:41:35 2008
@@ -214,5 +214,28 @@
      * @param maxAuditDepth the maxAuditDepth to set
      */
     public void setMaxAuditDepth(int maxAuditDepth);
+    
+    /**
+     * @return the maximum number of message to be paged into the 
+     * destination
+     */
+    public int getMaxPageSize();
+    
+    /**
+     * @param pageSize
+     * Set the maximum number of messages to page into the destination
+     */
+    public void setMaxPageSize(int pageSize);
+    
+    /**
+     * @return true if caching is enabled of for the destination
+     */
+    public boolean isUseCache();
+    
+    /**
+     * @param value
+     * enable/disable caching on the destination
+     */
+    public void setUseCache(boolean value);
 
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionView.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionView.java?rev=661224&r1=661223&r2=661224&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionView.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionView.java
Wed May 28 23:41:35 2008
@@ -21,6 +21,7 @@
 import javax.management.openmbean.TabularData;
 
 import org.apache.activemq.broker.ConnectionContext;
+import org.apache.activemq.broker.region.DurableTopicSubscription;
 import org.apache.activemq.broker.region.Subscription;
 import org.apache.activemq.command.RemoveSubscriptionInfo;
 
@@ -31,6 +32,7 @@
 
     protected ManagedRegionBroker broker;
     protected String subscriptionName;
+    protected DurableTopicSubscription durableSub;
 
     /**
      * Constructor
@@ -41,6 +43,7 @@
     public DurableSubscriptionView(ManagedRegionBroker broker, String clientId, Subscription
sub) {
         super(clientId, sub);
         this.broker = broker;
+        this.durableSub=(DurableTopicSubscription) sub;
         this.subscriptionName = sub.getConsumerInfo().getSubscriptionName();
     }
 
@@ -86,6 +89,55 @@
     }
 
     public String toString() {
-        return "InactiveDurableSubscriptionView: " + getClientId() + ":" + getSubscriptionName();
+        return "ActiveDurableSubscriptionView: " + getClientId() + ":" + getSubscriptionName();
+    }
+
+    
+    public int cursorSize() {
+        if (durableSub != null && durableSub.getPending() != null) {
+            return durableSub.getPending().size();
+        }
+        return 0;
+    }
+
+   
+    public boolean doesCursorHaveMessagesBuffered() {
+        if (durableSub != null && durableSub.getPending() != null) {
+            return durableSub.getPending().hasMessagesBufferedToDeliver();
+        }
+        return false;
+    }
+
+   
+    public boolean doesCursorHaveSpace() {
+        if (durableSub != null && durableSub.getPending() != null) {
+            return durableSub.getPending().hasSpace();
+        }
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.activemq.broker.jmx.DurableSubscriptionViewMBean#getCursorMemoryUsage()
+     */
+    public long getCursorMemoryUsage() {
+        if (durableSub != null && durableSub.getPending() != null && durableSub.getPending().getSystemUsage()!=null)
{
+            return durableSub.getPending().getSystemUsage().getMemoryUsage().getUsage();
+        }
+        return 0;
+    }
+
+    
+    public int getCursorPercentUsage() {
+        if (durableSub != null && durableSub.getPending() != null && durableSub.getPending().getSystemUsage()!=null)
{
+            return durableSub.getPending().getSystemUsage().getMemoryUsage().getPercentUsage();
+        }
+        return 0;
+    }
+
+    public boolean isCursorFull() {
+        if (durableSub != null && durableSub.getPending() != null) {
+            return durableSub.getPending().isFull();
+        }
+        return false;
     }
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java?rev=661224&r1=661223&r2=661224&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java
Wed May 28 23:41:35 2008
@@ -50,4 +50,37 @@
      * stored for this subscription
      */
     void destroy() throws Exception;
+    
+    /**
+     * @return true if the message cursor has memory space available
+     * to page in more messages
+     */
+    public boolean doesCursorHaveSpace();
+    
+    /**
+     * @return true if the cursor has reached its memory limit for
+     * paged in messages
+     */
+    public boolean isCursorFull();
+    
+    /**
+     * @return true if the cursor has messages buffered to deliver
+     */
+    public boolean doesCursorHaveMessagesBuffered();
+    
+    /**
+     * @return the cursor memory usage in bytes
+     */
+    public long getCursorMemoryUsage();
+    
+    /**
+     * @return the cursor memory usage as a percentage
+     */
+    public int getCursorPercentUsage();
+    
+    /**
+     * @return the number of messages available to be paged in 
+     * by the cursor
+     */
+    public int cursorSize();
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/InactiveDurableSubscriptionView.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/InactiveDurableSubscriptionView.java?rev=661224&r1=661223&r2=661224&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/InactiveDurableSubscriptionView.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/InactiveDurableSubscriptionView.java
Wed May 28 23:41:35 2008
@@ -25,12 +25,10 @@
 import org.apache.activemq.command.SubscriptionInfo;
 
 /**
- * TODO why does this class not inherit from DurableSubscriptionView?
  * 
  * @version $Revision: 1.5 $
  */
-public class InactiveDurableSubscriptionView extends SubscriptionView implements DurableSubscriptionViewMBean
{
-    protected ManagedRegionBroker broker;
+public class InactiveDurableSubscriptionView extends DurableSubscriptionView implements DurableSubscriptionViewMBean
{
     protected SubscriptionInfo subscriptionInfo;
 
     /**
@@ -41,7 +39,7 @@
      * @param sub
      */
     public InactiveDurableSubscriptionView(ManagedRegionBroker broker, String clientId, SubscriptionInfo
sub) {
-        super(clientId, null);
+        super(broker,clientId, null);
         this.broker = broker;
         this.subscriptionInfo = sub;
     }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueView.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueView.java?rev=661224&r1=661223&r2=661224&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueView.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueView.java
Wed May 28 23:41:35 2008
@@ -92,4 +92,56 @@
         return ((Queue)destination).moveMatchingMessagesTo(context, selector, toDestination,
maximumMessages);
     }
 
+    
+    public int cursorSize() {
+        Queue queue = (Queue) destination;
+        if (queue.getMessages() != null){
+            return queue.getMessages().size();
+        }
+        return 0;
+    }
+
+   
+    public boolean doesCursorHaveMessagesBuffered() {
+       Queue queue = (Queue) destination;
+       if (queue.getMessages() != null){
+           return queue.getMessages().hasMessagesBufferedToDeliver();
+       }
+       return false;
+
+    }
+
+    
+    public boolean doesCursorHaveSpace() {
+        Queue queue = (Queue) destination;
+        if (queue.getMessages() != null){
+            return queue.getMessages().hasSpace();
+        }
+        return false;
+    }
+
+    
+    public long getCursorMemoryUsage() {
+        Queue queue = (Queue) destination;
+        if (queue.getMessages() != null &&  queue.getMessages().getSystemUsage()
!= null){
+            return queue.getMessages().getSystemUsage().getMemoryUsage().getUsage();
+        }
+        return 0;
+    }
+
+    public int getCursorPercentUsage() {
+        Queue queue = (Queue) destination;
+        if (queue.getMessages() != null &&  queue.getMessages().getSystemUsage()
!= null){
+            return queue.getMessages().getSystemUsage().getMemoryUsage().getPercentUsage();
+        }
+        return 0;
+    }
+
+    public boolean isCursorFull() {
+        Queue queue = (Queue) destination;
+        if (queue.getMessages() != null){
+            return queue.getMessages().isFull();
+        }
+        return false;
+    }
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueViewMBean.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueViewMBean.java?rev=661224&r1=661223&r2=661224&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueViewMBean.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/QueueViewMBean.java
Wed May 28 23:41:35 2008
@@ -112,5 +112,38 @@
      * of matched messages
      */
     int moveMatchingMessagesTo(String selector, String destinationName, int maximumMessages)
throws Exception;
-
+    
+    /**
+     * @return true if the message cursor has memory space available
+     * to page in more messages
+     */
+    public boolean doesCursorHaveSpace();
+    
+    /**
+     * @return true if the cursor has reached its memory limit for
+     * paged in messages
+     */
+    public boolean isCursorFull();
+    
+    /**
+     * @return true if the cursor has messages buffered to deliver
+     */
+    public boolean doesCursorHaveMessagesBuffered();
+    
+    /**
+     * @return the cursor memory usage in bytes
+     */
+    public long getCursorMemoryUsage();
+    
+    /**
+     * @return the cursor memory usage as a percentage
+     */
+    public int getCursorPercentUsage();
+    
+    /**
+     * @return the number of messages available to be paged in 
+     * by the cursor
+     */
+    public int cursorSize();
+    
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/PendingMessageCursor.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/PendingMessageCursor.java?rev=661224&r1=661223&r2=661224&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/PendingMessageCursor.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/PendingMessageCursor.java
Wed May 28 23:41:35 2008
@@ -19,14 +19,11 @@
 import java.io.IOException;
 import java.util.LinkedList;
 import java.util.List;
-
 import org.apache.activemq.ActiveMQMessageAudit;
 import org.apache.activemq.Service;
 import org.apache.activemq.broker.ConnectionContext;
 import org.apache.activemq.broker.region.Destination;
 import org.apache.activemq.broker.region.MessageReference;
-import org.apache.activemq.broker.region.QueueMessageReference;
-import org.apache.activemq.command.MessageId;
 import org.apache.activemq.usage.SystemUsage;
 
 /**
@@ -194,6 +191,11 @@
      * @return true if the cursor is full
      */
     boolean isFull();
+    
+    /**
+     * @return true if the cursor has space to page messages into
+     */
+    public boolean hasSpace();
 
     /**
      * @return true if the cursor has buffered messages ready to deliver
@@ -280,6 +282,5 @@
      * @return true if a cache is being used
      */
     public boolean isUseCache();
-
-
+   
 }



Mime
View raw message