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.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 inDataContainer
has changed during executionConcurrentChangeException
is 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 class
ScatteredDistributionInterceptor.PrimaryResponseGenerator
protected class
ScatteredDistributionInterceptor.PrimaryResponseHandler
-
Field Summary
Fields Modifier and Type Field Description protected CacheNotifier
cacheNotifier
protected org.infinispan.functional.impl.FunctionalNotifier
functionalNotifier
protected org.infinispan.distribution.group.impl.GroupManager
groupManager
protected KeyPartitioner
keyPartitioner
protected ScatteredVersionManager<Object>
svm
protected TimeService
timeService
-
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 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.protected CompletionStage<?>
completeSingleWriteOnPrimaryOriginator(org.infinispan.commands.write.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.protected <C extends org.infinispan.commands.write.WriteCommand>
CommandAckCollector.MultiTargetCollectorcreateMultiTargetCollector(C command, int primaries)
protected org.infinispan.util.logging.Log
getLog()
protected void
handleClear(InvocationContext ctx, org.infinispan.commands.VisitableCommand command, Object ignored)
protected CompletionStage<ValidResponse>
manyWriteOnRemotePrimary(Address target, org.infinispan.commands.write.WriteCommand command, CommandAckCollector.MultiTargetCollector multiTargetCollector)
protected Object
manyWriteResponse(InvocationContext ctx, org.infinispan.commands.write.WriteCommand cmd, Object returnValue)
protected void
scheduleKeyInvalidation(Object key, EntryVersion nextVersion, boolean removed)
protected 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 Object
singleWriteResponse(InvocationContext ctx, org.infinispan.commands.write.DataWriteCommand cmd, Object returnValue)
This method is called by primary owner responding to the originator after write has been completedObject
visitClearCommand(InvocationContext ctx, org.infinispan.commands.write.ClearCommand command)
Object
visitComputeCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeCommand command)
Object
visitComputeIfAbsentCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeIfAbsentCommand command)
Object
visitEvictCommand(InvocationContext ctx, org.infinispan.commands.write.EvictCommand 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
visitPutKeyValueCommand(InvocationContext ctx, org.infinispan.commands.write.PutKeyValueCommand command)
Object
visitPutMapCommand(InvocationContext ctx, org.infinispan.commands.write.PutMapCommand 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
visitWriteOnlyKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyKeyCommand command)
Object
visitWriteOnlyKeyValueCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyKeyValueCommand command)
Object
visitWriteOnlyManyCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyManyCommand command)
Object
visitWriteOnlyManyEntriesCommand(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, visitDistributedExecuteCommand, visitEntrySetCommand, visitInvalidateCommand, visitInvalidateL1Command, visitKeySetCommand, visitLockControlCommand, visitPrepareCommand, 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
-
-
-
-
Field Detail
-
svm
protected ScatteredVersionManager<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 Object visitEvictCommand(InvocationContext ctx, org.infinispan.commands.write.EvictCommand command)
- Specified by:
visitEvictCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitEvictCommand
in classDDAsyncInterceptor
-
singleWriteOnRemotePrimary
protected 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 CompletionStage<ValidResponse> manyWriteOnRemotePrimary(Address target, org.infinispan.commands.write.WriteCommand command, CommandAckCollector.MultiTargetCollector multiTargetCollector)
-
completeSingleWriteOnPrimaryOriginator
protected CompletionStage<?> completeSingleWriteOnPrimaryOriginator(org.infinispan.commands.write.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 providedrpcFuture
completes 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, org.infinispan.commands.write.PutKeyValueCommand command) throws Throwable
- Specified by:
visitPutKeyValueCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitPutKeyValueCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitRemoveCommand
public Object visitRemoveCommand(InvocationContext ctx, org.infinispan.commands.write.RemoveCommand command) throws Throwable
- Specified by:
visitRemoveCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitRemoveCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReplaceCommand
public Object visitReplaceCommand(InvocationContext ctx, org.infinispan.commands.write.ReplaceCommand command) throws Throwable
- Specified by:
visitReplaceCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitReplaceCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitComputeIfAbsentCommand
public Object visitComputeIfAbsentCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeIfAbsentCommand command) throws Throwable
- Specified by:
visitComputeIfAbsentCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitComputeIfAbsentCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitComputeCommand
public Object visitComputeCommand(InvocationContext ctx, org.infinispan.commands.write.ComputeCommand command) throws Throwable
- Specified by:
visitComputeCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitComputeCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitPutMapCommand
public Object visitPutMapCommand(InvocationContext ctx, org.infinispan.commands.write.PutMapCommand command) throws Throwable
- Specified by:
visitPutMapCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitPutMapCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitGetKeyValueCommand
public Object visitGetKeyValueCommand(InvocationContext ctx, org.infinispan.commands.read.GetKeyValueCommand command) throws Throwable
- Specified by:
visitGetKeyValueCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitGetKeyValueCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitGetCacheEntryCommand
public Object visitGetCacheEntryCommand(InvocationContext ctx, org.infinispan.commands.read.GetCacheEntryCommand command) throws Throwable
- Specified by:
visitGetCacheEntryCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitGetCacheEntryCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitGetAllCommand
public Object visitGetAllCommand(InvocationContext ctx, org.infinispan.commands.read.GetAllCommand command) throws Throwable
- Specified by:
visitGetAllCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitGetAllCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitClearCommand
public Object visitClearCommand(InvocationContext ctx, org.infinispan.commands.write.ClearCommand command) throws Throwable
- Specified by:
visitClearCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitClearCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
handleClear
protected void handleClear(InvocationContext ctx, org.infinispan.commands.VisitableCommand command, Object ignored)
-
visitReadOnlyKeyCommand
public Object visitReadOnlyKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyKeyCommand command) throws Throwable
- Specified by:
visitReadOnlyKeyCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitReadOnlyKeyCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReadOnlyManyCommand
public Object visitReadOnlyManyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyManyCommand command) throws Throwable
- Specified by:
visitReadOnlyManyCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitReadOnlyManyCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitWriteOnlyKeyCommand
public Object visitWriteOnlyKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyKeyCommand command) throws Throwable
- Specified by:
visitWriteOnlyKeyCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitWriteOnlyKeyCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReadWriteKeyValueCommand
public Object visitReadWriteKeyValueCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteKeyValueCommand command) throws Throwable
- Specified by:
visitReadWriteKeyValueCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitReadWriteKeyValueCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReadWriteKeyCommand
public Object visitReadWriteKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteKeyCommand command) throws Throwable
- Specified by:
visitReadWriteKeyCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitReadWriteKeyCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
createMultiTargetCollector
protected <C extends org.infinispan.commands.write.WriteCommand> CommandAckCollector.MultiTargetCollector createMultiTargetCollector(C command, int primaries)
-
visitWriteOnlyManyEntriesCommand
public Object visitWriteOnlyManyEntriesCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyManyEntriesCommand command) throws Throwable
- Specified by:
visitWriteOnlyManyEntriesCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitWriteOnlyManyEntriesCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitWriteOnlyKeyValueCommand
public Object visitWriteOnlyKeyValueCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyKeyValueCommand command) throws Throwable
- Specified by:
visitWriteOnlyKeyValueCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitWriteOnlyKeyValueCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitWriteOnlyManyCommand
public Object visitWriteOnlyManyCommand(InvocationContext ctx, org.infinispan.commands.functional.WriteOnlyManyCommand command) throws Throwable
- Specified by:
visitWriteOnlyManyCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitWriteOnlyManyCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReadWriteManyCommand
public Object visitReadWriteManyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteManyCommand command) throws Throwable
- Specified by:
visitReadWriteManyCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitReadWriteManyCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitReadWriteManyEntriesCommand
public Object visitReadWriteManyEntriesCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadWriteManyEntriesCommand command) throws Throwable
- Specified by:
visitReadWriteManyEntriesCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitReadWriteManyEntriesCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
visitGetKeysInGroupCommand
public final Object visitGetKeysInGroupCommand(InvocationContext ctx, org.infinispan.commands.remote.GetKeysInGroupCommand command) throws Throwable
- Specified by:
visitGetKeysInGroupCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitGetKeysInGroupCommand
in classDDAsyncInterceptor
- Throws:
Throwable
-
getLog
protected org.infinispan.util.logging.Log getLog()
- Specified by:
getLog
in classorg.infinispan.interceptors.impl.BaseRpcInterceptor
-
singleWriteResponse
protected Object singleWriteResponse(InvocationContext ctx, org.infinispan.commands.write.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, org.infinispan.commands.write.WriteCommand cmd, 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 incrementfuture
on each additional RPC and decrement it when the response arrives.
-
-