org.apache.commons.transaction.locking
Interface LockManager

All Known Implementing Classes:
GenericLockManager, ReadWriteLockManager, ReadWriteUpgradeLockManager

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.

Version:
$Id: LockManager.java 493628 2007-01-07 01:42:48Z joerg $
See Also:
MultiLevelLock

Method Summary
 MultiLevelLock atomicGetOrCreateLock(Object resourceId)
          Either gets an existing lock on the specified resource or creates one if none exists.
 MultiLevelLock getLock(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

MultiLevelLock atomicGetOrCreateLock(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

MultiLevelLock getLock(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

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

Parameters:
lock - the lock to be removed


Copyright © 2004-2009 Apache Software Foundation. All Rights Reserved.