ehcache

net.sf.ehcache.constructs.nonstop.concurrency
Class NonstopCacheLockProvider

java.lang.Object
  extended by net.sf.ehcache.constructs.nonstop.concurrency.NonstopCacheLockProvider
All Implemented Interfaces:
CacheLockProvider

public class NonstopCacheLockProvider
extends Object
implements CacheLockProvider

Class implementing CacheLockProvider with nonstop feature

Author:
Abhishek Sanoujam

Constructor Summary
NonstopCacheLockProvider(NonstopStore nonstopStore, NonstopActiveDelegateHolder nonstopActiveDelegateHolder, ExplicitLockingContextThreadLocal explicitLockingContextThreadLocal)
          Public constructor
 
Method Summary
 Sync[] getAndWriteLockAllSyncForKeys(long timeout, Object... keys)
          Gets and write lock the Sync Stripes to use for the given keys.
 Sync[] getAndWriteLockAllSyncForKeys(Object... keys)
          Gets and write lock the Sync Stripes to use for the given keys.
 Sync getSyncForKey(Object key)
          Gets the Sync Stripe to use for a given key.
 void unlockWriteLockForAllKeys(Object... keys)
          write unlock the Sync Stripes to use for the given keys.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NonstopCacheLockProvider

public NonstopCacheLockProvider(NonstopStore nonstopStore,
                                NonstopActiveDelegateHolder nonstopActiveDelegateHolder,
                                ExplicitLockingContextThreadLocal explicitLockingContextThreadLocal)
Public constructor

Parameters:
nonstopStore -
nonstopActiveDelegateHolder -
explicitLockingContextThreadLocal -
Method Detail

getSyncForKey

public Sync getSyncForKey(Object key)
Gets the Sync Stripe to use for a given key.

This lookup must always return the same Sync for a given key.

Specified by:
getSyncForKey in interface CacheLockProvider
Parameters:
key - the key
Returns:
one of a limited number of Sync's.

getAndWriteLockAllSyncForKeys

public Sync[] getAndWriteLockAllSyncForKeys(Object... keys)
Gets and write lock the Sync Stripes to use for the given keys.

This lookup must always return the same Sync for a given key. For keys.length > 0, it will return anything between 1 and keys.length Sync's

Specified by:
getAndWriteLockAllSyncForKeys in interface CacheLockProvider
Parameters:
keys - the keys to lock and get syncs for
Returns:
limited number of write locked Sync's matching the keys.

getAndWriteLockAllSyncForKeys

public Sync[] getAndWriteLockAllSyncForKeys(long timeout,
                                            Object... keys)
                                     throws TimeoutException
Gets and write lock the Sync Stripes to use for the given keys.

This lookup must always return the same Sync for a given key. For keys.length > 0, it will return anything between 1 and keys.length Sync's

If all locks cannot be acquired within the specified timeout they are all released and an exception is thrown.

Specified by:
getAndWriteLockAllSyncForKeys in interface CacheLockProvider
Parameters:
timeout - amount of milliseconds before timeout occurs
keys - the keys to lock and get syncs for
Returns:
limited number of write locked Sync's matching the keys.
Throws:
TimeoutException - thrown when locks could not be acquired within specified timeout.

unlockWriteLockForAllKeys

public void unlockWriteLockForAllKeys(Object... keys)
write unlock the Sync Stripes to use for the given keys.

Specified by:
unlockWriteLockForAllKeys in interface CacheLockProvider
Parameters:
keys - the keys to unlock

ehcache

true