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:
org.infinispan.commands.Visitor,AsyncInterceptor
- Direct Known Subclasses:
BiasedScatteredDistributionInterceptor
public class ScatteredDistributionInterceptor extends org.infinispan.interceptors.impl.ClusteringInterceptorThis 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
-
Field Summary
Fields Modifier and Type Field Description protected CacheNotifiercacheNotifierprotected org.infinispan.functional.impl.FunctionalNotifierfunctionalNotifierprotected org.infinispan.distribution.group.impl.GroupManagergroupManagerprotected KeyPartitionerkeyPartitionerprotected ScatteredVersionManager<java.lang.Object>svmprotected 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcompleteManyWriteOnPrimaryOriginator(org.infinispan.commands.write.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.protected java.util.concurrent.CompletionStage<?>completeSingleWriteOnPrimaryOriginator(org.infinispan.commands.write.DataWriteCommand command, Address backup, java.util.concurrent.CompletionStage<?> rpcFuture)This is a hook for bias-enabled mode where the primary performs additional RPCs but replication to another node.protected <C extends org.infinispan.commands.write.WriteCommand>
CommandAckCollector.MultiTargetCollectorcreateMultiTargetCollector(C command, int primaries)protected org.infinispan.util.logging.LoggetLog()protected voidhandleClear(InvocationContext ctx, org.infinispan.commands.VisitableCommand command, java.lang.Object ignored)protected java.util.concurrent.CompletionStage<ValidResponse>manyWriteOnRemotePrimary(Address target, org.infinispan.commands.write.WriteCommand command, CommandAckCollector.MultiTargetCollector multiTargetCollector)protected java.lang.ObjectmanyWriteResponse(InvocationContext ctx, org.infinispan.commands.write.WriteCommand cmd, java.lang.Object returnValue)protected voidscheduleKeyInvalidation(java.lang.Object key, EntryVersion nextVersion, boolean removed)protected java.util.concurrent.CompletionStage<ValidResponse>singleWriteOnRemotePrimary(Address target, org.infinispan.commands.write.DataWriteCommand command)This method is called by a non-owner sending write request to the primary ownerprotected java.lang.ObjectsingleWriteResponse(InvocationContext ctx, org.infinispan.commands.write.DataWriteCommand cmd, java.lang.Object returnValue)This method is called by primary owner responding to the originator after write has been completedjava.lang.ObjectvisitClearCommand(InvocationContext ctx, org.infinispan.commands.write.ClearCommand command)java.lang.ObjectvisitComputeCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeCommand command)java.lang.ObjectvisitComputeIfAbsentCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeIfAbsentCommand command)java.lang.ObjectvisitEvictCommand(InvocationContext ctx, org.infinispan.commands.write.EvictCommand command)java.lang.ObjectvisitGetAllCommand(InvocationContext ctx, org.infinispan.commands.read.GetAllCommand command)java.lang.ObjectvisitGetCacheEntryCommand(InvocationContext ctx, org.infinispan.commands.read.GetCacheEntryCommand command)java.lang.ObjectvisitGetKeysInGroupCommand(InvocationContext ctx, org.infinispan.commands.remote.GetKeysInGroupCommand command)java.lang.ObjectvisitGetKeyValueCommand(InvocationContext ctx, org.infinispan.commands.read.GetKeyValueCommand command)java.lang.ObjectvisitPutKeyValueCommand(InvocationContext ctx, org.infinispan.commands.write.PutKeyValueCommand command)java.lang.ObjectvisitPutMapCommand(InvocationContext ctx, org.infinispan.commands.write.PutMapCommand command)java.lang.ObjectvisitReadOnlyKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyKeyCommand command)java.lang.ObjectvisitReadOnlyManyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyManyCommand command)java.lang.ObjectvisitReadWriteKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteKeyCommand command)java.lang.ObjectvisitReadWriteKeyValueCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteKeyValueCommand command)java.lang.ObjectvisitReadWriteManyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteManyCommand command)java.lang.ObjectvisitReadWriteManyEntriesCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteManyEntriesCommand command)java.lang.ObjectvisitRemoveCommand(InvocationContext ctx, org.infinispan.commands.write.RemoveCommand command)java.lang.ObjectvisitRemoveExpiredCommand(InvocationContext ctx, org.infinispan.commands.write.RemoveExpiredCommand command)java.lang.ObjectvisitReplaceCommand(InvocationContext ctx, org.infinispan.commands.write.ReplaceCommand command)java.lang.ObjectvisitWriteOnlyKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyKeyCommand command)java.lang.ObjectvisitWriteOnlyKeyValueCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyKeyValueCommand command)java.lang.ObjectvisitWriteOnlyManyCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyManyCommand command)java.lang.ObjectvisitWriteOnlyManyEntriesCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyManyEntriesCommand command)-
Methods inherited from class org.infinispan.interceptors.impl.ClusteringInterceptor
getSuccessfulResponseOrFail, unexpected
-
Methods inherited from class org.infinispan.interceptors.impl.BaseRpcInterceptor
init, isLocalModeForced, isSynchronous, shouldInvokeRemoteTxCommand, shouldTotalOrderRollbackBeInvokedRemotely, totalOrderPrepare, totalOrderTxCommit, totalOrderTxRollback, 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, invokeNext, invokeNextAndExceptionally, invokeNextAndFinally, invokeNextAndHandle, invokeNextThenAccept, invokeNextThenApply, isSuccessfullyDone, makeStage, setNextInterceptor, valueOrException
-
-
-
-
Field Detail
-
svm
protected ScatteredVersionManager<java.lang.Object> svm
-
groupManager
protected org.infinispan.distribution.group.impl.GroupManager groupManager
-
timeService
protected TimeService timeService
-
cacheNotifier
protected CacheNotifier cacheNotifier
-
functionalNotifier
protected org.infinispan.functional.impl.FunctionalNotifier functionalNotifier
-
keyPartitioner
protected KeyPartitioner keyPartitioner
-
-
Method Detail
-
visitEvictCommand
public java.lang.Object visitEvictCommand(InvocationContext ctx, org.infinispan.commands.write.EvictCommand command)
- Specified by:
visitEvictCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitEvictCommandin classDDAsyncInterceptor
-
singleWriteOnRemotePrimary
protected java.util.concurrent.CompletionStage<ValidResponse> singleWriteOnRemotePrimary(Address target, org.infinispan.commands.write.DataWriteCommand command)
This method is called by a non-owner sending write request to the primary owner
-
manyWriteOnRemotePrimary
protected java.util.concurrent.CompletionStage<ValidResponse> manyWriteOnRemotePrimary(Address target, org.infinispan.commands.write.WriteCommand command, CommandAckCollector.MultiTargetCollector multiTargetCollector)
-
completeSingleWriteOnPrimaryOriginator
protected java.util.concurrent.CompletionStage<?> completeSingleWriteOnPrimaryOriginator(org.infinispan.commands.write.DataWriteCommand command, Address backup, java.util.concurrent.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(java.lang.Object key, EntryVersion nextVersion, boolean removed)
-
visitPutKeyValueCommand
public java.lang.Object visitPutKeyValueCommand(InvocationContext ctx, org.infinispan.commands.write.PutKeyValueCommand command) throws java.lang.Throwable
- Specified by:
visitPutKeyValueCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitPutKeyValueCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
visitRemoveCommand
public java.lang.Object visitRemoveCommand(InvocationContext ctx, org.infinispan.commands.write.RemoveCommand command) throws java.lang.Throwable
- Specified by:
visitRemoveCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitRemoveCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
visitRemoveExpiredCommand
public java.lang.Object visitRemoveExpiredCommand(InvocationContext ctx, org.infinispan.commands.write.RemoveExpiredCommand command) throws java.lang.Throwable
- Throws:
java.lang.Throwable
-
visitReplaceCommand
public java.lang.Object visitReplaceCommand(InvocationContext ctx, org.infinispan.commands.write.ReplaceCommand command) throws java.lang.Throwable
- Specified by:
visitReplaceCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitReplaceCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
visitComputeIfAbsentCommand
public java.lang.Object visitComputeIfAbsentCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeIfAbsentCommand command) throws java.lang.Throwable
- Specified by:
visitComputeIfAbsentCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitComputeIfAbsentCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
visitComputeCommand
public java.lang.Object visitComputeCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeCommand command) throws java.lang.Throwable
- Specified by:
visitComputeCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitComputeCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
visitPutMapCommand
public java.lang.Object visitPutMapCommand(InvocationContext ctx, org.infinispan.commands.write.PutMapCommand command) throws java.lang.Throwable
- Specified by:
visitPutMapCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitPutMapCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
visitGetKeyValueCommand
public java.lang.Object visitGetKeyValueCommand(InvocationContext ctx, org.infinispan.commands.read.GetKeyValueCommand command) throws java.lang.Throwable
- Specified by:
visitGetKeyValueCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitGetKeyValueCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
visitGetCacheEntryCommand
public java.lang.Object visitGetCacheEntryCommand(InvocationContext ctx, org.infinispan.commands.read.GetCacheEntryCommand command) throws java.lang.Throwable
- Specified by:
visitGetCacheEntryCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitGetCacheEntryCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
visitGetAllCommand
public java.lang.Object visitGetAllCommand(InvocationContext ctx, org.infinispan.commands.read.GetAllCommand command) throws java.lang.Throwable
- Specified by:
visitGetAllCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitGetAllCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
visitClearCommand
public java.lang.Object visitClearCommand(InvocationContext ctx, org.infinispan.commands.write.ClearCommand command) throws java.lang.Throwable
- Specified by:
visitClearCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitClearCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
handleClear
protected void handleClear(InvocationContext ctx, org.infinispan.commands.VisitableCommand command, java.lang.Object ignored)
-
visitReadOnlyKeyCommand
public java.lang.Object visitReadOnlyKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyKeyCommand command) throws java.lang.Throwable
- Specified by:
visitReadOnlyKeyCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitReadOnlyKeyCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
visitReadOnlyManyCommand
public java.lang.Object visitReadOnlyManyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyManyCommand command) throws java.lang.Throwable
- Specified by:
visitReadOnlyManyCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitReadOnlyManyCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
visitWriteOnlyKeyCommand
public java.lang.Object visitWriteOnlyKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyKeyCommand command) throws java.lang.Throwable
- Specified by:
visitWriteOnlyKeyCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitWriteOnlyKeyCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
visitReadWriteKeyValueCommand
public java.lang.Object visitReadWriteKeyValueCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteKeyValueCommand command) throws java.lang.Throwable
- Specified by:
visitReadWriteKeyValueCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitReadWriteKeyValueCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
visitReadWriteKeyCommand
public java.lang.Object visitReadWriteKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteKeyCommand command) throws java.lang.Throwable
- Specified by:
visitReadWriteKeyCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitReadWriteKeyCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
createMultiTargetCollector
protected <C extends org.infinispan.commands.write.WriteCommand> CommandAckCollector.MultiTargetCollector createMultiTargetCollector(C command, int primaries)
-
visitWriteOnlyManyEntriesCommand
public java.lang.Object visitWriteOnlyManyEntriesCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyManyEntriesCommand command) throws java.lang.Throwable
- Specified by:
visitWriteOnlyManyEntriesCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitWriteOnlyManyEntriesCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
visitWriteOnlyKeyValueCommand
public java.lang.Object visitWriteOnlyKeyValueCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyKeyValueCommand command) throws java.lang.Throwable
- Specified by:
visitWriteOnlyKeyValueCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitWriteOnlyKeyValueCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
visitWriteOnlyManyCommand
public java.lang.Object visitWriteOnlyManyCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyManyCommand command) throws java.lang.Throwable
- Specified by:
visitWriteOnlyManyCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitWriteOnlyManyCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
visitReadWriteManyCommand
public java.lang.Object visitReadWriteManyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteManyCommand command) throws java.lang.Throwable
- Specified by:
visitReadWriteManyCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitReadWriteManyCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
visitReadWriteManyEntriesCommand
public java.lang.Object visitReadWriteManyEntriesCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteManyEntriesCommand command) throws java.lang.Throwable
- Specified by:
visitReadWriteManyEntriesCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitReadWriteManyEntriesCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
visitGetKeysInGroupCommand
public final java.lang.Object visitGetKeysInGroupCommand(InvocationContext ctx, org.infinispan.commands.remote.GetKeysInGroupCommand command) throws java.lang.Throwable
- Specified by:
visitGetKeysInGroupCommandin interfaceorg.infinispan.commands.Visitor- Overrides:
visitGetKeysInGroupCommandin classDDAsyncInterceptor- Throws:
java.lang.Throwable
-
getLog
protected org.infinispan.util.logging.Log getLog()
- Specified by:
getLogin classorg.infinispan.interceptors.impl.BaseRpcInterceptor
-
singleWriteResponse
protected java.lang.Object singleWriteResponse(InvocationContext ctx, org.infinispan.commands.write.DataWriteCommand cmd, java.lang.Object returnValue)
This method is called by primary owner responding to the originator after write has been completed
-
manyWriteResponse
protected java.lang.Object manyWriteResponse(InvocationContext ctx, org.infinispan.commands.write.WriteCommand cmd, java.lang.Object returnValue)
-
completeManyWriteOnPrimaryOriginator
protected void completeManyWriteOnPrimaryOriginator(org.infinispan.commands.write.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.
-
-