Class GridCacheStoreManagerAdapter
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.GridCacheManagerAdapter
-
- org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter
-
- All Implemented Interfaces:
GridCacheManager,CacheStoreManager
- Direct Known Subclasses:
CacheOsStoreManager
public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapter implements CacheStoreManager
Store manager.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanalwaysKeepBinaryAlways keep binary.protected CacheStore<?,?>cfgStoreprotected CacheStore<Object,Object>store-
Fields inherited from class org.apache.ignite.internal.processors.cache.GridCacheManagerAdapter
cctx, log, starting
-
-
Constructor Summary
Constructors Constructor Description GridCacheStoreManagerAdapter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract CacheConfigurationcacheConfiguration()booleanconfigured()CacheStore<?,?>configuredStore()voidforceFlush()protected abstract GridKernalContextigniteContext()voidinitialize(@Nullable CacheStore cfgStore, Map sesHolders)Initialize store manager.booleanisLocal()booleanisWriteBehind()booleanisWriteThrough()booleanisWriteToStoreFromDht()@Nullable Objectload(@Nullable IgniteInternalTx tx, KeyCacheObject key)Loads data from persistent store.booleanloadAll(@Nullable IgniteInternalTx tx, Collection keys, IgniteBiInClosure vis)Loads data from persistent store.booleanloadCache(GridInClosure3 vis, Object[] args)Loads data from persistent store.voidlocalStoreLoadAll(@Nullable IgniteInternalTx tx, Collection keys, GridInClosure3 vis)booleanput(@Nullable IgniteInternalTx tx, KeyCacheObject key, CacheObject val, GridCacheVersion ver)Puts key-value pair into storage.booleanputAll(@Nullable IgniteInternalTx tx, Map<? extends KeyCacheObject,IgniteBiTuple<? extends CacheObject,GridCacheVersion>> map)Puts key-value pair into storage.booleanremove(@Nullable IgniteInternalTx tx, KeyCacheObject key)booleanremoveAll(@Nullable IgniteInternalTx tx, Collection<? extends KeyCacheObject> keys)voidsessionEnd(IgniteInternalTx tx, boolean commit, boolean last, boolean storeSesEnded)protected voidstart0()protected voidstop0(boolean cancel, boolean destroy)CacheStore<Object,Object>store()voidwriteBehindCacheStoreSessionListenerStart()Notifies cache store session listeners.voidwriteBehindSessionEnd(boolean threwEx)End session initiated by write-behind store.voidwriteBehindSessionInit()Start session initiated by write-behind store.-
Methods inherited from class org.apache.ignite.internal.processors.cache.GridCacheManagerAdapter
context, kernalStartInfo, kernalStopInfo, log, onDisconnected, onKernalStart, onKernalStart0, onKernalStop, onKernalStop0, printMemoryStats, start, startInfo, stop, stopInfo, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.internal.processors.cache.store.CacheStoreManager
configuredConvertBinary, convertBinary
-
Methods inherited from interface org.apache.ignite.internal.processors.cache.GridCacheManager
onDisconnected, onKernalStart, onKernalStop, printMemoryStats, start, stop
-
-
-
-
Field Detail
-
store
protected CacheStore<Object,Object> store
-
cfgStore
protected CacheStore<?,?> cfgStore
-
alwaysKeepBinary
protected boolean alwaysKeepBinary
Always keep binary.
-
-
Method Detail
-
initialize
public void initialize(@Nullable @Nullable CacheStore cfgStore, Map sesHolders) throws IgniteCheckedExceptionInitialize store manager.- Specified by:
initializein interfaceCacheStoreManager- Parameters:
cfgStore- Actual store.sesHolders- Session holders.- Throws:
IgniteCheckedException- If failed.
-
isWriteThrough
public boolean isWriteThrough()
- Specified by:
isWriteThroughin interfaceCacheStoreManager- Returns:
Trueis write-through is enabled.
-
start0
protected void start0() throws IgniteCheckedException- Overrides:
start0in classGridCacheManagerAdapter- Throws:
IgniteCheckedException- If failed.
-
stop0
protected void stop0(boolean cancel, boolean destroy)- Overrides:
stop0in classGridCacheManagerAdapter- Parameters:
cancel- Cancel flag.destroy- Cache destroy flag.
-
isLocal
public boolean isLocal()
- Specified by:
isLocalin interfaceCacheStoreManager- Returns:
trueIf local store is configured.
-
configured
public boolean configured()
- Specified by:
configuredin interfaceCacheStoreManager- Returns:
trueIf store configured.
-
configuredStore
public CacheStore<?,?> configuredStore()
- Specified by:
configuredStorein interfaceCacheStoreManager- Returns:
- Unwrapped store provided in configuration.
-
load
@Nullable public final @Nullable Object load(@Nullable @Nullable IgniteInternalTx tx, KeyCacheObject key) throws IgniteCheckedException
Loads data from persistent store.- Specified by:
loadin interfaceCacheStoreManager- Parameters:
tx- Cache transaction.key- Cache key.- Returns:
- Loaded value, possibly null.
- Throws:
IgniteCheckedException- If data loading failed.
-
isWriteBehind
public boolean isWriteBehind()
- Specified by:
isWriteBehindin interfaceCacheStoreManager- Returns:
Trueis write-behind is enabled.
-
isWriteToStoreFromDht
public boolean isWriteToStoreFromDht()
- Specified by:
isWriteToStoreFromDhtin interfaceCacheStoreManager- Returns:
- Whether DHT transaction can write to store from DHT.
-
localStoreLoadAll
public final void localStoreLoadAll(@Nullable @Nullable IgniteInternalTx tx, Collection keys, GridInClosure3 vis) throws IgniteCheckedException- Specified by:
localStoreLoadAllin interfaceCacheStoreManager- Parameters:
tx- Cache transaction.keys- Cache keys.vis- Closure to apply for loaded elements.- Throws:
IgniteCheckedException- If data loading failed.
-
loadAll
public final boolean loadAll(@Nullable @Nullable IgniteInternalTx tx, Collection keys, IgniteBiInClosure vis) throws IgniteCheckedExceptionLoads data from persistent store.- Specified by:
loadAllin interfaceCacheStoreManager- Parameters:
tx- Cache transaction.keys- Cache keys.vis- Closure.- Returns:
Trueif there is a persistent storage.- Throws:
IgniteCheckedException- If data loading failed.
-
loadCache
public final boolean loadCache(GridInClosure3 vis, Object[] args) throws IgniteCheckedException
Loads data from persistent store.- Specified by:
loadCachein interfaceCacheStoreManager- Parameters:
vis- Closer to cache loaded elements.args- User arguments.- Returns:
Trueif there is a persistent storage.- Throws:
IgniteCheckedException- If data loading failed.
-
put
public final boolean put(@Nullable @Nullable IgniteInternalTx tx, KeyCacheObject key, CacheObject val, GridCacheVersion ver) throws IgniteCheckedExceptionPuts key-value pair into storage.- Specified by:
putin interfaceCacheStoreManager- Parameters:
tx- Cache transaction.key- Key.val- Value.ver- Version.- Returns:
trueIf there is a persistent storage.- Throws:
IgniteCheckedException- If storage failed.
-
putAll
public final boolean putAll(@Nullable @Nullable IgniteInternalTx tx, Map<? extends KeyCacheObject,IgniteBiTuple<? extends CacheObject,GridCacheVersion>> map) throws IgniteCheckedExceptionPuts key-value pair into storage.- Specified by:
putAllin interfaceCacheStoreManager- Parameters:
tx- Cache transaction.map- Map.- Returns:
Trueif there is a persistent storage.- Throws:
IgniteCheckedException- If storage failed.
-
remove
public final boolean remove(@Nullable @Nullable IgniteInternalTx tx, KeyCacheObject key) throws IgniteCheckedException- Specified by:
removein interfaceCacheStoreManager- Parameters:
tx- Cache transaction.key- Key.- Returns:
Trueif there is a persistent storage.- Throws:
IgniteCheckedException- If storage failed.
-
removeAll
public final boolean removeAll(@Nullable @Nullable IgniteInternalTx tx, Collection<? extends KeyCacheObject> keys) throws IgniteCheckedException- Specified by:
removeAllin interfaceCacheStoreManager- Parameters:
tx- Cache transaction.keys- Key.- Returns:
Trueif there is a persistent storage.- Throws:
IgniteCheckedException- If storage failed.
-
store
public CacheStore<Object,Object> store()
- Specified by:
storein interfaceCacheStoreManager- Returns:
- Wrapped store.
-
forceFlush
public void forceFlush() throws IgniteCheckedException- Specified by:
forceFlushin interfaceCacheStoreManager- Throws:
IgniteCheckedException- If failed.
-
sessionEnd
public final void sessionEnd(IgniteInternalTx tx, boolean commit, boolean last, boolean storeSesEnded) throws IgniteCheckedException
- Specified by:
sessionEndin interfaceCacheStoreManager- Parameters:
tx- Transaction.commit- Commit.last-Trueif this is last store in transaction.storeSesEnded-Trueif session for underlying store already ended.- Throws:
IgniteCheckedException- If failed.
-
writeBehindSessionInit
public void writeBehindSessionInit() throws IgniteCheckedExceptionStart session initiated by write-behind store.- Specified by:
writeBehindSessionInitin interfaceCacheStoreManager- Throws:
IgniteCheckedException- If failed.
-
writeBehindCacheStoreSessionListenerStart
public void writeBehindCacheStoreSessionListenerStart() throws IgniteCheckedExceptionNotifies cache store session listeners. This method is called by write-behind store in case of back-pressure mechanism is initiated. It is assumed that cache store session was started by CacheStoreManager before.- Specified by:
writeBehindCacheStoreSessionListenerStartin interfaceCacheStoreManager- Throws:
IgniteCheckedException- If failed.
-
writeBehindSessionEnd
public void writeBehindSessionEnd(boolean threwEx) throws IgniteCheckedExceptionEnd session initiated by write-behind store.- Specified by:
writeBehindSessionEndin interfaceCacheStoreManager- Parameters:
threwEx- If exception was thrown.- Throws:
IgniteCheckedException- If failed.
-
igniteContext
protected abstract GridKernalContext igniteContext()
- Returns:
- Ignite context.
-
cacheConfiguration
protected abstract CacheConfiguration cacheConfiguration()
- Returns:
- Cache configuration.
-
-