ehcache

net.sf.ehcache.transaction
Class ReadCommittedSoftLockFactoryImpl

java.lang.Object
  extended by net.sf.ehcache.transaction.ReadCommittedSoftLockFactoryImpl
All Implemented Interfaces:
SoftLockFactory

public class ReadCommittedSoftLockFactoryImpl
extends Object
implements SoftLockFactory

A SoftLockFactory implementation which creates soft locks with Read-Committed isolation level

Author:
Ludovic Orban

Constructor Summary
ReadCommittedSoftLockFactoryImpl(String cacheManagerName, String cacheName)
          Create a new ReadCommittedSoftLockFactoryImpl instance for a cache
 
Method Summary
 Set<SoftLock> collectAllSoftLocksForTransactionID(TransactionID transactionID)
          Get a the soft locks of the specified transaction ID
 Set<TransactionID> collectExpiredTransactionIDs()
          Get a Set of TransactionIDs for which the soft locks have expired
 SoftLock createSoftLock(TransactionID transactionID, Object key, Element newElement, Element oldElement, boolean pinned)
          Create a new, unlocked soft lock
 Set<Object> getKeysInvisibleInContext(LocalTransactionContext currentTransactionContext)
          Get a Set of keys protected by soft locks which must not be visible to a transaction context according to the isolation level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadCommittedSoftLockFactoryImpl

public ReadCommittedSoftLockFactoryImpl(String cacheManagerName,
                                        String cacheName)
Create a new ReadCommittedSoftLockFactoryImpl instance for a cache

Parameters:
cacheManagerName - the name of the cache manager
cacheName - the name of the cache
Method Detail

createSoftLock

public SoftLock createSoftLock(TransactionID transactionID,
                               Object key,
                               Element newElement,
                               Element oldElement,
                               boolean pinned)
Create a new, unlocked soft lock

Specified by:
createSoftLock in interface SoftLockFactory
Parameters:
transactionID - the transaction ID under which the soft lock will operate
key - the key of the Element this soft lock is protecting
newElement - the new Element
oldElement - the actual Element
pinned - true if the element that is going to be replaced by a soft lock is pinned
Returns:
the soft lock

getKeysInvisibleInContext

public Set<Object> getKeysInvisibleInContext(LocalTransactionContext currentTransactionContext)
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:
getKeysInvisibleInContext in interface SoftLockFactory
Parameters:
currentTransactionContext - the transaction context
Returns:
a Set of keys invisible to the context

collectExpiredTransactionIDs

public Set<TransactionID> collectExpiredTransactionIDs()
Get a Set of TransactionIDs for which the soft locks have expired

Specified by:
collectExpiredTransactionIDs in interface SoftLockFactory
Returns:
a Set of TransactionIDs for which the soft locks have expired

collectAllSoftLocksForTransactionID

public Set<SoftLock> collectAllSoftLocksForTransactionID(TransactionID transactionID)
Get a the soft locks of the specified transaction ID

Specified by:
collectAllSoftLocksForTransactionID in interface SoftLockFactory
Parameters:
transactionID - the transaction ID
Returns:
a Set of SoftLocks

ehcache

Copyright © 2003-2012 Terracotta, Inc.. All Rights Reserved.