|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.store.FileLock
public class FileLock
The file lock is used to lock a database so that only one process can write to it. It uses a cooperative locking protocol. Usually a .lock.db file is used, but locking by creating a socket is supported as well.
Field Summary | |
---|---|
static int |
LOCK_FILE
This locking method means the cooperative file locking protocol should be used. |
static int |
LOCK_NO
This locking method means no locking is used at all. |
static int |
LOCK_SERIALIZED
This locking method means multiple writers are allowed, and they synchronize themselves. |
static int |
LOCK_SOCKET
This locking method means a socket is created on the given machine. |
Constructor Summary | |
---|---|
FileLock(TraceSystem traceSystem,
java.lang.String fileName,
int sleep)
Create a new file locking object. |
Method Summary | |
---|---|
static int |
getFileLockMethod(java.lang.String method)
Get the file locking method type given a method name. |
java.lang.String |
getUniqueId()
|
java.util.Properties |
load()
Load the properties file. |
void |
lock(int fileLockMethod)
Lock the file if possible. |
void |
run()
|
java.util.Properties |
save()
Save the lock file. |
void |
setProperty(java.lang.String key,
java.lang.String value)
Add or change a setting to the properties. |
void |
unlock()
Unlock the file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int LOCK_NO
public static final int LOCK_FILE
public static final int LOCK_SOCKET
public static final int LOCK_SERIALIZED
Constructor Detail |
---|
public FileLock(TraceSystem traceSystem, java.lang.String fileName, int sleep)
traceSystem
- the trace system to usefileName
- the file namesleep
- the number of milliseconds to sleepMethod Detail |
---|
public void lock(int fileLockMethod)
fileLockMethod
- the file locking method to use
SQLException
- if locking was not successfulpublic void unlock()
public void setProperty(java.lang.String key, java.lang.String value)
key
- the keyvalue
- the valuepublic java.util.Properties save()
public java.util.Properties load()
public static int getFileLockMethod(java.lang.String method)
method
- the method name
SQLException
- if the method name is unknownpublic java.lang.String getUniqueId()
public void run()
run
in interface java.lang.Runnable
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |