Package org.infinispan.interceptors.impl
Class CacheLoaderInterceptor<K,V>
- java.lang.Object
-
- org.infinispan.interceptors.BaseAsyncInterceptor
-
- org.infinispan.interceptors.DDAsyncInterceptor
-
- org.infinispan.interceptors.impl.JmxStatsCommandInterceptor
-
- org.infinispan.interceptors.impl.CacheLoaderInterceptor<K,V>
-
- All Implemented Interfaces:
Visitor
,AsyncInterceptor
,JmxStatisticsExposer
- Direct Known Subclasses:
ClusteredCacheLoaderInterceptor
public class CacheLoaderInterceptor<K,V> extends JmxStatsCommandInterceptor
- Since:
- 9.0
-
-
Field Summary
Fields Modifier and Type Field Description protected EntryFactory
entryFactory
protected CacheNotifier
notifier
protected PersistenceManager
persistenceManager
-
Fields inherited from class org.infinispan.interceptors.BaseAsyncInterceptor
cacheConfiguration
-
-
Constructor Summary
Constructors Constructor Description CacheLoaderInterceptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canLoad(Object key)
void
disableStore(String storeType)
long
getCacheLoaderLoads()
long
getCacheLoaderMisses()
Collection<String>
getStores()
protected boolean
hasSkipLoadFlag(FlagAffectedCommand cmd)
protected boolean
isConditional(org.infinispan.commands.write.WriteCommand cmd)
protected Boolean
loadIfNeeded(InvocationContext ctx, Object key, FlagAffectedCommand cmd)
Loads from the cache loader the entry for the given key.void
resetStatistics()
Resets statistics gathered.protected void
sendNotification(Object key, Object value, boolean pre, InvocationContext ctx, FlagAffectedCommand cmd)
protected boolean
skipLoadForWriteCommand(org.infinispan.commands.write.WriteCommand cmd, Object key, InvocationContext ctx)
void
start()
Object
visitComputeCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeCommand command)
Object
visitComputeIfAbsentCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeIfAbsentCommand command)
Object
visitEntrySetCommand(InvocationContext ctx, org.infinispan.commands.read.EntrySetCommand command)
Object
visitGetAllCommand(InvocationContext ctx, org.infinispan.commands.read.GetAllCommand command)
Object
visitGetCacheEntryCommand(InvocationContext ctx, org.infinispan.commands.read.GetCacheEntryCommand command)
Object
visitGetKeysInGroupCommand(InvocationContext ctx, org.infinispan.commands.remote.GetKeysInGroupCommand command)
Object
visitGetKeyValueCommand(InvocationContext ctx, org.infinispan.commands.read.GetKeyValueCommand command)
Object
visitKeySetCommand(InvocationContext ctx, org.infinispan.commands.read.KeySetCommand command)
Object
visitPutKeyValueCommand(InvocationContext ctx, org.infinispan.commands.write.PutKeyValueCommand command)
Object
visitReadOnlyKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyKeyCommand command)
Object
visitReadOnlyManyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyManyCommand command)
Object
visitReadWriteKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteKeyCommand command)
Object
visitReadWriteKeyValueCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteKeyValueCommand command)
Object
visitReadWriteManyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteManyCommand command)
Object
visitReadWriteManyEntriesCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteManyEntriesCommand command)
Object
visitRemoveCommand(InvocationContext ctx, org.infinispan.commands.write.RemoveCommand command)
Object
visitReplaceCommand(InvocationContext ctx, org.infinispan.commands.write.ReplaceCommand command)
Object
visitSizeCommand(InvocationContext ctx, org.infinispan.commands.read.SizeCommand command)
-
Methods inherited from class org.infinispan.interceptors.impl.JmxStatsCommandInterceptor
checkStatisticsUsed, getStatisticsEnabled, setStatisticsEnabled
-
Methods inherited from class org.infinispan.interceptors.DDAsyncInterceptor
handleDefault, visitClearCommand, visitCommand, visitCommitCommand, visitDistributedExecuteCommand, visitEvictCommand, visitInvalidateCommand, visitInvalidateL1Command, visitLockControlCommand, visitPrepareCommand, visitPutMapCommand, visitRollbackCommand, visitUnknownCommand, visitWriteOnlyKeyCommand, visitWriteOnlyKeyValueCommand, visitWriteOnlyManyCommand, visitWriteOnlyManyEntriesCommand
-
Methods inherited from class org.infinispan.interceptors.BaseAsyncInterceptor
asyncInvokeNext, asyncInvokeNext, asyncInvokeNext, asyncValue, delayedValue, delayedValue, invokeNext, invokeNextAndExceptionally, invokeNextAndFinally, invokeNextAndHandle, invokeNextThenAccept, invokeNextThenApply, isSuccessfullyDone, makeStage, setNextInterceptor, valueOrException
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.infinispan.commands.Visitor
visitApplyDeltaCommand, visitRemoveExpiredCommand
-
-
-
-
Field Detail
-
persistenceManager
protected PersistenceManager persistenceManager
-
notifier
protected CacheNotifier notifier
-
entryFactory
protected EntryFactory entryFactory
-
-
Method Detail
-
start
public void start()
-
visitPutKeyValueCommand
public Object visitPutKeyValueCommand(InvocationContext ctx, org.infinispan.commands.write.PutKeyValueCommand command) throws Throwable
- Specified by:
visitPutKeyValueCommand
in interfaceVisitor
- Overrides:
visitPutKeyValueCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitGetKeyValueCommand
public Object visitGetKeyValueCommand(InvocationContext ctx, org.infinispan.commands.read.GetKeyValueCommand command) throws Throwable
- Specified by:
visitGetKeyValueCommand
in interfaceVisitor
- Overrides:
visitGetKeyValueCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitGetCacheEntryCommand
public Object visitGetCacheEntryCommand(InvocationContext ctx, org.infinispan.commands.read.GetCacheEntryCommand command) throws Throwable
- Specified by:
visitGetCacheEntryCommand
in interfaceVisitor
- Overrides:
visitGetCacheEntryCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitGetAllCommand
public Object visitGetAllCommand(InvocationContext ctx, org.infinispan.commands.read.GetAllCommand command) throws Throwable
- Specified by:
visitGetAllCommand
in interfaceVisitor
- Overrides:
visitGetAllCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitRemoveCommand
public Object visitRemoveCommand(InvocationContext ctx, org.infinispan.commands.write.RemoveCommand command) throws Throwable
- Specified by:
visitRemoveCommand
in interfaceVisitor
- Overrides:
visitRemoveCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReplaceCommand
public Object visitReplaceCommand(InvocationContext ctx, org.infinispan.commands.write.ReplaceCommand command) throws Throwable
- Specified by:
visitReplaceCommand
in interfaceVisitor
- Overrides:
visitReplaceCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitComputeCommand
public Object visitComputeCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeCommand command) throws Throwable
- Specified by:
visitComputeCommand
in interfaceVisitor
- Overrides:
visitComputeCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitComputeIfAbsentCommand
public Object visitComputeIfAbsentCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeIfAbsentCommand command) throws Throwable
- Specified by:
visitComputeIfAbsentCommand
in interfaceVisitor
- Overrides:
visitComputeIfAbsentCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitGetKeysInGroupCommand
public Object visitGetKeysInGroupCommand(InvocationContext ctx, org.infinispan.commands.remote.GetKeysInGroupCommand command) throws Throwable
- Specified by:
visitGetKeysInGroupCommand
in interfaceVisitor
- Overrides:
visitGetKeysInGroupCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitEntrySetCommand
public Object visitEntrySetCommand(InvocationContext ctx, org.infinispan.commands.read.EntrySetCommand command) throws Throwable
- Specified by:
visitEntrySetCommand
in interfaceVisitor
- Overrides:
visitEntrySetCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitKeySetCommand
public Object visitKeySetCommand(InvocationContext ctx, org.infinispan.commands.read.KeySetCommand command) throws Throwable
- Specified by:
visitKeySetCommand
in interfaceVisitor
- Overrides:
visitKeySetCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReadOnlyKeyCommand
public Object visitReadOnlyKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyKeyCommand command) throws Throwable
- Specified by:
visitReadOnlyKeyCommand
in interfaceVisitor
- Overrides:
visitReadOnlyKeyCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReadOnlyManyCommand
public Object visitReadOnlyManyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyManyCommand command) throws Throwable
- Specified by:
visitReadOnlyManyCommand
in interfaceVisitor
- Overrides:
visitReadOnlyManyCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReadWriteKeyCommand
public Object visitReadWriteKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteKeyCommand command) throws Throwable
- Specified by:
visitReadWriteKeyCommand
in interfaceVisitor
- Overrides:
visitReadWriteKeyCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReadWriteKeyValueCommand
public Object visitReadWriteKeyValueCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteKeyValueCommand command) throws Throwable
- Specified by:
visitReadWriteKeyValueCommand
in interfaceVisitor
- Overrides:
visitReadWriteKeyValueCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReadWriteManyCommand
public Object visitReadWriteManyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteManyCommand command) throws Throwable
- Specified by:
visitReadWriteManyCommand
in interfaceVisitor
- Overrides:
visitReadWriteManyCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReadWriteManyEntriesCommand
public Object visitReadWriteManyEntriesCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteManyEntriesCommand command) throws Throwable
- Specified by:
visitReadWriteManyEntriesCommand
in interfaceVisitor
- Overrides:
visitReadWriteManyEntriesCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitSizeCommand
public Object visitSizeCommand(InvocationContext ctx, org.infinispan.commands.read.SizeCommand command) throws Throwable
- Specified by:
visitSizeCommand
in interfaceVisitor
- Overrides:
visitSizeCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
isConditional
protected final boolean isConditional(org.infinispan.commands.write.WriteCommand cmd)
-
hasSkipLoadFlag
protected final boolean hasSkipLoadFlag(FlagAffectedCommand cmd)
-
canLoad
protected boolean canLoad(Object key)
-
loadIfNeeded
protected final Boolean loadIfNeeded(InvocationContext ctx, Object key, FlagAffectedCommand cmd)
Loads from the cache loader the entry for the given key. A found value is loaded into the current context. The method returns whether the value was found or not, or even if the cache loader was checked.- Parameters:
ctx
- The current invocation's contextkey
- The key for the entry to look upcmd
- The command that was called that now wants to query the cache loader- Returns:
- Whether or not the entry was found in the cache loader. A value of null means the cache loader was never queried for the value, so it was neither a hit or a miss.
- Throws:
Throwable
-
skipLoadForWriteCommand
protected boolean skipLoadForWriteCommand(org.infinispan.commands.write.WriteCommand cmd, Object key, InvocationContext ctx)
-
sendNotification
protected void sendNotification(Object key, Object value, boolean pre, InvocationContext ctx, FlagAffectedCommand cmd)
-
getCacheLoaderLoads
public long getCacheLoaderLoads()
-
getCacheLoaderMisses
public long getCacheLoaderMisses()
-
resetStatistics
public void resetStatistics()
Description copied from class:JmxStatsCommandInterceptor
Resets statistics gathered. Is a no-op, and should be overridden if it is to be meaningful.- Specified by:
resetStatistics
in interfaceJmxStatisticsExposer
- Overrides:
resetStatistics
in classJmxStatsCommandInterceptor
-
getStores
public Collection<String> getStores()
-
disableStore
public void disableStore(String storeType)
-
-