You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ba...@apache.org on 2005/09/07 12:39:01 UTC

svn commit: r279294 - /james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMailRepository.java

Author: bago
Date: Wed Sep  7 03:38:57 2005
New Revision: 279294

URL: http://svn.apache.org/viewcvs?rev=279294&view=rev
Log:
Changed the notification/synchronization policy in AvalonMailRepository.
I've ran a stress-test and it worked better than before, but the stresstest doesn't check correctness of the operations.

Modified:
    james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMailRepository.java

Modified: james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMailRepository.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMailRepository.java?rev=279294&r1=279293&r2=279294&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMailRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMailRepository.java Wed Sep  7 03:38:57 2005
@@ -64,8 +64,6 @@
      */
     protected final static boolean DEEP_DEBUG = false;
 
-    private static final String TYPE = "MAIL";
-
     private Lock lock;
     private Store store;
     private StreamRepository sr;
@@ -202,9 +200,9 @@
                             .append(new java.util.Date(System.currentTimeMillis()));
                 getLogger().debug(debugBuffer.toString());
             }
-//            synchronized (this) {
-//                notifyAll();
-//            }
+            synchronized (this) {
+                notify();
+            }
             return true;
         } else {
             return false;
@@ -250,11 +248,14 @@
         try {
             String key = mc.getName();
             //Remember whether this key was locked
-            boolean wasLocked = lock.isLocked(key);
-
-            if (!wasLocked) {
-                //If it wasn't locked, we want a lock during the store
-                lock.lock(key);
+            boolean wasLocked = true;
+            synchronized (this) {
+                wasLocked = lock.isLocked(key);
+    
+                if (!wasLocked) {
+                    //If it wasn't locked, we want a lock during the store
+                    lock.lock(key);
+                }
             }
             try {
                 if (keys != null && !keys.contains(key)) {



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org