java.lang.Object | |
↳ | com.pnfsoftware.jeb.util.io.FileMonitor |
File monitors can be used to create and retrieve lock on a file for exclusive operations. Locks are implemented as small files alongside the file to be locked.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
long | CHECK_MS | Check frequency in ms, that is, the frequency at which a lock-file write-timestamp is verified. | |||||||||
long | TOUCH_MS | Touch frequency in ms, that is, the frequency at which a lock-file write-timestamp is updated. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static FileMonitor |
create(File file)
Create a monitor object for the provided file.
| ||||||||||
static FileMonitor |
create(File folder, String filename, boolean singlefile)
Create a monitor object for the provided file or group of files.
| ||||||||||
static FileMonitor |
get(File file)
Retrieve the existing monitor for the provided file.@return
| ||||||||||
static FileMonitor |
get(File folder, String filename, boolean singlefile)
Retrieve the existing monitor for the provided file or group of files.@return
| ||||||||||
boolean | isLocked() | ||||||||||
void |
lock()
Create and refresh a valid lock file (per this monitor setting).
| ||||||||||
void | unlock(boolean unregister) |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Check frequency in ms, that is, the frequency at which a lock-file write-timestamp is verified.
Touch frequency in ms, that is, the frequency at which a lock-file write-timestamp is updated.
Create a monitor object for the provided file. (Note that this method does not create any file.)@return
IOException |
---|
Create a monitor object for the provided file or group of files. (Note that this method does not create any file.)@return
IOException |
---|
Retrieve the existing monitor for the provided file.@return
IOException |
---|
Retrieve the existing monitor for the provided file or group of files.@return
IOException |
---|
Create and refresh a valid lock file (per this monitor setting). This call should be mirrored by a call to #unlock() when monitoring is to stop.
InterruptedException |
---|