Package net.sf.ehcache.transaction
Class AbstractSoftLockManager
- java.lang.Object
-
- net.sf.ehcache.transaction.AbstractSoftLockManager
-
- All Implemented Interfaces:
SoftLockManager
- Direct Known Subclasses:
SoftLockManagerImpl
public abstract class AbstractSoftLockManager extends java.lang.Object implements SoftLockManager
An abstract map backed soft lock manager.- Author:
- Chris Dennis
-
-
Constructor Summary
Constructors Constructor Description AbstractSoftLockManager(java.lang.String cacheName, SoftLockFactory lockFactory)Create an abstract soft lock manager for the given cache name and soft lock factory.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclearSoftLock(SoftLock softLock)Clear a soft lockjava.util.Set<SoftLock>collectAllSoftLocksForTransactionID(TransactionID transactionID)Get a the soft locks of the specified transaction IDSoftLockIDcreateSoftLockID(TransactionID transactionID, java.lang.Object key, Element newElement, Element oldElement)Create a new soft lock ID and associated soft lock if necessary.SoftLockfindSoftLockById(SoftLockID softLockId)Find a previously created and still existing soft lockprotected abstract java.util.concurrent.ConcurrentMap<SoftLockID,SoftLock>getAllLocks()Return the map of all soft locks.java.util.Set<java.lang.Object>getKeysInvisibleInContext(LocalTransactionContext currentTransactionContext, Store underlyingStore)Get a Set of keys protected by soft locks which must not be visible to a transaction context according to the isolation level.protected abstract java.util.concurrent.ConcurrentMap<SoftLockID,java.lang.Boolean>getNewKeyLocks()Return the map of all locks that are for new keys.
-
-
-
Constructor Detail
-
AbstractSoftLockManager
public AbstractSoftLockManager(java.lang.String cacheName, SoftLockFactory lockFactory)Create an abstract soft lock manager for the given cache name and soft lock factory.- Parameters:
cacheName- name of the cachelockFactory- factory of managed locks
-
-
Method Detail
-
getAllLocks
protected abstract java.util.concurrent.ConcurrentMap<SoftLockID,SoftLock> getAllLocks()
Return the map of all soft locks.- Returns:
- the map of all locks
-
getNewKeyLocks
protected abstract java.util.concurrent.ConcurrentMap<SoftLockID,java.lang.Boolean> getNewKeyLocks()
Return the map of all locks that are for new keys.- Returns:
- the map of all new key locks
-
createSoftLockID
public SoftLockID createSoftLockID(TransactionID transactionID, java.lang.Object key, Element newElement, Element oldElement)
Create a new soft lock ID and associated soft lock if necessary.- Specified by:
createSoftLockIDin interfaceSoftLockManager- Parameters:
transactionID- the transaction ID under which the soft lock will operatekey- the key of the Element this soft lock is protectingnewElement- the new ElementoldElement- the actual Element- Returns:
- the soft lock ID
-
findSoftLockById
public SoftLock findSoftLockById(SoftLockID softLockId)
Find a previously created and still existing soft lock- Specified by:
findSoftLockByIdin interfaceSoftLockManager- Parameters:
softLockId- the soft lock's ID- Returns:
- the soft lock, or null if no soft lock with the corresponding ID could be found
-
getKeysInvisibleInContext
public java.util.Set<java.lang.Object> getKeysInvisibleInContext(LocalTransactionContext currentTransactionContext, Store underlyingStore)
Get a Set of keys protected by soft locks which must not be visible to a transaction context according to the isolation level.- Specified by:
getKeysInvisibleInContextin interfaceSoftLockManager- Parameters:
currentTransactionContext- the transaction context- Returns:
- a Set of keys invisible to the context
-
collectAllSoftLocksForTransactionID
public java.util.Set<SoftLock> collectAllSoftLocksForTransactionID(TransactionID transactionID)
Get a the soft locks of the specified transaction ID- Specified by:
collectAllSoftLocksForTransactionIDin interfaceSoftLockManager- Parameters:
transactionID- the transaction ID- Returns:
- a Set of SoftLocks
-
clearSoftLock
public void clearSoftLock(SoftLock softLock)
Clear a soft lock- Specified by:
clearSoftLockin interfaceSoftLockManager- Parameters:
softLock- the lock to clear
-
-