Class CacheStoreBalancingWrapper<K,V>
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.CacheStoreBalancingWrapper<K,V>
-
- All Implemented Interfaces:
javax.cache.integration.CacheLoader<K,V>,javax.cache.integration.CacheWriter<K,V>,CacheStore<K,V>
public class CacheStoreBalancingWrapper<K,V> extends Object implements CacheStore<K,V>
Cache store wrapper that ensures that there will be no more that one thread loading value from underlying store.
-
-
Field Summary
Fields Modifier and Type Field Description static intDFLT_LOAD_ALL_THRESHOLD
-
Constructor Summary
Constructors Constructor Description CacheStoreBalancingWrapper(CacheStore<K,V> delegate)CacheStoreBalancingWrapper(CacheStore<K,V> delegate, int loadAllThreshold)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete(Object key)voiddeleteAll(Collection<?> keys)Vload(K key)Map<K,V>loadAll(Iterable<? extends K> keys)voidloadAll(Collection<? extends K> keys, IgniteBiInClosure<K,V> c)intloadAllThreshold()voidloadCache(IgniteBiInClosure<K,V> clo, @Nullable Object... args)Loads all values from underlying persistent storage.voidsessionEnd(boolean commit)Tells store to commit or rollback a transaction depending on the value of the'commit'parameter.StringtoString()voidwrite(javax.cache.Cache.Entry<? extends K,? extends V> entry)voidwriteAll(Collection<javax.cache.Cache.Entry<? extends K,? extends V>> entries)
-
-
-
Field Detail
-
DFLT_LOAD_ALL_THRESHOLD
public static final int DFLT_LOAD_ALL_THRESHOLD
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CacheStoreBalancingWrapper
public CacheStoreBalancingWrapper(CacheStore<K,V> delegate)
- Parameters:
delegate- Delegate store.
-
CacheStoreBalancingWrapper
public CacheStoreBalancingWrapper(CacheStore<K,V> delegate, int loadAllThreshold)
- Parameters:
delegate- Delegate store.loadAllThreshold- Load all threshold.
-
-
Method Detail
-
loadAllThreshold
public int loadAllThreshold()
- Returns:
- Load all threshold.
-
loadCache
public void loadCache(IgniteBiInClosure<K,V> clo, @Nullable @Nullable Object... args)
Loads all values from underlying persistent storage. Note that keys are not passed, so it is up to implementation to figure out what to load. This method is called wheneverIgniteCache.loadCache(IgniteBiPredicate, Object...)method is invoked which is usually to preload the cache from persistent storage.This method is optional, and cache implementation does not depend on this method to do anything. Default implementation of this method in
CacheStoreAdapterdoes nothing.For every loaded value method
IgniteBiInClosure.apply(Object, Object)should be called on the passed in closure. The closure will then make sure that the loaded value is stored in cache.- Specified by:
loadCachein interfaceCacheStore<K,V>- Parameters:
clo- Closure for loaded values.args- Arguments passes intoIgniteCache.loadCache(IgniteBiPredicate, Object...)method.
-
loadAll
public Map<K,V> loadAll(Iterable<? extends K> keys) throws javax.cache.integration.CacheLoaderException
-
loadAll
public void loadAll(Collection<? extends K> keys, IgniteBiInClosure<K,V> c)
- Parameters:
keys- Keys to load.c- Closure for loaded values.
-
writeAll
public void writeAll(Collection<javax.cache.Cache.Entry<? extends K,? extends V>> entries)
-
delete
public void delete(Object key) throws javax.cache.integration.CacheWriterException
-
deleteAll
public void deleteAll(Collection<?> keys) throws javax.cache.integration.CacheWriterException
-
sessionEnd
public void sessionEnd(boolean commit)
Tells store to commit or rollback a transaction depending on the value of the'commit'parameter.- Specified by:
sessionEndin interfaceCacheStore<K,V>- Parameters:
commit-Trueif transaction should commit,falsefor rollback.
-
-