From derby-commits-return-1949-apmail-db-derby-commits-archive=db.apache.org@db.apache.org Sat Dec 17 02:27:23 2005 Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 31446 invoked from network); 17 Dec 2005 02:27:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 17 Dec 2005 02:27:23 -0000 Received: (qmail 41383 invoked by uid 500); 17 Dec 2005 02:27:23 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 41320 invoked by uid 500); 17 Dec 2005 02:27:22 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 41309 invoked by uid 99); 17 Dec 2005 02:27:22 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Dec 2005 18:27:22 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 16 Dec 2005 18:27:22 -0800 Received: (qmail 31050 invoked by uid 65534); 17 Dec 2005 02:27:01 -0000 Message-ID: <20051217022701.31049.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r357275 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java Date: Sat, 17 Dec 2005 02:27:00 -0000 To: derby-commits@db.apache.org From: mikem@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: mikem Date: Fri Dec 16 18:26:40 2005 New Revision: 357275 URL: http://svn.apache.org/viewcvs?rev=357275&view=rev Log: DERBY-733, committed on behalf of Knut Anders Hatlen. Attached patch (DERBY-733-more-exception-handling.diff) that addresses Mike's concerns for exception handling. If something goes wrong when locking, Derby will now fall back to the old behaviour. Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java?rev=357275&r1=357274&r2=357275&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java Fri Dec 16 18:26:40 2005 @@ -148,6 +148,9 @@ fairLockConstructor.newInstance( new Object[] { Boolean.TRUE }); } catch (Exception e) { + // couldn't construct the lock, fall back to old behaviour + + hasJava5FairLocks = false; if (SanityManager.DEBUG) { SanityManager.THROWASSERT( "failed constructing ReentrantLock", e); @@ -286,6 +289,11 @@ try { lock.invoke(fairLock, null); } catch (Exception e) { + // Something bad happened while trying to lock the + // region. Since the locking is not required for + // anything other than ensuring fairness, it is ok to + // fall back to pre-1.5 behaviour. + hasJava5FairLocks = false; if (SanityManager.DEBUG) { SanityManager.THROWASSERT( "failed invoking ReentrantLock.lock()", e); @@ -308,6 +316,13 @@ try { unlock.invoke(fairLock, null); } catch (Exception e) { + // An error occurred while unlocking the + // region. The region might still be locked, so + // we'd better stop using this kind of + // locking. There will be no loss of + // functionality, only a possible loss of + // fairness. + hasJava5FairLocks = false; if (SanityManager.DEBUG) { SanityManager.THROWASSERT( "failed invoking ReentrantLock.unlock()", e);