You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by mi...@apache.org on 2005/12/17 03:27:00 UTC
svn commit: r357275 -
/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java
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);