manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1560411 - /manifoldcf/branches/CONNECTORS-867/framework/core/src/main/java/org/apache/manifoldcf/core/lockmanager/LockGate.java
Date Wed, 22 Jan 2014 16:47:41 GMT
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)



Mime
View raw message