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.
| Methods |
| static FileLockMethod |
getFileLockMethod(String method)
Get the file locking method type given a method name.
|
| static FileLockMethod |
getFileLockMethod(String method)
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
|
|
FileLock(TraceSystem traceSystem, String fileName, int sleep)
Create a new file locking object.
|
|
FileLock(TraceSystem traceSystem, String fileName, int sleep)
Create a new file locking object.
Parameters:
traceSystem - the trace system to use
fileName - the file name
sleep - the number of milliseconds to sleep
|
| String |
getUniqueId()
|
| String |
getUniqueId()
|
| Properties |
load()
Load the properties file.
|
| Properties |
load()
Load the properties file.
Returns:
the properties
|
| void |
lock(FileLockMethod fileLockMethod)
Lock the file if possible.
|
| void |
lock(FileLockMethod fileLockMethod)
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
|
| void |
run()
|
| void |
run()
|
| Properties |
save()
Save the lock file.
|
| Properties |
save()
Save the lock file.
Returns:
the saved properties
|
| void |
setProperty(String key, String value)
Add or change a setting to the properties.
|
| void |
setProperty(String key, String value)
Add or change a setting to the properties. This call does not save the
file.
Parameters:
key - the key
value - the value
|
| void |
unlock()
Unlock the file.
|
| void |
unlock()
Unlock the file. The watchdog thread is stopped. This method does nothing
if the file is already unlocked.
|
|