|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.backsource.utils.io.DotLock
Simple, portable file locking using .lock files.
WARNING. This lock implementation has several flaws:
File f = new File("apa");
DotLocl.aquire(f);
// do stuff with f
DotLocl.release(f);
| Field Summary | |
static java.lang.String |
LOCK_SUFFIX
|
static long |
POLL_TIME
|
| Constructor Summary | |
DotLock()
|
|
| Method Summary | |
static void |
aquire(java.io.File f)
Aquire the lock for the file @param f. |
static boolean |
aquire(java.io.File f,
long timeout)
Aquire the lock for the file @param f, wait a most @param timeout milliseconds for the lock to be released. |
static long |
getLockAge(java.io.File f)
|
static java.io.File |
getLockFile(java.io.File f)
|
static boolean |
isLocked(java.io.File f)
|
static boolean |
release(java.io.File f)
Release the lock for file @param f |
static boolean |
tryLock(java.io.File f)
Try to aquire the lock for file @param f. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String LOCK_SUFFIX
public static final long POLL_TIME
| Constructor Detail |
public DotLock()
| Method Detail |
public static boolean tryLock(java.io.File f)
throws java.io.IOException
java.io.IOException - if the lockfile could not be created
public static void aquire(java.io.File f)
throws java.io.IOException
java.io.IOException - if the lockfile could not be created
java.lang.SecurityException - if the securitymanager denies write access to the lock file
public static boolean aquire(java.io.File f,
long timeout)
throws java.io.IOException
java.io.IOException - if the lockfile could not be created
java.lang.SecurityException - if the securitymanager denies write access to the lock filepublic static boolean release(java.io.File f)
public static boolean isLocked(java.io.File f)
public static java.io.File getLockFile(java.io.File f)
public static long getLockAge(java.io.File f)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||