db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
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 GMT
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);



Mime
View raw message