public abstract class BucketBasedCacheStore extends LockSupportCacheStore<Integer>
Modifier and Type | Class and Description |
---|---|
protected static interface |
BucketBasedCacheStore.BucketHandler |
protected class |
BucketBasedCacheStore.CollectionGeneratingBucketHandler<T> |
multiThreadedPurge, purgerService
cache, marshaller
Constructor and Description |
---|
BucketBasedCacheStore() |
Modifier and Type | Method and Description |
---|---|
Integer |
getLockFromKey(Object key)
For
BucketBasedCacheStore s the lock should be acquired at bucket level. |
protected void |
insertBucket(Bucket bucket)
Inserts a new Bucket in the storage system.
|
protected Set<Object> |
loadAllKeysLockSafe(Set<Object> keysToExclude) |
protected Set<InternalCacheEntry> |
loadAllLockSafe() |
protected abstract Bucket |
loadBucket(Integer hash)
Loads a Bucket from the store, based on the hash code of the bucket.
|
protected Set<InternalCacheEntry> |
loadLockSafe(int max) |
protected InternalCacheEntry |
loadLockSafe(Object key,
Integer lockingKey)
Loads an entry from a Bucket, locating the relevant Bucket using the key's hash code.
|
protected abstract void |
loopOverBuckets(BucketBasedCacheStore.BucketHandler handler)
A mechanism to loop over all buckets in the cache store.
|
protected boolean |
removeLockSafe(Object key,
Integer lockingKey)
Removes an entry from a Bucket, locating the relevant Bucket using the key's hash code.
|
protected void |
storeLockSafe(InternalCacheEntry entry,
Integer lockingKey)
Stores an entry in an appropriate Bucket, based on the key's hash code.
|
protected abstract void |
updateBucket(Bucket bucket)
Updates a bucket in the store with the Bucket passed in to the method.
|
acquireGlobalLock, clear, clearLockSafe, downgradeLock, fromStream, fromStreamLockSafe, getTotalLockCount, immediateLockForWriting, init, load, load, loadAll, loadAllKeys, lockForReading, lockForWriting, releaseGlobalLock, remove, start, store, toStream, toStreamLockSafe, unlock, upgradeLock
applyModifications, commit, getCacheStoreConfig, getConcurrencyLevel, getMarshaller, prepare, purgeExpired, purgeInternal, removeAll, rollback, safeClose, safeClose, stop, supportsMultiThreadedPurge
containsKey
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
containsKey, getConfigurationClass
protected InternalCacheEntry loadLockSafe(Object key, Integer lockingKey) throws CacheLoaderException
loadLockSafe
in class LockSupportCacheStore<Integer>
key
- key of the entry to remove.lockingKey
- the hash of the key, as returned by LockSupportCacheStore.getLockFromKey(Object)
. This
is required in order to avoid hash re-computation.CacheLoaderException
protected void storeLockSafe(InternalCacheEntry entry, Integer lockingKey) throws CacheLoaderException
storeLockSafe
in class LockSupportCacheStore<Integer>
entry
- the entry to storelockingKey
- the hash of the key, as returned by LockSupportCacheStore.getLockFromKey(Object)
. This
is required in order to avoid hash re-computation.CacheLoaderException
protected boolean removeLockSafe(Object key, Integer lockingKey) throws CacheLoaderException
removeLockSafe
in class LockSupportCacheStore<Integer>
key
- key of the entry to remove.lockingKey
- the hash of the key, as returned by LockSupportCacheStore.getLockFromKey(Object)
. This
is required in order to avoid hash re-computation.CacheLoaderException
public Integer getLockFromKey(Object key)
BucketBasedCacheStore
s the lock should be acquired at bucket level. So we're locking based on the
hash code of the key, as all keys having same hash code will be mapped to same bucket.getLockFromKey
in class LockSupportCacheStore<Integer>
protected void insertBucket(Bucket bucket) throws CacheLoaderException
updateBucket(Bucket)
.bucket
- bucket to insertCacheLoaderException
- in case of problems with the store.protected Set<InternalCacheEntry> loadAllLockSafe() throws CacheLoaderException
loadAllLockSafe
in class LockSupportCacheStore<Integer>
CacheLoaderException
protected Set<InternalCacheEntry> loadLockSafe(int max) throws CacheLoaderException
loadLockSafe
in class LockSupportCacheStore<Integer>
CacheLoaderException
protected Set<Object> loadAllKeysLockSafe(Set<Object> keysToExclude) throws CacheLoaderException
loadAllKeysLockSafe
in class LockSupportCacheStore<Integer>
CacheLoaderException
protected abstract void loopOverBuckets(BucketBasedCacheStore.BucketHandler handler) throws CacheLoaderException
BucketBasedCacheStore.BucketHandler.handle(Bucket)
returns true or there are no more buckets available.
handler
- CacheLoaderException
protected abstract void updateBucket(Bucket bucket) throws CacheLoaderException
insertBucket(Bucket)
as well so that it doesn't blindly
forward calls to updateBucket(Bucket)
.
bucket
- bucket to update.CacheLoaderException
- in case of problems with the store.protected abstract Bucket loadBucket(Integer hash) throws CacheLoaderException
hash
- the Bucket's hashCacheLoaderException
- in case of problems with the store.Copyright © 2014 JBoss, a division of Red Hat. All Rights Reserved.