Other feature could be :
- client request which is trying to acquire lock should not block, if lock is not available.
API for this may look like this :
class LockServer {
// For every different resouce, it will create (or return existing) Lock object
Lock newLock(resourceId);
void destroyLock(resourceId);
}
class Lock {
// client request blocks for acquiring the lock
void acquire(clientId);
void acquire(clientId, lockTimeOut);
// client request wont block, if lock is not available
boolean tryAcquire(clientId);
boolean tryAcquire(clientId, tryTimeOut);
void release(clientId);