james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r980726 - /james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxPathLock.java
Date Fri, 30 Jul 2010 10:42:20 GMT
Author: norman
Date: Fri Jul 30 10:42:20 2010
New Revision: 980726

URL: http://svn.apache.org/viewvc?rev=980726&view=rev
Log:
Just improve javadocs and synchronize as short as possible

Modified:
    james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxPathLock.java

Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxPathLock.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxPathLock.java?rev=980726&r1=980725&r2=980726&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxPathLock.java
(original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MailboxPathLock.java
Fri Jul 30 10:42:20 2010
@@ -41,7 +41,8 @@ public final class MailboxPathLock {
     private final Map<MailboxPath, ReentrantLock> paths = new HashMap<MailboxPath,
ReentrantLock>();
     
     /**
-     * Obtain a {@link Lock} for the given path
+     * Obtain a {@link Lock} for the given path. It will block if the lock for the {@link
MailboxPath} is
+     * already held by some other thread 
      * 
      * @param path
      */
@@ -64,11 +65,12 @@ public final class MailboxPathLock {
      * @param path
      */
     public void unlock(MailboxPath path) {
+        ReentrantLock lock;
         synchronized (paths) {
-            ReentrantLock lock = paths.remove(path);
-            if (lock != null) {
-                lock.unlock();
-            }
+            lock = paths.remove(path);
+        }
+        if (lock != null) {
+            lock.unlock();
         }
     }
 }



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


Mime
View raw message