You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2014/01/22 17:47:41 UTC

svn commit: r1560411 - /manifoldcf/branches/CONNECTORS-867/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/LockGate.java

Author: kwright
Date: Wed Jan 22 16:47:41 2014
New Revision: 1560411

URL: http://svn.apache.org/r1560411
Log:
Be more consistent about cleaning up on error.

Modified:
    manifoldcf/branches/CONNECTORS-867/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/LockGate.java

Modified: manifoldcf/branches/CONNECTORS-867/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/LockGate.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-867/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/LockGate.java?rev=1560411&r1=1560410&r2=1560411&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-867/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/LockGate.java (original)
+++ manifoldcf/branches/CONNECTORS-867/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/LockGate.java Wed Jan 22 16:47:41 2014
@@ -75,21 +75,43 @@ public class LockGate
     {
       threadRequests.add(threadID);
     }
-    
-    // Now, wait until we are #1
-    while (true)
+    try
     {
-      synchronized (this)
+      // Now, wait until we are #1
+      while (true)
       {
-        if (lockPool == null)
-          throw new ExpiredObjectException("Invalid");
+        synchronized (this)
+        {
+          if (lockPool == null)
+            throw new ExpiredObjectException("Invalid");
 
-        if (threadRequests.get(0).equals(threadID))
-          return;
-        
-        wait();
+          if (threadRequests.get(0).equals(threadID))
+            return;
+          
+          wait();
+        }
       }
     }
+    catch (InterruptedException e)
+    {
+      threadRequests.remove(threadID);
+      throw e;
+    }
+    catch (ExpiredObjectException e)
+    {
+      threadRequests.remove(threadID);
+      throw e;
+    }
+    catch (Error e)
+    {
+      threadRequests.remove(threadID);
+      throw e;
+    }
+    catch (RuntimeException e)
+    {
+      threadRequests.remove(threadID);
+      throw e;
+    }
   }
   
   protected void freePermission(Long threadID)