jconch.lock
Class AbstractLogEqLock<OBJ_T,LOCK_T>

java.lang.Object
  extended by jconch.lock.AbstractLogEqLock<OBJ_T,LOCK_T>
Type Parameters:
OBJ_T - The type of object which will be used for logically equivalent comparisons.
LOCK_T - The type of lock provided by the implementing class.
Direct Known Subclasses:
RWLogEqLock, SyncLogEqLock

public abstract class AbstractLogEqLock<OBJ_T,LOCK_T>
extends Object

Provides the basic implementation for logically equivalent locks.

Author:
Robert Fischer

Constructor Summary
AbstractLogEqLock()
           
 
Method Summary
protected abstract  LOCK_T createNewLock()
          Implementation of the "lock" that is created.
 LOCK_T getLock(OBJ_T in)
          Provides a lock for the given object.
protected  boolean hasLockFor(OBJ_T obj)
          Determines if we have a lock for the given object currently at hand.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLogEqLock

public AbstractLogEqLock()
Method Detail

getLock

public LOCK_T getLock(OBJ_T in)
Provides a lock for the given object.

Parameters:
in - The object whose lock is wanted.
Returns:
A lock for that object.

hasLockFor

protected boolean hasLockFor(OBJ_T obj)
Determines if we have a lock for the given object currently at hand.

Parameters:
obj - The object to check on.
Returns:
If getLock(Object) applied to the parameter would provide a new lock.

createNewLock

protected abstract LOCK_T createNewLock()
Implementation of the "lock" that is created.

Returns:
An object to use for a lock.