Return-Path: X-Original-To: apmail-manifoldcf-commits-archive@www.apache.org Delivered-To: apmail-manifoldcf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 30A9310202 for ; Wed, 22 Jan 2014 16:48:04 +0000 (UTC) Received: (qmail 62155 invoked by uid 500); 22 Jan 2014 16:48:03 -0000 Delivered-To: apmail-manifoldcf-commits-archive@manifoldcf.apache.org Received: (qmail 62103 invoked by uid 500); 22 Jan 2014 16:48:03 -0000 Mailing-List: contact commits-help@manifoldcf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@manifoldcf.apache.org Delivered-To: mailing list commits@manifoldcf.apache.org Received: (qmail 62095 invoked by uid 99); 22 Jan 2014 16:48:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jan 2014 16:48:03 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jan 2014 16:48:01 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id DE09423889CB; Wed, 22 Jan 2014 16:47:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@manifoldcf.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140122164741.DE09423889CB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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)