summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2010-05-28 15:21:24 -0700
committerMark Spruiell <mes@zeroc.com>2010-05-28 15:21:24 -0700
commit74581003486030ea874707085d5bf7cdce28f501 (patch)
treeb6007dfaeb37919c52e84dbd6454528e8b914a6f /java/src
parentBug 4754 - VS plugin properties not working with VS2010 (diff)
downloadice-74581003486030ea874707085d5bf7cdce28f501.tar.bz2
ice-74581003486030ea874707085d5bf7cdce28f501.tar.xz
ice-74581003486030ea874707085d5bf7cdce28f501.zip
bug 4714 - FreezeScript utilities do not work on an open environment
Diffstat (limited to 'java/src')
-rw-r--r--java/src/Freeze/SharedDbEnv.java25
-rw-r--r--java/src/IceInternal/PropertyNames.java3
2 files changed, 22 insertions, 6 deletions
diff --git a/java/src/Freeze/SharedDbEnv.java b/java/src/Freeze/SharedDbEnv.java
index 1bd5ccf232d..ccdf4821d29 100644
--- a/java/src/Freeze/SharedDbEnv.java
+++ b/java/src/Freeze/SharedDbEnv.java
@@ -280,15 +280,30 @@ public class SharedDbEnv implements com.sleepycat.db.ErrorHandler, Runnable
throw new DatabaseException("DbHome directory `" + dbHome + "' does not exists");
}
- dir = new java.io.File(dbHome + "/__Freeze");
- if(!dir.exists())
+ //
+ // Normally the file lock is necessary, but for read-only situations (such as when
+ // using the FreezeScript utilities) this property allows the file lock to be
+ // disabled.
+ //
+ if(properties.getPropertyAsIntWithDefault(propertyPrefix + ".LockFile", 1) > 0)
{
- if(!dir.mkdir())
+ //
+ // Use a file lock to prevent multiple processes from opening the same db env. We
+ // create the lock file in a sub-directory to ensure db_hotbackup won't try to copy
+ // the file when backing up the environment (this would fail on Windows where copying
+ // a locked file isn't possible).
+ //
+ dir = new java.io.File(dbHome + "/__Freeze");
+ if(!dir.exists())
{
- throw new DatabaseException("Failed to create directory `" + dbHome + "/__Freeze'");
+ if(!dir.mkdir())
+ {
+ throw new DatabaseException("Failed to create directory `" + dbHome + "/__Freeze'");
+ }
}
+ _fileLock = new IceUtilInternal.FileLock(dbHome + "/__Freeze/lock");
}
- _fileLock = new IceUtilInternal.FileLock(dbHome + "/__Freeze/lock");
+
try
{
if(_ownDbEnv)
diff --git a/java/src/IceInternal/PropertyNames.java b/java/src/IceInternal/PropertyNames.java
index 6e37c4cda7c..f8ba438a6bb 100644
--- a/java/src/IceInternal/PropertyNames.java
+++ b/java/src/IceInternal/PropertyNames.java
@@ -8,7 +8,7 @@
// **********************************************************************
//
-// Generated by makeprops.py from file ../config/PropertyNames.xml, Tue Dec 8 12:37:14 2009
+// Generated by makeprops.py from file ../config/PropertyNames.xml, Fri May 28 11:55:01 2010
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -588,6 +588,7 @@ public final class PropertyNames
new Property("Freeze\\.DbEnv\\.[^\\s]+\\.DbHome", false, null),
new Property("Freeze\\.DbEnv\\.[^\\s]+\\.DbPrivate", false, null),
new Property("Freeze\\.DbEnv\\.[^\\s]+\\.DbRecoverFatal", false, null),
+ new Property("Freeze\\.DbEnv\\.[^\\s]+\\.LockFile", false, null),
new Property("Freeze\\.DbEnv\\.[^\\s]+\\.OldLogsAutoDelete", false, null),
new Property("Freeze\\.DbEnv\\.[^\\s]+\\.PeriodicCheckpointMinSize", false, null),
new Property("Freeze\\.Evictor\\.[^\\s]+\\.BtreeMinKey", false, null),