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 rh...@apache.org on 2009/08/18 18:37:29 UTC

svn commit: r805486 - in /db/derby/code/branches/10.3/java: engine/org/apache/derby/impl/io/ testing/org/apache/derbyTesting/functionTests/tests/store/ testing/org/apache/derbyTesting/junit/

Author: rhillegas
Date: Tue Aug 18 16:37:29 2009
New Revision: 805486

URL: http://svn.apache.org/viewvc?rev=805486&view=rev
Log:
DERBY-700: Port 805448 from trunk to the 10.3 branch.

Added:
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/store/ClassLoaderBootTest.java
      - copied unchanged from r805448, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/ClassLoaderBootTest.java
Modified:
    db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/io/DirFile4.java
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/JDBC.java

Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/io/DirFile4.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/io/DirFile4.java?rev=805486&r1=805485&r2=805486&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/io/DirFile4.java (original)
+++ db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/io/DirFile4.java Tue Aug 18 16:37:29 2009
@@ -33,6 +33,7 @@
 import java.io.RandomAccessFile;
 import java.nio.channels.FileChannel;
 import java.nio.channels.FileLock;
+import java.nio.channels.OverlappingFileLockException;
 
 /**
  * This class implements the StorageFile interface using features of Java 1.4 not available in earlier
@@ -186,7 +187,31 @@
 				SanityManager.THROWASSERT("Unable to Acquire Exclusive Lock on "
 										  + getPath(), ioe);
 			}
-		}
+		} catch (OverlappingFileLockException ofle)
+        {
+            //
+            // Under Java 6 and later, this exception is raised if the database
+            // has been opened by another Derby instance in a different
+            // ClassLoader in this VM. See DERBY-700.
+            //
+            // The OverlappingFileLockException is raised by the
+            // lockFileChannel.tryLock() call above.
+            //
+            try {
+                lockFileChannel.close();
+                lockFileOpen.close();
+            } catch (IOException e)
+            {
+                if (SanityManager.DEBUG)
+                {
+                    SanityManager.THROWASSERT("Error closing file channel "
+                                              + getPath(), e);
+                }
+            }
+            lockFileChannel=null;
+            lockFileOpen = null;
+            status = EXCLUSIVE_FILE_LOCK_NOT_AVAILABLE;
+        }
     
 		return status;
 	} // end of getExclusiveFileLock

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java?rev=805486&r1=805485&r2=805486&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java Tue Aug 18 16:37:29 2009
@@ -52,7 +52,7 @@
         TestSuite suite = new TestSuite("store");
         
         suite.addTest(BootAllTest.suite());
-
+        suite.addTest(ClassLoaderBootTest.suite());
         suite.addTest(Derby3625Test.suite());
         suite.addTest(PositionedStoreStreamTest.suite());
         suite.addTest(OfflineBackupTest.suite());

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/JDBC.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/JDBC.java?rev=805486&r1=805485&r2=805486&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/JDBC.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/JDBC.java Tue Aug 18 16:37:29 2009
@@ -1,6 +1,6 @@
 /*
  *
- * Derby - Class org.apache.derbyTesting.functionTests.util.JDBC
+ * Derby - Class org.apache.derbyTesting.junit.JDBC
  *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with