Package org.infinispan.statetransfer
Class TransactionSynchronizerInterceptor
- java.lang.Object
-
- org.infinispan.interceptors.BaseAsyncInterceptor
-
- org.infinispan.statetransfer.TransactionSynchronizerInterceptor
-
- All Implemented Interfaces:
AsyncInterceptor
public class TransactionSynchronizerInterceptor extends BaseAsyncInterceptor
With the Non-Blocking State Transfer (NBST) in place it is possible for a transactional command to be forwarded multiple times, concurrently to the same node. This interceptor makes sure that for any given transaction, the interceptor chain, postStateTransferInterceptor
, would only allows a single thread to amend a transaction. E.g. of when this situation might occur:- 1) Node A broadcasts PrepareCommand to nodes B, C
- 2) Node A leaves cluster, causing new topology to be installed
- 3) The command arrives to B and C, with lower topology than the current one
- 4) Both B and C forward the command to node D
- 5) D executes the two commands in parallel and finds out that A has left, therefore executing RollbackCommand>
StateTransferInterceptor
), otherwise we can end up in deadlocks when a command is forwarded in a loop to the same cache: e.g. A→B→C→A. This scenario is possible when we have chained topology changes (see ISPN-2578).- Since:
- 5.2
- Author:
- Mircea Markus
-
-
Field Summary
-
Fields inherited from class org.infinispan.interceptors.BaseAsyncInterceptor
cacheConfiguration
-
-
Constructor Summary
Constructors Constructor Description TransactionSynchronizerInterceptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
visitCommand(InvocationContext ctx, org.infinispan.commands.VisitableCommand command)
Perform some work for a command invocation.-
Methods inherited from class org.infinispan.interceptors.BaseAsyncInterceptor
asyncInvokeNext, asyncInvokeNext, asyncInvokeNext, asyncValue, delayedValue, delayedValue, invokeNext, invokeNextAndExceptionally, invokeNextAndFinally, invokeNextAndHandle, invokeNextThenAccept, invokeNextThenApply, isSuccessfullyDone, makeStage, setNextInterceptor, valueOrException
-
-
-
-
Method Detail
-
visitCommand
public Object visitCommand(InvocationContext ctx, org.infinispan.commands.VisitableCommand command) throws Throwable
Description copied from interface:AsyncInterceptor
Perform some work for a command invocation. The interceptor is responsible for invoking the next interceptor in the chain, usingBaseAsyncInterceptor.invokeNext(InvocationContext, VisitableCommand)
or the other methods inBaseAsyncInterceptor
.- Returns:
- Either a regular value, or an
InvocationStage
created by theBaseAsyncInterceptor
methods. - Throws:
Throwable
-
-