| java.lang.Object org.griphyn.vdl.util.LockHelper
LockHelper | public class LockHelper (Code) | | author: Jens-S. Vöckler author: Yong Zhao version: $Revision: 50 $ See Also: java.io.File |
Field Summary | |
final public static String | LOCK_SUFFIX The suffix to use for the regular lock file. |
Constructor Summary | |
public | LockHelper() default ctor. | public | LockHelper(long timeout, int retries) ctor. |
Method Summary | |
public File | createLock(String filename) Creates a file-based lock file in an NFS secure fashion. | public boolean | lockFile(String filename) Locks a file using an empty lockfile. | public boolean | unlockFile(String filename) Releases a lock file from its basename.
Parameters: filename - is the name of the basename of the file to unlock.The locking extension will be added internally. |
LOCK_SUFFIX | final public static String LOCK_SUFFIX(Code) | | The suffix to use for the regular lock file.
|
LockHelper | public LockHelper()(Code) | | default ctor.
|
LockHelper | public LockHelper(long timeout, int retries)(Code) | | ctor.
|
createLock | public File createLock(String filename)(Code) | | Creates a file-based lock file in an NFS secure fashion. Do not use
this function for locking, use
LockHelper.lockFile(String) instead.
One exception is to use this method for test-and-set locking.
Parameters: filename - is the file to create a lockfile for the representation of the lock file, or null in case of error. |
lockFile | public boolean lockFile(String filename)(Code) | | Locks a file using an empty lockfile. This method repeatedly retries
to lock a file, and gives up after a few seconds.
Parameters: filename - is the basename of the file to lock. true, if the file was locked successfully, false otherwise. |
unlockFile | public boolean unlockFile(String filename)(Code) | | Releases a lock file from its basename.
Parameters: filename - is the name of the basename of the file to unlock.The locking extension will be added internally. true, if the lock was removed successfully, false otherwise. |
|
|