org.apache.slide.util.locking
Interface LockManager

All Known Implementing Classes:
GenericLockManager

public interface LockManager

A manager for multi level locks on resources. Encapsulates creation, removal, and retrieval of locks. Each resource can have at most a single lock. However, it may be possible for more than one accessing entity to have influence on this lock via different lock levels that may be provided by the according implementation of MultiLevelLock.

Author:
Oliver Zeigermann
See Also:
MultiLevelLock

Method Summary
 MultiLevelLock atomicGetOrCreateLock(java.lang.Object resourceId)
          Either gets an existing lock on the specified resource or creates one if none exists.
 MultiLevelLock getLock(java.lang.Object resourceId)
          Gets an existing lock on the specified resource.
 void removeLock(MultiLevelLock lock)
          Removes the specified lock from the associated resource.
 

Method Detail

atomicGetOrCreateLock

public MultiLevelLock atomicGetOrCreateLock(java.lang.Object resourceId)
Either gets an existing lock on the specified resource or creates one if none exists. This methods guarantees to do this atomically.

Parameters:
resourceId - the resource to get or create the lock on
Returns:
the lock for the specified resource

getLock

public MultiLevelLock getLock(java.lang.Object resourceId)
Gets an existing lock on the specified resource. If none exists it returns null.

Parameters:
resourceId - the resource to get the lock for
Returns:
the lock on the specified resource

removeLock

public void removeLock(MultiLevelLock lock)
Removes the specified lock from the associated resource.

Parameters:
lock - the lock to be removed