db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject svn commit: rev 54681 - incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data
Date Tue, 12 Oct 2004 18:08:48 GMT
Author: mikem
Date: Tue Oct 12 11:08:47 2004
New Revision: 54681

Modified:
   incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
Log:
committing patch from  tsuresh@Source-Zone.org

Patch to fix following two issues reported in Derby-32:
1)   Exclusive file lock on dbex.lck  is  getting released before the
database is shutdown, allowing  multiple jvm's to boot the same database
in parallel
2)  Exclusive file lock on dbex.lck  is not released even when database
is shutdown.



Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
Tue Oct 12 11:08:47 2004
@@ -168,6 +168,7 @@
 
 	// lock against other JBMS opening the same database
 	private StorageRandomAccessFile fileLockOnDB;
+	private StorageFile exFileLock; //file handle to get exclusive lock
 	private HeaderPrintWriter istream;
 	private static final String LINE = 
 	"----------------------------------------------------------------";
@@ -1702,7 +1703,7 @@
             //about applying exclusive file lock mechanism 
             if(!throwDBlckException)
             {
-                StorageFile exFileLock = storageFactory.newStorageFile( DB_EX_LOCKFILE_NAME);
+                exFileLock = storageFactory.newStorageFile( DB_EX_LOCKFILE_NAME);
                 exLockStatus = exFileLock.getExclusiveFileLock();
             }
 
@@ -1804,10 +1805,15 @@
 
         if( storageFactory != null)
         {
-            StorageFile fileLock = storageFactory.newStorageFile( DB_LOCKFILE_NAME);
-
-            fileLock.releaseExclusiveFileLock();
+            StorageFile fileLock = storageFactory.newStorageFile(DB_LOCKFILE_NAME);
+            fileLock.delete();
         }
+
+		//release the lock that is acquired using tryLock() to prevent
+		//multiple jvm booting the same database on Unix environments.
+		if(exFileLock != null)
+			exFileLock.releaseExclusiveFileLock();
+
         return;
     } // end of privReleaseJBMSLockOnDB
         

Mime
View raw message