Package org.infinispan.interceptors.impl
Class InvalidationInterceptor
java.lang.Object
org.infinispan.interceptors.BaseAsyncInterceptor
org.infinispan.interceptors.DDAsyncInterceptor
org.infinispan.interceptors.impl.BaseRpcInterceptor
org.infinispan.interceptors.impl.InvalidationInterceptor
- All Implemented Interfaces:
Visitor,AsyncInterceptor,JmxStatisticsExposer
@MBean(objectName="Invalidation",
description="Component responsible for invalidating entries on remote caches when entries are written to locally.")
public class InvalidationInterceptor
extends BaseRpcInterceptor
implements JmxStatisticsExposer
This interceptor acts as a replacement to the replication interceptor when the CacheImpl is configured with
ClusteredSyncMode as INVALIDATE.
The idea is that rather than replicating changes to all caches in a cluster when write methods are called, simply
broadcast an InvalidateCommand on the remote caches containing all keys modified. This allows the remote
cache to look up the value in a shared cache loader which would have been updated with the changes.
Transactional caches, still lock affected keys on the primary owner:
- Pessimistic caches acquire locks with an explicit lock command and release during the one-phase PrepareCommand.
- Optimistic caches acquire locks during the 2-phase prepare command and release locks with a TxCompletionNotificationCommand.
- Since:
- 9.0
- Author:
- Manik Surtani, Galder ZamarreƱo, Mircea.Markus@jboss.com
-
Field Summary
Fields inherited from class org.infinispan.interceptors.impl.BaseRpcInterceptor
componentRegistry, defaultSynchronous, rpcManagerFields inherited from class org.infinispan.interceptors.BaseAsyncInterceptor
cacheConfiguration -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongprotected LoggetLog()booleanReturns whether an interceptor's statistics are being captured.voidResets an interceptor's cache statisticsvoidsetStatisticsEnabled(boolean enabled) Enables an interceptor's cache statistics If true, the interceptor will capture statistics and make them available through the mbean.visitClearCommand(InvocationContext ctx, ClearCommand command) visitCommitCommand(TxInvocationContext ctx, CommitCommand command) visitComputeCommand(InvocationContext ctx, ComputeCommand command) visitLockControlCommand(TxInvocationContext ctx, LockControlCommand command) visitPrepareCommand(TxInvocationContext ctx, PrepareCommand command) visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) visitPutMapCommand(InvocationContext ctx, PutMapCommand command) visitRemoveCommand(InvocationContext ctx, RemoveCommand command) visitReplaceCommand(InvocationContext ctx, ReplaceCommand command) Methods inherited from class org.infinispan.interceptors.impl.BaseRpcInterceptor
init, isLocalModeForced, isSynchronous, shouldInvokeRemoteTxCommand, shouldLoad, transactionRemotelyPreparedMethods inherited from class org.infinispan.interceptors.DDAsyncInterceptor
handleDefault, visitCommand, visitEntrySetCommand, visitEvictCommand, visitGetAllCommand, visitGetCacheEntryCommand, visitGetKeyValueCommand, visitInvalidateCommand, visitInvalidateL1Command, visitIracPutKeyValueCommand, visitKeySetCommand, visitReadOnlyKeyCommand, visitReadOnlyManyCommand, visitReadWriteKeyCommand, visitReadWriteKeyValueCommand, visitReadWriteManyCommand, visitReadWriteManyEntriesCommand, visitRollbackCommand, visitSizeCommand, visitTouchCommand, visitUnknownCommand, visitWriteOnlyKeyCommand, visitWriteOnlyKeyValueCommand, visitWriteOnlyManyCommand, visitWriteOnlyManyEntriesCommandMethods inherited from class org.infinispan.interceptors.BaseAsyncInterceptor
asyncInvokeNext, asyncInvokeNext, asyncInvokeNext, asyncValue, delayedNull, delayedValue, delayedValue, invokeNext, invokeNextAndExceptionally, invokeNextAndFinally, invokeNextAndHandle, invokeNextThenAccept, invokeNextThenApply, isSuccessfullyDone, makeStage, setNextInterceptor, valueOrExceptionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.infinispan.commands.Visitor
visitRemoveExpiredCommand
-
Constructor Details
-
InvalidationInterceptor
public InvalidationInterceptor()
-
-
Method Details
-
getLog
- Specified by:
getLogin classBaseRpcInterceptor
-
visitPutKeyValueCommand
public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable - Specified by:
visitPutKeyValueCommandin interfaceVisitor- Overrides:
visitPutKeyValueCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitReplaceCommand
- Specified by:
visitReplaceCommandin interfaceVisitor- Overrides:
visitReplaceCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitComputeCommand
- Specified by:
visitComputeCommandin interfaceVisitor- Overrides:
visitComputeCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitComputeIfAbsentCommand
public Object visitComputeIfAbsentCommand(InvocationContext ctx, ComputeIfAbsentCommand command) throws Throwable - Specified by:
visitComputeIfAbsentCommandin interfaceVisitor- Overrides:
visitComputeIfAbsentCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitRemoveCommand
- Specified by:
visitRemoveCommandin interfaceVisitor- Overrides:
visitRemoveCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitClearCommand
- Specified by:
visitClearCommandin interfaceVisitor- Overrides:
visitClearCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitPutMapCommand
- Specified by:
visitPutMapCommandin interfaceVisitor- Overrides:
visitPutMapCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitPrepareCommand
- Specified by:
visitPrepareCommandin interfaceVisitor- Overrides:
visitPrepareCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitCommitCommand
- Specified by:
visitCommitCommandin interfaceVisitor- Overrides:
visitCommitCommandin classDDAsyncInterceptor- Throws:
Throwable
-
visitLockControlCommand
public Object visitLockControlCommand(TxInvocationContext ctx, LockControlCommand command) throws Throwable - Specified by:
visitLockControlCommandin interfaceVisitor- Overrides:
visitLockControlCommandin classDDAsyncInterceptor- Throws:
Throwable
-
resetStatistics
@ManagedOperation(description="Resets statistics gathered by this component", displayName="Reset statistics") public void resetStatistics()Description copied from interface:JmxStatisticsExposerResets an interceptor's cache statistics- Specified by:
resetStatisticsin interfaceJmxStatisticsExposer
-
getStatisticsEnabled
@ManagedAttribute(displayName="Statistics enabled", description="Enables or disables the gathering of statistics by this component", dataType=TRAIT, writable=true) public boolean getStatisticsEnabled()Description copied from interface:JmxStatisticsExposerReturns whether an interceptor's statistics are being captured.- Specified by:
getStatisticsEnabledin interfaceJmxStatisticsExposer- Returns:
- true if statistics are captured
-
setStatisticsEnabled
public void setStatisticsEnabled(@Parameter(name="enabled",description="Whether statistics should be enabled or disabled (true/false)") boolean enabled) Description copied from interface:JmxStatisticsExposerEnables an interceptor's cache statistics If true, the interceptor will capture statistics and make them available through the mbean.- Specified by:
setStatisticsEnabledin interfaceJmxStatisticsExposer- Parameters:
enabled- true if statistics should be captured
-
getInvalidations
@ManagedAttribute(description="Number of invalidations", displayName="Number of invalidations", measurementType=TRENDSUP) public long getInvalidations()
-