activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r509115 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
Date Mon, 19 Feb 2007 06:57:00 GMT
Author: rajdavies
Date: Sun Feb 18 22:56:59 2007
New Revision: 509115

URL: http://svn.apache.org/viewvc?view=rev&rev=509115
Log:
fix some synchronization problems

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java?view=diff&rev=509115&r1=509114&r2=509115
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/FilePendingMessageCursor.java
Sun Feb 18 22:56:59 2007
@@ -46,7 +46,7 @@
     private ListContainer diskList;
     private Iterator iter=null;
     private Destination regionDestination;
-    private AtomicBoolean iterating=new AtomicBoolean();
+    private boolean iterating;
     private boolean flushRequired;
     private AtomicBoolean started=new AtomicBoolean();
 
@@ -88,14 +88,12 @@
      * 
      */
     public synchronized void reset(){
-        synchronized(iterating){
-            iterating.set(true);
-        }
+        iterating=true;
         iter=isDiskListEmpty()?memoryList.iterator():getDiskList().listIterator();
     }
 
     public synchronized void release(){
-        iterating.set(false);
+        iterating=false;
         if(flushRequired){
             flushRequired=false;
             flushToDisk();
@@ -246,9 +244,9 @@
 
     public void onMemoryUseChanged(UsageManager memoryManager,int oldPercentUsage,int newPercentUsage){
         if(newPercentUsage>=getMemoryUsageHighWaterMark()){
-            synchronized(iterating){
+            synchronized(this){
                 flushRequired=true;
-                if(!iterating.get()){
+                if(!iterating){
                     flushToDisk();
                     flushRequired=false;
                 }



Mime
View raw message