Package com.tridion.concurrent
Class FileLockManager
java.lang.Object
com.tridion.concurrent.FileLockManager
The
FileLockManager is a single point of access to lock files
for reading, writing and removing.
Make sure all concurrent file access is done through locking otherwise the
prevention of concurrent access is bypassed.
Only works with a single JVM since this is a singleton.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic FileLockManagerfinal longLock's the object for any usage through thisLockManagerand returns the 'lock-cookie' to unlock it with.final voidUnlocks the object for usage through thisLockManager.
-
Field Details
-
DEFAULT_WAITING_TIME_MINUTES
public static final int DEFAULT_WAITING_TIME_MINUTES- See Also:
-
-
Method Details
-
getInstance
-
lock
Lock's the object for any usage through thisLockManagerand returns the 'lock-cookie' to unlock it with. CAUTION: Always unlock in the finally block to prevent starvation.- Parameters:
object- The object to lock.- Returns:
- the object's lock 'cookie'.
-
unlock
Unlocks the object for usage through thisLockManager.- Parameters:
object- The object to unlock.lockCookie- The cookie to unlock it with.- Throws:
SecurityException- on an invalid lock cookie.
-