activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r390041 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
Date Thu, 30 Mar 2006 09:15:49 GMT
Author: jstrachan
Date: Thu Mar 30 01:15:47 2006
New Revision: 390041

URL: http://svn.apache.org/viewcvs?rev=390041&view=rev
Log:
removed a couple of possible concurrent accesses of the message collection

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java

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=390041&r1=390040&r2=390041&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
Thu Mar 30 01:15:47 2006
@@ -98,7 +98,9 @@
                 public void recoverMessage(Message message) {
                     message.setRegionDestination(Queue.this);
                     MessageReference reference = createMessageReference(message);
-                    messages.add(reference);
+                    synchronized (messages) {
+                        messages.add(reference);
+                    }
                     reference.decrementReferenceCount();
                     destinationStatistics.getMessages().increment();
                 }
@@ -326,8 +328,12 @@
     }
 
     public String toString() {
+        int size = 0;
+        synchronized (messages) {
+            size = message.size();
+        }
         return "Queue: destination=" + destination.getPhysicalName() + ", subscriptions="
+ consumers.size()
-                + ", memory=" + usageManager.getPercentUsage() + "%, size=" + messages.size()
+ ", in flight groups="
+                + ", memory=" + usageManager.getPercentUsage() + "%, size=" + size + ", in
flight groups="
                 + messageGroupOwners;
     }
 



Mime
View raw message