activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r386199 - in /incubator/activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/jmx/ main/java/org/apache/activemq/broker/region/ main/java/org/apache/activemq/broker/region/policy/ test/java/org/apache/activemq/transport/stomp/
Date Wed, 15 Mar 2006 22:45:39 GMT
Author: chirino
Date: Wed Mar 15 14:45:38 2006
New Revision: 386199

URL: http://svn.apache.org/viewcvs?rev=386199&view=rev
Log:
Applied patch in http://jira.activemq.org/jira/browse/AMQ-633
Thanks Brian Diesenhaus!

Also exposed the memory limits and usage via JMX and allowed the limit to be configured via
a destination policy.


Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationView.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationViewMBean.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationView.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationView.java?rev=386199&r1=386198&r2=386199&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationView.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationView.java
Wed Mar 15 14:45:38 2006
@@ -73,6 +73,16 @@
         return destination.getDestinationStatistics().getMessagesCached().getCount();
     }
 
+    public int getMemoryPercentageUsed() {
+        return destination.getUsageManager().getPercentUsage();
+    }
+    public long getMemoryLimit() {
+        return destination.getUsageManager().getLimit();
+    }
+    public void setMemoryLimit(long limit) {
+        destination.getUsageManager().setLimit(limit);
+    }
+
     public CompositeData[] browse() throws OpenDataException{
         Message[] messages=destination.browse();
         CompositeData c[]=new CompositeData[messages.length];

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationViewMBean.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationViewMBean.java?rev=386199&r1=386198&r2=386199&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationViewMBean.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/DestinationViewMBean.java
Wed Mar 15 14:45:38 2006
@@ -76,4 +76,9 @@
      * @throws Exception
      */
     public String sendTextMessage(Map headers, String body) throws Exception;
+
+    public int getMemoryPercentageUsed();
+    public long getMemoryLimit();
+    public void setMemoryLimit(long limit);
+
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java?rev=386199&r1=386198&r2=386199&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
Wed Mar 15 14:45:38 2006
@@ -79,7 +79,9 @@
     public Queue(ActiveMQDestination destination, final UsageManager memoryManager, MessageStore
store,
             DestinationStatistics parentStats, TaskRunnerFactory taskFactory) throws Exception
{
         this.destination = destination;
-        this.usageManager = memoryManager;
+        this.usageManager = new UsageManager(memoryManager);
+        this.usageManager.setLimit(Long.MAX_VALUE);
+        
         this.store = store;
 
         destinationStatistics.setParent(parentStats);

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java?rev=386199&r1=386198&r2=386199&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Topic.java
Wed Mar 15 14:45:38 2006
@@ -73,7 +73,8 @@
 
         this.destination = destination;
         this.store = store;
-        this.usageManager = memoryManager;
+        this.usageManager = new UsageManager(memoryManager);
+        this.usageManager.setLimit(Long.MAX_VALUE);
         this.destinationStatistics.setParent(parentStats);
     }
 

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java?rev=386199&r1=386198&r2=386199&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/PolicyEntry.java
Wed Mar 15 14:45:38 2006
@@ -42,6 +42,7 @@
     private int messageGroupHashBucketCount = 1024;
     private PendingMessageLimitStrategy pendingMessageLimitStrategy;
     private MessageEvictionStrategy messageEvictionStrategy;
+    private long memoryLimit;
 
     public void configure(Queue queue) {
         if (dispatchPolicy != null) {
@@ -51,6 +52,9 @@
             queue.setDeadLetterStrategy(deadLetterStrategy);
         }
         queue.setMessageGroupHashBucketCount(messageGroupHashBucketCount);
+        if( memoryLimit>0 ) {
+            queue.getUsageManager().setLimit(memoryLimit);
+        }
     }
 
     public void configure(Topic topic) {
@@ -64,6 +68,9 @@
             topic.setSubscriptionRecoveryPolicy(subscriptionRecoveryPolicy);
         }
         topic.setSendAdvisoryIfNoConsumers(sendAdvisoryIfNoConsumers);
+        if( memoryLimit>0 ) {
+            topic.getUsageManager().setLimit(memoryLimit);
+        }
     }
 
     public void configure(TopicSubscription subscription) {
@@ -171,6 +178,14 @@
      */
     public void setMessageEvictionStrategy(MessageEvictionStrategy messageEvictionStrategy)
{
         this.messageEvictionStrategy = messageEvictionStrategy;
+    }
+
+    public long getMemoryLimit() {
+        return memoryLimit;
+    }
+
+    public void setMemoryLimit(long memoryLimit) {
+        this.memoryLimit = memoryLimit;
     }
 
 }

Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java?rev=386199&r1=386198&r2=386199&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
Wed Mar 15 14:45:38 2006
@@ -56,7 +56,7 @@
         broker.start();
         
         URI connectUri = connector.getConnectUri();
-        stompSocket = new Socket(connectUri.getHost(), connectUri.getPort());
+        stompSocket = new Socket("127.0.0.1", connectUri.getPort());
         inputBuffer = new ByteArrayOutputStream();
         
         ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost");



Mime
View raw message