er.extensions.eof
Class ERXGlobalLock
java.lang.Object
er.extensions.eof.ERXGlobalLock
- All Implemented Interfaces:
- NSLocking
public class ERXGlobalLock
- extends Object
- implements NSLocking
Simple lock to sync access for multiple instances on one machine. This implementation
uses a lock file with the given name in the temp directory. In case of a VM crash, the file
is *not* deleted, so you have to do this yourself.
Additionally, you can't use it reliably on an NFS server. The lock otherwise behaves like an
NSRecursiveLock in that the same thread can re-lock as often as he wants.
App1:
NSLocking lock = ERXGlobalLock.lockForName("test");
lock.lock();
...
lock.unlock();
App2:
NSLocking lock = ERXGlobalLock.lockForName("test");
lock.lock();
...
lock.unlock();
- Author:
- ak
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ERXGlobalLock
public ERXGlobalLock(String name)
lock
public void lock()
- Specified by:
lock in interface NSLocking
unlock
public void unlock()
- Specified by:
unlock in interface NSLocking
cleanup
public boolean cleanup()
- Call this on startup.
lockForName
public static NSLocking lockForName(String name)
Copyright © 2002 – 2007 Project Wonder.