Class BaseDistributionInterceptor
- 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.BaseDistributionInterceptor
-
- All Implemented Interfaces:
org.infinispan.commands.Visitor
,AsyncInterceptor
- Direct Known Subclasses:
NonTxDistributionInterceptor
,TriangleDistributionInterceptor
,TxDistributionInterceptor
public abstract class BaseDistributionInterceptor extends org.infinispan.interceptors.impl.ClusteringInterceptor
Base class for distribution of entries across a cluster.- Author:
- Manik Surtani, Mircea.Markus@jboss.com, Pete Muir, Dan Berindei <dan@infinispan.org>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
BaseDistributionInterceptor.ReadManyCommandHelper<C extends org.infinispan.commands.VisitableCommand>
protected class
BaseDistributionInterceptor.ReadOnlyManyHelper
-
Field Summary
Fields Modifier and Type Field Description protected org.infinispan.expiration.impl.InternalExpirationManager<java.lang.Object,java.lang.Object>
expirationManager
protected boolean
isL1Enabled
protected boolean
isReplicated
protected KeyPartitioner
keyPartitioner
protected RemoteValueRetrievedListener
rvrl
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 BaseDistributionInterceptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected LocalizedCacheTopology
checkTopologyId(org.infinispan.commands.TopologyAffectedCommand command)
void
configure()
protected org.infinispan.util.logging.Log
getLog()
protected <C extends org.infinispan.commands.TopologyAffectedCommand & org.infinispan.commands.FlagAffectedCommand>
java.lang.ObjecthandleFunctionalReadManyCommand(InvocationContext ctx, C command, BaseDistributionInterceptor.ReadManyCommandHelper<C> helper)
protected java.lang.Object
handleNonTxWriteCommand(InvocationContext ctx, org.infinispan.commands.write.AbstractDataWriteCommand command)
protected void
handleRemotelyRetrievedKeys(InvocationContext ctx, org.infinispan.commands.write.WriteCommand appliedCommand, java.util.List<?> remoteKeys)
protected java.lang.Object
invokeRemotely(InvocationContext ctx, org.infinispan.commands.write.DataWriteCommand command, Address primaryOwner)
protected java.lang.Object
invokeRemoveExpiredCommand(InvocationContext ctx, org.infinispan.commands.write.RemoveExpiredCommand command, DistributionInfo distributionInfo)
protected boolean
readNeedsRemoteValue(org.infinispan.commands.FlagAffectedCommand command)
protected <C extends org.infinispan.commands.FlagAffectedCommand & org.infinispan.commands.TopologyAffectedCommand>
java.util.concurrent.CompletionStage<java.lang.Void>remoteGetMany(InvocationContext ctx, C command, java.util.Collection<?> keys)
protected <C extends org.infinispan.commands.FlagAffectedCommand & org.infinispan.commands.TopologyAffectedCommand>
java.util.concurrent.CompletionStage<java.lang.Void>remoteGetSingleKey(InvocationContext ctx, C command, java.lang.Object key, boolean isWrite)
Fetch a key from its remote owners and store it in the context.protected org.infinispan.commands.functional.ReadOnlyKeyCommand
remoteReadOnlyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyKeyCommand command)
protected DistributionInfo
retrieveDistributionInfo(LocalizedCacheTopology topology, org.infinispan.commands.ReplicableCommand command, java.lang.Object key)
protected java.lang.Object[]
unwrapFunctionalManyResultOnOrigin(InvocationContext ctx, java.util.List<java.lang.Object> keys, java.lang.Object responseValue)
protected java.lang.Object
unwrapFunctionalResultOnOrigin(InvocationContext ctx, java.lang.Object key, java.lang.Object responseValue)
java.lang.Object
visitClearCommand(InvocationContext ctx, org.infinispan.commands.write.ClearCommand command)
java.lang.Object
visitGetAllCommand(InvocationContext ctx, org.infinispan.commands.read.GetAllCommand command)
java.lang.Object
visitGetCacheEntryCommand(InvocationContext ctx, org.infinispan.commands.read.GetCacheEntryCommand command)
java.lang.Object
visitGetKeysInGroupCommand(InvocationContext ctx, org.infinispan.commands.remote.GetKeysInGroupCommand command)
java.lang.Object
visitGetKeyValueCommand(InvocationContext ctx, org.infinispan.commands.read.GetKeyValueCommand command)
java.lang.Object
visitReadOnlyKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyKeyCommand command)
java.lang.Object
visitReadOnlyManyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyManyCommand command)
java.lang.Object
visitRemoveExpiredCommand(InvocationContext ctx, org.infinispan.commands.write.RemoveExpiredCommand command)
protected java.lang.Object
wrapFunctionalManyResultOnNonOrigin(InvocationContext rCtx, java.util.Collection<?> keys, java.lang.Object[] values)
protected java.lang.Object
wrapFunctionalResultOnNonOriginOnReturn(java.lang.Object rv, CacheEntry entry)
protected void
wrapRemoteEntry(InvocationContext ctx, java.lang.Object key, CacheEntry ice, boolean isWrite)
-
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, visitComputeCommand, visitComputeIfAbsentCommand, visitEntrySetCommand, visitEvictCommand, visitInvalidateCommand, visitInvalidateL1Command, visitKeySetCommand, visitLockControlCommand, visitPrepareCommand, visitPutKeyValueCommand, visitPutMapCommand, visitReadWriteKeyCommand, visitReadWriteKeyValueCommand, visitReadWriteManyCommand, visitReadWriteManyEntriesCommand, visitRemoveCommand, visitReplaceCommand, visitRollbackCommand, visitSizeCommand, visitUnknownCommand, visitWriteOnlyKeyCommand, visitWriteOnlyKeyValueCommand, visitWriteOnlyManyCommand, visitWriteOnlyManyEntriesCommand
-
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
-
-
-
-
Field Detail
-
rvrl
protected RemoteValueRetrievedListener rvrl
-
keyPartitioner
protected KeyPartitioner keyPartitioner
-
timeService
protected TimeService timeService
-
expirationManager
protected org.infinispan.expiration.impl.InternalExpirationManager<java.lang.Object,java.lang.Object> expirationManager
-
isL1Enabled
protected boolean isL1Enabled
-
isReplicated
protected boolean isReplicated
-
-
Method Detail
-
getLog
protected org.infinispan.util.logging.Log getLog()
- Specified by:
getLog
in classorg.infinispan.interceptors.impl.BaseRpcInterceptor
-
configure
public void configure()
-
visitGetKeysInGroupCommand
public final java.lang.Object visitGetKeysInGroupCommand(InvocationContext ctx, org.infinispan.commands.remote.GetKeysInGroupCommand command) throws java.lang.Throwable
- Specified by:
visitGetKeysInGroupCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitGetKeysInGroupCommand
in classDDAsyncInterceptor
- Throws:
java.lang.Throwable
-
visitClearCommand
public final java.lang.Object visitClearCommand(InvocationContext ctx, org.infinispan.commands.write.ClearCommand command) throws java.lang.Throwable
- Specified by:
visitClearCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitClearCommand
in classDDAsyncInterceptor
- Throws:
java.lang.Throwable
-
retrieveDistributionInfo
protected DistributionInfo retrieveDistributionInfo(LocalizedCacheTopology topology, org.infinispan.commands.ReplicableCommand command, java.lang.Object key)
-
remoteGetSingleKey
protected <C extends org.infinispan.commands.FlagAffectedCommand & org.infinispan.commands.TopologyAffectedCommand> java.util.concurrent.CompletionStage<java.lang.Void> remoteGetSingleKey(InvocationContext ctx, C command, java.lang.Object key, boolean isWrite)
Fetch a key from its remote owners and store it in the context. Not thread-safe. The invocation context should not be accessed concurrently from multiple threads, so this method should only be used for single-key commands.
-
wrapRemoteEntry
protected void wrapRemoteEntry(InvocationContext ctx, java.lang.Object key, CacheEntry ice, boolean isWrite)
-
handleNonTxWriteCommand
protected final java.lang.Object handleNonTxWriteCommand(InvocationContext ctx, org.infinispan.commands.write.AbstractDataWriteCommand command) throws java.lang.Throwable
- Throws:
java.lang.Throwable
-
checkTopologyId
protected LocalizedCacheTopology checkTopologyId(org.infinispan.commands.TopologyAffectedCommand command)
-
visitGetAllCommand
public java.lang.Object visitGetAllCommand(InvocationContext ctx, org.infinispan.commands.read.GetAllCommand command) throws java.lang.Throwable
- Specified by:
visitGetAllCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitGetAllCommand
in classDDAsyncInterceptor
- Throws:
java.lang.Throwable
-
remoteGetMany
protected <C extends org.infinispan.commands.FlagAffectedCommand & org.infinispan.commands.TopologyAffectedCommand> java.util.concurrent.CompletionStage<java.lang.Void> remoteGetMany(InvocationContext ctx, C command, java.util.Collection<?> keys)
-
handleRemotelyRetrievedKeys
protected void handleRemotelyRetrievedKeys(InvocationContext ctx, org.infinispan.commands.write.WriteCommand appliedCommand, java.util.List<?> remoteKeys)
-
visitReadOnlyManyCommand
public java.lang.Object visitReadOnlyManyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyManyCommand command) throws java.lang.Throwable
- Specified by:
visitReadOnlyManyCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitReadOnlyManyCommand
in classDDAsyncInterceptor
- Throws:
java.lang.Throwable
-
handleFunctionalReadManyCommand
protected <C extends org.infinispan.commands.TopologyAffectedCommand & org.infinispan.commands.FlagAffectedCommand> java.lang.Object handleFunctionalReadManyCommand(InvocationContext ctx, C command, BaseDistributionInterceptor.ReadManyCommandHelper<C> helper)
-
wrapFunctionalManyResultOnNonOrigin
protected java.lang.Object wrapFunctionalManyResultOnNonOrigin(InvocationContext rCtx, java.util.Collection<?> keys, java.lang.Object[] values)
-
unwrapFunctionalManyResultOnOrigin
protected java.lang.Object[] unwrapFunctionalManyResultOnOrigin(InvocationContext ctx, java.util.List<java.lang.Object> keys, java.lang.Object responseValue)
-
visitGetKeyValueCommand
public java.lang.Object visitGetKeyValueCommand(InvocationContext ctx, org.infinispan.commands.read.GetKeyValueCommand command) throws java.lang.Throwable
- Specified by:
visitGetKeyValueCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitGetKeyValueCommand
in 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:
visitGetCacheEntryCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitGetCacheEntryCommand
in classDDAsyncInterceptor
- Throws:
java.lang.Throwable
-
visitReadOnlyKeyCommand
public java.lang.Object visitReadOnlyKeyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyKeyCommand command) throws java.lang.Throwable
- Specified by:
visitReadOnlyKeyCommand
in interfaceorg.infinispan.commands.Visitor
- Overrides:
visitReadOnlyKeyCommand
in classDDAsyncInterceptor
- Throws:
java.lang.Throwable
-
remoteReadOnlyCommand
protected org.infinispan.commands.functional.ReadOnlyKeyCommand remoteReadOnlyCommand(InvocationContext ctx, org.infinispan.commands.functional.ReadOnlyKeyCommand command)
-
wrapFunctionalResultOnNonOriginOnReturn
protected java.lang.Object wrapFunctionalResultOnNonOriginOnReturn(java.lang.Object rv, CacheEntry entry)
-
unwrapFunctionalResultOnOrigin
protected java.lang.Object unwrapFunctionalResultOnOrigin(InvocationContext ctx, java.lang.Object key, java.lang.Object responseValue)
-
invokeRemotely
protected java.lang.Object invokeRemotely(InvocationContext ctx, org.infinispan.commands.write.DataWriteCommand command, Address primaryOwner)
-
readNeedsRemoteValue
protected boolean readNeedsRemoteValue(org.infinispan.commands.FlagAffectedCommand command)
- Returns:
true
if the value is not available on the local node and a read command is allowed to fetch it from a remote node. Does not check if the value is already in the context.
-
visitRemoveExpiredCommand
public java.lang.Object visitRemoveExpiredCommand(InvocationContext ctx, org.infinispan.commands.write.RemoveExpiredCommand command) throws java.lang.Throwable
- Throws:
java.lang.Throwable
-
invokeRemoveExpiredCommand
protected java.lang.Object invokeRemoveExpiredCommand(InvocationContext ctx, org.infinispan.commands.write.RemoveExpiredCommand command, DistributionInfo distributionInfo) throws java.lang.Throwable
- Throws:
java.lang.Throwable
-
-