Class ScatteredDistributionInterceptor
- java.lang.Object
-
- org.infinispan.interceptors.BaseAsyncInterceptor
-
- org.infinispan.interceptors.DDAsyncInterceptor
-
- org.infinispan.interceptors.impl.BaseRpcInterceptor
-
- org.infinispan.interceptors.impl.ClusteringInterceptor
-
- org.infinispan.interceptors.distribution.ScatteredDistributionInterceptor
-
- All Implemented Interfaces:
Visitor,AsyncInterceptor
- Direct Known Subclasses:
BiasedScatteredDistributionInterceptor
public class ScatteredDistributionInterceptor extends ClusteringInterceptor
This interceptor mixes several functions: A) replicates changes to other nodes B) commits the entry C) schedules invalidation On primary owner, the commit is executed before the change is replicated to other node. If the command reads previous value and the version of entry inDataContainerhas changed during executionConcurrentChangeExceptionis thrown and the command has to be retried.- Author:
- Radim Vansa <rvansa@redhat.com>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classScatteredDistributionInterceptor.PrimaryResponseGeneratorprotected classScatteredDistributionInterceptor.PrimaryResponseHandler-
Nested classes/interfaces inherited from class org.infinispan.interceptors.impl.ClusteringInterceptor
ClusteringInterceptor.ClusteredGetAllFuture
-
-
Field Summary
Fields Modifier and Type Field Description protected CacheNotifiercacheNotifierprotected FunctionalNotifierfunctionalNotifierprotected GroupManagergroupManagerprotected KeyPartitionerkeyPartitionerprotected ScatteredVersionManager<Object>svmprotected org.infinispan.commons.time.TimeServicetimeService-
Fields inherited from class org.infinispan.interceptors.impl.ClusteringInterceptor
cf, dataContainer, distributionManager, entryFactory, lockManager
-
Fields inherited from class org.infinispan.interceptors.impl.BaseRpcInterceptor
componentRegistry, defaultSynchronous, rpcManager
-
Fields inherited from class org.infinispan.interceptors.BaseAsyncInterceptor
cacheConfiguration
-
-
Constructor Summary
Constructors Constructor Description ScatteredDistributionInterceptor()
-
Method Summary
-
Methods inherited from class org.infinispan.interceptors.impl.ClusteringInterceptor
getSuccessfulResponseOrFail, unexpected
-
Methods inherited from class org.infinispan.interceptors.impl.BaseRpcInterceptor
init, isLocalModeForced, isSynchronous, shouldInvokeRemoteTxCommand, transactionRemotelyPrepared
-
Methods inherited from class org.infinispan.interceptors.DDAsyncInterceptor
handleDefault, visitCommand, visitCommitCommand, visitEntrySetCommand, visitInvalidateCommand, visitInvalidateL1Command, visitKeySetCommand, visitLockControlCommand, visitPrepareCommand, visitRollbackCommand, visitSizeCommand, visitUnknownCommand
-
Methods inherited from class org.infinispan.interceptors.BaseAsyncInterceptor
asyncInvokeNext, asyncInvokeNext, asyncInvokeNext, asyncValue, delayedNull, 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
visitRemoveExpiredCommand
-
-
-
-
Field Detail
-
svm
protected ScatteredVersionManager<Object> svm
-
groupManager
protected GroupManager groupManager
-
timeService
protected org.infinispan.commons.time.TimeService timeService
-
cacheNotifier
protected CacheNotifier cacheNotifier
-
functionalNotifier
protected FunctionalNotifier functionalNotifier
-
keyPartitioner
protected KeyPartitioner keyPartitioner
-
-
Method Detail
-
start
public void start()
-
visitEvictCommand
public Object visitEvictCommand(InvocationContext ctx, EvictCommand command)
- Specified by:
visitEvictCommandin interfaceVisitor- Overrides:
visitEvictCommandin classDDAsyncInterceptor
-
singleWriteOnRemotePrimary
protected CompletionStage<ValidResponse> singleWriteOnRemotePrimary(Address target, DataWriteCommand command)
This method is called by a non-owner sending write request to the primary owner
-
manyWriteOnRemotePrimary
protected CompletionStage<ValidResponse> manyWriteOnRemotePrimary(Address target, WriteCommand command, CommandAckCollector.MultiTargetCollector multiTargetCollector)
-
completeSingleWriteOnPrimaryOriginator
protected CompletionStage<?> completeSingleWriteOnPrimaryOriginator(DataWriteCommand command, Address backup, CompletionStage<?> rpcFuture)
This is a hook for bias-enabled mode where the primary performs additional RPCs but replication to another node. The returned CF will be complete when both the providedrpcFuturecompletes and all additional RPCs are complete, too. Failure in any of the RPCs will fail this future.
-
scheduleKeyInvalidation
protected void scheduleKeyInvalidation(Object key, EntryVersion nextVersion, boolean removed)
-
visitPutKeyValueCommand
public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable
- Specified by:
visitPutKeyValueCommandin interfaceVisitor- Overrides:
visitPutKeyValueCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitRemoveCommand
public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable
- Specified by:
visitRemoveCommandin interfaceVisitor- Overrides:
visitRemoveCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitReplaceCommand
public Object visitReplaceCommand(InvocationContext ctx, ReplaceCommand command) throws Throwable
- Specified by:
visitReplaceCommandin interfaceVisitor- Overrides:
visitReplaceCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitComputeIfAbsentCommand
public Object visitComputeIfAbsentCommand(InvocationContext ctx, ComputeIfAbsentCommand command) throws Throwable
- Specified by:
visitComputeIfAbsentCommandin interfaceVisitor- Overrides:
visitComputeIfAbsentCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitComputeCommand
public Object visitComputeCommand(InvocationContext ctx, ComputeCommand command) throws Throwable
- Specified by:
visitComputeCommandin interfaceVisitor- Overrides:
visitComputeCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitPutMapCommand
public Object visitPutMapCommand(InvocationContext ctx, PutMapCommand command) throws Throwable
- Specified by:
visitPutMapCommandin interfaceVisitor- Overrides:
visitPutMapCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitGetKeyValueCommand
public Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable
- Specified by:
visitGetKeyValueCommandin interfaceVisitor- Overrides:
visitGetKeyValueCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitGetCacheEntryCommand
public Object visitGetCacheEntryCommand(InvocationContext ctx, GetCacheEntryCommand command) throws Throwable
- Specified by:
visitGetCacheEntryCommandin interfaceVisitor- Overrides:
visitGetCacheEntryCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitGetAllCommand
public Object visitGetAllCommand(InvocationContext ctx, GetAllCommand command) throws Throwable
- Specified by:
visitGetAllCommandin interfaceVisitor- Overrides:
visitGetAllCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitClearCommand
public Object visitClearCommand(InvocationContext ctx, ClearCommand command) throws Throwable
- Specified by:
visitClearCommandin interfaceVisitor- Overrides:
visitClearCommandin classDDAsyncInterceptor- Throws:
Throwable
-
handleClear
protected Object handleClear(InvocationContext ctx, ClearCommand command, Object ignored)
-
visitReadOnlyKeyCommand
public Object visitReadOnlyKeyCommand(InvocationContext ctx, ReadOnlyKeyCommand command) throws Throwable
- Specified by:
visitReadOnlyKeyCommandin interfaceVisitor- Overrides:
visitReadOnlyKeyCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitReadOnlyManyCommand
public Object visitReadOnlyManyCommand(InvocationContext ctx, ReadOnlyManyCommand command) throws Throwable
- Specified by:
visitReadOnlyManyCommandin interfaceVisitor- Overrides:
visitReadOnlyManyCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitWriteOnlyKeyCommand
public Object visitWriteOnlyKeyCommand(InvocationContext ctx, WriteOnlyKeyCommand command) throws Throwable
- Specified by:
visitWriteOnlyKeyCommandin interfaceVisitor- Overrides:
visitWriteOnlyKeyCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitReadWriteKeyValueCommand
public Object visitReadWriteKeyValueCommand(InvocationContext ctx, ReadWriteKeyValueCommand command) throws Throwable
- Specified by:
visitReadWriteKeyValueCommandin interfaceVisitor- Overrides:
visitReadWriteKeyValueCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitReadWriteKeyCommand
public Object visitReadWriteKeyCommand(InvocationContext ctx, ReadWriteKeyCommand command) throws Throwable
- Specified by:
visitReadWriteKeyCommandin interfaceVisitor- Overrides:
visitReadWriteKeyCommandin classDDAsyncInterceptor- Throws:
Throwable
-
createMultiTargetCollector
protected <C extends WriteCommand> CommandAckCollector.MultiTargetCollector createMultiTargetCollector(C command, int primaries)
-
visitWriteOnlyManyEntriesCommand
public Object visitWriteOnlyManyEntriesCommand(InvocationContext ctx, WriteOnlyManyEntriesCommand command) throws Throwable
- Specified by:
visitWriteOnlyManyEntriesCommandin interfaceVisitor- Overrides:
visitWriteOnlyManyEntriesCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitWriteOnlyKeyValueCommand
public Object visitWriteOnlyKeyValueCommand(InvocationContext ctx, WriteOnlyKeyValueCommand command) throws Throwable
- Specified by:
visitWriteOnlyKeyValueCommandin interfaceVisitor- Overrides:
visitWriteOnlyKeyValueCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitWriteOnlyManyCommand
public Object visitWriteOnlyManyCommand(InvocationContext ctx, WriteOnlyManyCommand command) throws Throwable
- Specified by:
visitWriteOnlyManyCommandin interfaceVisitor- Overrides:
visitWriteOnlyManyCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitReadWriteManyCommand
public Object visitReadWriteManyCommand(InvocationContext ctx, ReadWriteManyCommand command) throws Throwable
- Specified by:
visitReadWriteManyCommandin interfaceVisitor- Overrides:
visitReadWriteManyCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitReadWriteManyEntriesCommand
public Object visitReadWriteManyEntriesCommand(InvocationContext ctx, ReadWriteManyEntriesCommand command) throws Throwable
- Specified by:
visitReadWriteManyEntriesCommandin interfaceVisitor- Overrides:
visitReadWriteManyEntriesCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitGetKeysInGroupCommand
public final Object visitGetKeysInGroupCommand(InvocationContext ctx, GetKeysInGroupCommand command) throws Throwable
- Specified by:
visitGetKeysInGroupCommandin interfaceVisitor- Overrides:
visitGetKeysInGroupCommandin classDDAsyncInterceptor- Throws:
Throwable
-
getLog
protected Log getLog()
- Specified by:
getLogin classBaseRpcInterceptor
-
singleWriteResponse
protected Object singleWriteResponse(InvocationContext ctx, DataWriteCommand cmd, Object returnValue)
This method is called by primary owner responding to the originator after write has been completed
-
manyWriteResponse
protected Object manyWriteResponse(InvocationContext ctx, WriteCommand cmd, Object returnValue)
-
completeManyWriteOnPrimaryOriginator
protected void completeManyWriteOnPrimaryOriginator(WriteCommand command, Address backup, org.infinispan.interceptors.distribution.CountDownCompletableFuture future)
This is a hook for bias-enabled mode where the primary performs additional RPCs but replication to another node. Implementation is expected to incrementfutureon each additional RPC and decrement it when the response arrives.
-
-