Class PessimisticLockingInterceptor
java.lang.Object
org.infinispan.interceptors.BaseAsyncInterceptor
org.infinispan.interceptors.DDAsyncInterceptor
org.infinispan.interceptors.locking.AbstractLockingInterceptor
org.infinispan.interceptors.locking.AbstractTxLockingInterceptor
org.infinispan.interceptors.locking.PessimisticLockingInterceptor
- All Implemented Interfaces:
Visitor,AsyncInterceptor
Locking interceptor to be used by pessimistic caches.
Design note: when a lock "k" needs to be acquired (e.g. cache.put("k", "v")), if the lock owner is the local node,
no remote call is performed to migrate locking logic to the other (numOwners - 1) lock owners. This is a good
optimisation for in-vm transactions: if the local node crashes before prepare then the replicated lock information
would be useless as the tx is rolled back. OTOH for remote hotrod/transactions this additional RPC makes sense because
there's no such thing as transaction originator node, so this might become a configuration option when HotRod tx are
in place.
Implementation note: current implementation acquires locks remotely first and then locally. This is required
by the deadlock detection logic, but might not be optimal: acquiring locks locally first might help to fail fast the
in the case of keys being locked.
- Author:
- Mircea Markus
-
Field Summary
Fields inherited from class org.infinispan.interceptors.locking.AbstractLockingInterceptor
cdl, invalidationMode, lockManagerFields inherited from class org.infinispan.interceptors.BaseAsyncInterceptor
cacheConfiguration -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected LoggetLog()protected ObjecthandleReadManyCommand(InvocationContext ctx, FlagAffectedCommand command, Collection<?> keys) protected <K> ObjecthandleWriteManyCommand(InvocationContext ctx, WriteCommand command, Collection<K> keys, boolean forwarded) protected final ObjectvisitDataReadCommand(InvocationContext ctx, DataCommand command) protected ObjectvisitDataWriteCommand(InvocationContext ctx, DataWriteCommand command) visitLockControlCommand(TxInvocationContext ctx, LockControlCommand command) visitPrepareCommand(TxInvocationContext ctx, PrepareCommand command) Methods inherited from class org.infinispan.interceptors.locking.AbstractTxLockingInterceptor
visitCommitCommand, visitRollbackCommandMethods inherited from class org.infinispan.interceptors.locking.AbstractLockingInterceptor
getLockTimeoutMillis, lockAndRecord, start, visitClearCommand, visitComputeCommand, visitComputeIfAbsentCommand, visitGetAllCommand, visitGetCacheEntryCommand, visitGetKeyValueCommand, visitInvalidateCommand, visitInvalidateL1Command, visitIracPutKeyValueCommand, visitPutKeyValueCommand, visitPutMapCommand, visitReadOnlyKeyCommand, visitReadOnlyManyCommand, visitReadWriteKeyCommand, visitReadWriteKeyValueCommand, visitReadWriteManyCommand, visitReadWriteManyEntriesCommand, visitRemoveCommand, visitRemoveExpiredCommand, visitReplaceCommand, visitWriteOnlyKeyCommand, visitWriteOnlyKeyValueCommand, visitWriteOnlyManyCommand, visitWriteOnlyManyEntriesCommandMethods inherited from class org.infinispan.interceptors.DDAsyncInterceptor
handleDefault, visitCommand, visitEntrySetCommand, visitEvictCommand, visitKeySetCommand, visitSizeCommand, visitTouchCommand, visitUnknownCommandMethods inherited from class org.infinispan.interceptors.BaseAsyncInterceptor
asyncInvokeNext, asyncInvokeNext, asyncInvokeNext, asyncValue, delayedNull, delayedValue, delayedValue, invokeNext, invokeNextAndExceptionally, invokeNextAndFinally, invokeNextAndHandle, invokeNextThenAccept, invokeNextThenApply, isSuccessfullyDone, makeStage, setNextInterceptor, valueOrException
-
Constructor Details
-
PessimisticLockingInterceptor
public PessimisticLockingInterceptor()
-
-
Method Details
-
getLog
- Specified by:
getLogin classAbstractLockingInterceptor
-
visitDataReadCommand
protected final Object visitDataReadCommand(InvocationContext ctx, DataCommand command) throws Throwable - Specified by:
visitDataReadCommandin classAbstractLockingInterceptor- Throws:
Throwable
-
handleReadManyCommand
protected Object handleReadManyCommand(InvocationContext ctx, FlagAffectedCommand command, Collection<?> keys) - Overrides:
handleReadManyCommandin classAbstractTxLockingInterceptor
-
visitPrepareCommand
- Specified by:
visitPrepareCommandin interfaceVisitor- Overrides:
visitPrepareCommandin classDDAsyncInterceptor- Throws:
Throwable
-
handleWriteManyCommand
protected <K> Object handleWriteManyCommand(InvocationContext ctx, WriteCommand command, Collection<K> keys, boolean forwarded) - Specified by:
handleWriteManyCommandin classAbstractLockingInterceptor
-
visitDataWriteCommand
protected Object visitDataWriteCommand(InvocationContext ctx, DataWriteCommand command) throws Throwable - Specified by:
visitDataWriteCommandin classAbstractLockingInterceptor- Throws:
Throwable
-
visitLockControlCommand
- Specified by:
visitLockControlCommandin interfaceVisitor- Overrides:
visitLockControlCommandin classDDAsyncInterceptor
-