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 20:21:59 UTC
svn commit: r805523 -
/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/io/DirFile4.java
Author: rhillegas
Date: Tue Aug 18 18:21:59 2009
New Revision: 805523
URL: http://svn.apache.org/viewvc?rev=805523&view=rev
Log:
DERBY-700: Port 805448 from trunk to 10.2 branch.
Modified:
db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/io/DirFile4.java
Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/io/DirFile4.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/io/DirFile4.java?rev=805523&r1=805522&r2=805523&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/io/DirFile4.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/io/DirFile4.java Tue Aug 18 18:21:59 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());
}
- }
+ } 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