Top Description Fields Constructors Methods
net.sf.ehcache.transaction

public abstract Class AbstractSoftLockManager

extends Object
implements SoftLockManager
Class Inheritance
All Implemented Interfaces
net.sf.ehcache.transaction.SoftLockManager
Known Direct Subclasses
net.sf.ehcache.transaction.SoftLockManagerImpl
Imports
java.util.HashSet, .List, .Map, .Set, .Map.Entry, java.util.concurrent.ConcurrentMap, net.sf.ehcache.Element, net.sf.ehcache.store.Store, net.sf.ehcache.transaction.local.LocalTransactionContext

An abstract map backed soft lock manager.
Author
Chris Dennis

Field Summary

Modifier and TypeField and Description
private final String
private final SoftLockFactory

Constructor Summary

AccessConstructor and Description
public
AbstractSoftLockManager(String
name of the cache
cacheName
,
SoftLockFactory
factory of managed locks
lockFactory
)

Create an abstract soft lock manager for the given cache name and soft lock factory.

Method Summary

Modifier and TypeMethod and Description
public void
clearSoftLock(SoftLock
the lock to clear
softLock
)

Implements net.sf.ehcache.transaction.SoftLockManager.clearSoftLock.

Clear a soft lock
public Set<SoftLock>
collectAllSoftLocksForTransactionID(TransactionID
the transaction ID
transactionID
)

Implements net.sf.ehcache.transaction.SoftLockManager.collectAllSoftLocksForTransactionID.

Get a the soft locks of the specified transaction ID
public SoftLockID
createSoftLockID(TransactionID
the transaction ID under which the soft lock will operate
transactionID
,
Object
the key of the Element this soft lock is protecting
key
,
Element
the new Element
newElement
,
Element
the actual Element
oldElement
)

Implements net.sf.ehcache.transaction.SoftLockManager.createSoftLockID.

Create a new soft lock ID and associated soft lock if necessary.
public SoftLock
findSoftLockById(SoftLockID
the soft lock's ID
softLockId
)

Implements net.sf.ehcache.transaction.SoftLockManager.findSoftLockById.

Find a previously created and still existing soft lock
protected abstract ConcurrentMap<SoftLockID, SoftLock>

Returns:

the map of all locks
getAllLocks
()

Return the map of all soft locks.

public Set<Object>
getKeysInvisibleInContext(LocalTransactionContext
the transaction context
currentTransactionContext
,
Store underlyingStore)

Implements net.sf.ehcache.transaction.SoftLockManager.getKeysInvisibleInContext.

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 ConcurrentMap<SoftLockID, Boolean>

Returns:

the map of all new key locks
getNewKeyLocks
()

Return the map of all locks that are for new keys.

private Set<Object>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheNameback to summary
private final String cacheName
lockFactoryback to summary
private final SoftLockFactory lockFactory

Constructor Detail

AbstractSoftLockManagerback to summary
public AbstractSoftLockManager(String cacheName, SoftLockFactory lockFactory)

Create an abstract soft lock manager for the given cache name and soft lock factory.

Parameters
cacheName:String

name of the cache

lockFactory:SoftLockFactory

factory of managed locks

Method Detail

clearSoftLockback to summary
public void clearSoftLock(SoftLock softLock)

Implements net.sf.ehcache.transaction.SoftLockManager.clearSoftLock.

Doc from net.sf.ehcache.transaction.SoftLockManager.clearSoftLock.

Clear a soft lock

Parameters
softLock:SoftLock

the lock to clear

collectAllSoftLocksForTransactionIDback to summary
public Set<SoftLock> collectAllSoftLocksForTransactionID(TransactionID transactionID)

Implements net.sf.ehcache.transaction.SoftLockManager.collectAllSoftLocksForTransactionID.

Doc from net.sf.ehcache.transaction.SoftLockManager.collectAllSoftLocksForTransactionID.

Get a the soft locks of the specified transaction ID

Parameters
transactionID:TransactionID

the transaction ID

Returns:Set<SoftLock>

a Set of SoftLocks

createSoftLockIDback to summary
public SoftLockID createSoftLockID(TransactionID transactionID, Object key, Element newElement, Element oldElement)

Implements net.sf.ehcache.transaction.SoftLockManager.createSoftLockID.

Doc from net.sf.ehcache.transaction.SoftLockManager.createSoftLockID.

Create a new soft lock ID and associated soft lock if necessary.

Parameters
transactionID:TransactionID

the transaction ID under which the soft lock will operate

key:Object

the key of the Element this soft lock is protecting

newElement:Element

the new Element

oldElement:Element

the actual Element

Returns:SoftLockID

the soft lock ID

findSoftLockByIdback to summary
public SoftLock findSoftLockById(SoftLockID softLockId)

Implements net.sf.ehcache.transaction.SoftLockManager.findSoftLockById.

Doc from net.sf.ehcache.transaction.SoftLockManager.findSoftLockById.

Find a previously created and still existing soft lock

Parameters
softLockId:SoftLockID

the soft lock's ID

Returns:SoftLock

the soft lock, or null if no soft lock with the corresponding ID could be found

getAllLocksback to summary
protected abstract ConcurrentMap<SoftLockID, SoftLock> getAllLocks()

Return the map of all soft locks.

Returns:ConcurrentMap<SoftLockID, SoftLock>

the map of all locks

getKeysInvisibleInContextback to summary
public Set<Object> getKeysInvisibleInContext(LocalTransactionContext currentTransactionContext, Store underlyingStore)

Implements net.sf.ehcache.transaction.SoftLockManager.getKeysInvisibleInContext.

Doc from net.sf.ehcache.transaction.SoftLockManager.getKeysInvisibleInContext.

Get a Set of keys protected by soft locks which must not be visible to a transaction context according to the isolation level.

Parameters
currentTransactionContext:LocalTransactionContext

the transaction context

Returns:Set<Object>

a Set of keys invisible to the context

getNewKeyLocksback to summary
protected abstract ConcurrentMap<SoftLockID, Boolean> getNewKeyLocks()

Return the map of all locks that are for new keys.

Returns:ConcurrentMap<SoftLockID, Boolean>

the map of all new key locks

getNewKeysback to summary
private Set<Object> getNewKeys()