Package org.infinispan.interceptors.impl
Class DistCacheWriterInterceptor
- java.lang.Object
-
- org.infinispan.interceptors.BaseAsyncInterceptor
-
- org.infinispan.interceptors.DDAsyncInterceptor
-
- org.infinispan.interceptors.impl.JmxStatsCommandInterceptor
-
- org.infinispan.interceptors.impl.CacheWriterInterceptor
-
- org.infinispan.interceptors.impl.DistCacheWriterInterceptor
-
- All Implemented Interfaces:
Visitor
,AsyncInterceptor
,JmxStatisticsExposer
public class DistCacheWriterInterceptor extends CacheWriterInterceptor
Cache store interceptor specific for the distribution and replication cache modes.If the cache store is shared, only the primary owner of the key writes to the cache store.
If the cache store is not shared, every owner of a key writes to the cache store.
In non-tx caches, if the originator is an owner, the command is executed there twice. The first time, (
isOriginLocal() == true
) we don't write anything to the cache store; the second time, the normal rules apply.For clear operations, either only the originator of the command clears the cache store (if it is shared), or every node clears its cache store (if it is not shared). Note that in non-tx caches, this happens without holding a lock on the primary owner of all the keys.
- Since:
- 9.0
- Author:
- Galder ZamarreƱo, Dan Berindei
-
-
Field Summary
-
Fields inherited from class org.infinispan.interceptors.impl.CacheWriterInterceptor
handlePutMapCommandReturn, persistenceManager
-
Fields inherited from class org.infinispan.interceptors.BaseAsyncInterceptor
cacheConfiguration
-
-
Constructor Summary
Constructors Constructor Description DistCacheWriterInterceptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Log
getLog()
protected void
handlePutMapCommandReturn(InvocationContext rCtx, VisitableCommand rCommand, Object rv)
protected boolean
isProperWriter(InvocationContext ctx, FlagAffectedCommand command, Object key)
protected boolean
skipSharedStores(InvocationContext ctx, Object key, FlagAffectedCommand command)
protected void
start()
Object
visitComputeCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeCommand command)
Object
visitComputeIfAbsentCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeIfAbsentCommand command)
Object
visitPutKeyValueCommand(InvocationContext ctx, org.infinispan.commands.write.PutKeyValueCommand command)
Object
visitPutMapCommand(InvocationContext ctx, org.infinispan.commands.write.PutMapCommand command)
Object
visitRemoveCommand(InvocationContext ctx, org.infinispan.commands.write.RemoveCommand command)
Object
visitReplaceCommand(InvocationContext ctx, org.infinispan.commands.write.ReplaceCommand command)
-
Methods inherited from class org.infinispan.interceptors.impl.CacheWriterInterceptor
commitCommand, getNumberOfPersistedEntries, getWritesToTheStores, isStoreEnabled, processIterableBatch, resetStatistics, store, visitClearCommand, visitCommitCommand, visitPrepareCommand, visitReadWriteKeyCommand, visitReadWriteKeyValueCommand, visitReadWriteManyCommand, visitReadWriteManyEntriesCommand, visitWriteOnlyKeyCommand, visitWriteOnlyKeyValueCommand, visitWriteOnlyManyCommand, visitWriteOnlyManyEntriesCommand
-
Methods inherited from class org.infinispan.interceptors.impl.JmxStatsCommandInterceptor
checkStatisticsUsed, getStatisticsEnabled, setStatisticsEnabled
-
Methods inherited from class org.infinispan.interceptors.DDAsyncInterceptor
handleDefault, visitCommand, visitDistributedExecuteCommand, visitEntrySetCommand, visitEvictCommand, visitGetAllCommand, visitGetCacheEntryCommand, visitGetKeysInGroupCommand, visitGetKeyValueCommand, visitInvalidateCommand, visitInvalidateL1Command, visitKeySetCommand, visitLockControlCommand, visitReadOnlyKeyCommand, visitReadOnlyManyCommand, visitRollbackCommand, visitSizeCommand, visitUnknownCommand
-
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
-
-
-
-
Method Detail
-
getLog
protected Log getLog()
- Overrides:
getLog
in classCacheWriterInterceptor
-
start
protected void start()
- Overrides:
start
in classCacheWriterInterceptor
-
visitPutKeyValueCommand
public Object visitPutKeyValueCommand(InvocationContext ctx, org.infinispan.commands.write.PutKeyValueCommand command) throws Throwable
- Specified by:
visitPutKeyValueCommand
in interfaceVisitor
- Overrides:
visitPutKeyValueCommand
in classCacheWriterInterceptor
- Throws:
Throwable
-
visitPutMapCommand
public Object visitPutMapCommand(InvocationContext ctx, org.infinispan.commands.write.PutMapCommand command) throws Throwable
- Specified by:
visitPutMapCommand
in interfaceVisitor
- Overrides:
visitPutMapCommand
in classCacheWriterInterceptor
- Throws:
Throwable
-
handlePutMapCommandReturn
protected void handlePutMapCommandReturn(InvocationContext rCtx, VisitableCommand rCommand, Object rv)
- Overrides:
handlePutMapCommandReturn
in classCacheWriterInterceptor
-
visitRemoveCommand
public Object visitRemoveCommand(InvocationContext ctx, org.infinispan.commands.write.RemoveCommand command) throws Throwable
- Specified by:
visitRemoveCommand
in interfaceVisitor
- Overrides:
visitRemoveCommand
in classCacheWriterInterceptor
- Throws:
Throwable
-
visitReplaceCommand
public Object visitReplaceCommand(InvocationContext ctx, org.infinispan.commands.write.ReplaceCommand command) throws Throwable
- Specified by:
visitReplaceCommand
in interfaceVisitor
- Overrides:
visitReplaceCommand
in classCacheWriterInterceptor
- Throws:
Throwable
-
visitComputeCommand
public Object visitComputeCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeCommand command) throws Throwable
- Specified by:
visitComputeCommand
in interfaceVisitor
- Overrides:
visitComputeCommand
in classCacheWriterInterceptor
- Throws:
Throwable
-
visitComputeIfAbsentCommand
public Object visitComputeIfAbsentCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeIfAbsentCommand command) throws Throwable
- Specified by:
visitComputeIfAbsentCommand
in interfaceVisitor
- Overrides:
visitComputeIfAbsentCommand
in classCacheWriterInterceptor
- Throws:
Throwable
-
skipSharedStores
protected boolean skipSharedStores(InvocationContext ctx, Object key, FlagAffectedCommand command)
- Overrides:
skipSharedStores
in classCacheWriterInterceptor
-
isProperWriter
protected boolean isProperWriter(InvocationContext ctx, FlagAffectedCommand command, Object key)
- Overrides:
isProperWriter
in classCacheWriterInterceptor
-
-