ehcache

net.sf.ehcache.concurrent
Interface CacheLockProvider

All Known Implementing Classes:
NonstopCacheLockProvider, StripedReadWriteLockSync

public interface CacheLockProvider

Author:
Alex Snaps

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.
 

Method Detail

getSyncForKey

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.

Parameters:
key - the key
Returns:
one of a limited number of Sync's.

getAndWriteLockAllSyncForKeys

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

Parameters:
keys - the keys to lock and get syncs for
Returns:
limited number of write locked Sync's matching the keys.

getAndWriteLockAllSyncForKeys

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.

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

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

Parameters:
keys - the keys to unlock

ehcache

true