Class FileLock
java.lang.Object
org.h2.store.FileLock
- All Implemented Interfaces:
Runnable
-
Constructor Summary
ConstructorsConstructorDescriptionFileLock(TraceSystem traceSystem, String fileName, int sleep) Create a new file locking object. -
Method Summary
Modifier and TypeMethodDescriptionstatic FileLockMethodgetFileLockMethod(String method) Get the file locking method type given a method name.load()Load the properties file.voidlock(FileLockMethod fileLockMethod) Lock the file if possible.voidrun()save()Save the lock file.voidsetProperty(String key, String value) Add or change a setting to the properties.voidunlock()Unlock the file.
-
Constructor Details
-
FileLock
Create a new file locking object.- Parameters:
traceSystem- the trace system to usefileName- the file namesleep- the number of milliseconds to sleep
-
-
Method Details
-
lock
Lock the file if possible. A file may only be locked once.- Parameters:
fileLockMethod- the file locking method to use- Throws:
DbException- if locking was not successful
-
unlock
public void unlock()Unlock the file. The watchdog thread is stopped. This method does nothing if the file is already unlocked. -
setProperty
-
save
-
load
-
getFileLockMethod
Get the file locking method type given a method name.- Parameters:
method- the method name- Returns:
- the method type
- Throws:
DbException- if the method name is unknown
-
getUniqueId
-
run
-