org.infinispan.statetransfer
Class TransactionSynchronizerInterceptor
java.lang.Object
org.infinispan.commands.AbstractVisitor
org.infinispan.interceptors.base.CommandInterceptor
org.infinispan.statetransfer.TransactionSynchronizerInterceptor
- All Implemented Interfaces:
- Visitor
public class TransactionSynchronizerInterceptor
- extends CommandInterceptor
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, post StateTransferInterceptor
, 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>
This interceptor must placed after the logic that handles command forwarding (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
Methods inherited from class org.infinispan.commands.AbstractVisitor |
visitApplyDeltaCommand, visitClearCommand, visitCollection, visitDistributedExecuteCommand, visitEntrySetCommand, visitEvictCommand, visitGetKeyValueCommand, visitInvalidateCommand, visitInvalidateL1Command, visitKeySetCommand, visitPutKeyValueCommand, visitPutMapCommand, visitRemoveCommand, visitReplaceCommand, visitSizeCommand, visitUnknownCommand, visitValuesCommand |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TransactionSynchronizerInterceptor
public TransactionSynchronizerInterceptor()
visitPrepareCommand
public final Object visitPrepareCommand(TxInvocationContext ctx,
PrepareCommand command)
throws Throwable
- Specified by:
visitPrepareCommand
in interface Visitor
- Overrides:
visitPrepareCommand
in class AbstractVisitor
- Throws:
Throwable
visitCommitCommand
public final Object visitCommitCommand(TxInvocationContext ctx,
CommitCommand command)
throws Throwable
- Specified by:
visitCommitCommand
in interface Visitor
- Overrides:
visitCommitCommand
in class AbstractVisitor
- Throws:
Throwable
visitRollbackCommand
public final Object visitRollbackCommand(TxInvocationContext ctx,
RollbackCommand command)
throws Throwable
- Specified by:
visitRollbackCommand
in interface Visitor
- Overrides:
visitRollbackCommand
in class AbstractVisitor
- Throws:
Throwable
visitLockControlCommand
public Object visitLockControlCommand(TxInvocationContext ctx,
LockControlCommand command)
throws Throwable
- Specified by:
visitLockControlCommand
in interface Visitor
- Overrides:
visitLockControlCommand
in class AbstractVisitor
- Throws:
Throwable
Copyright © 2013 JBoss, a division of Red Hat. All Rights Reserved.