org.infinispan.interceptors
Class ReplicationInterceptor
java.lang.Object
org.infinispan.commands.AbstractVisitor
org.infinispan.interceptors.base.CommandInterceptor
org.infinispan.interceptors.base.BaseRpcInterceptor
org.infinispan.interceptors.ReplicationInterceptor
- All Implemented Interfaces:
- Visitor
public class ReplicationInterceptor
- extends BaseRpcInterceptor
Takes care of replicating modifications to other caches in a cluster. Also listens for prepare(), commit() and
rollback() messages which are received 'side-ways' (see docs/design/Refactoring.txt).
- Since:
- 4.0
- Author:
- Bela Ban
Method Summary |
protected void |
runPreparePhase(PrepareCommand prepareMethod,
GlobalTransaction gtx,
InvocationContext ctx)
Calls prepare(GlobalTransaction,List,Address,boolean)) in all members except self. |
Object |
visitClearCommand(InvocationContext ctx,
ClearCommand command)
|
Object |
visitCommitCommand(InvocationContext ctx,
CommitCommand command)
|
Object |
visitPrepareCommand(InvocationContext ctx,
PrepareCommand command)
|
Object |
visitPutKeyValueCommand(InvocationContext ctx,
PutKeyValueCommand command)
|
Object |
visitPutMapCommand(InvocationContext ctx,
PutMapCommand command)
|
Object |
visitRemoveCommand(InvocationContext ctx,
RemoveCommand command)
|
Object |
visitReplaceCommand(InvocationContext ctx,
ReplaceCommand command)
|
Object |
visitRollbackCommand(InvocationContext ctx,
RollbackCommand command)
|
Methods inherited from class org.infinispan.interceptors.base.BaseRpcInterceptor |
checkResponses, init, injectComponents, isLocalModeForced, isSynchronous, isTransactionalAndLocal, replicateCall, replicateCall, replicateCall, replicateCall, replicateCall, replicateCall, skipReplicationOfTransactionMethod |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ReplicationInterceptor
public ReplicationInterceptor()
visitCommitCommand
public Object visitCommitCommand(InvocationContext ctx,
CommitCommand command)
throws Throwable
- Specified by:
visitCommitCommand
in interface Visitor
- Overrides:
visitCommitCommand
in class AbstractVisitor
- Throws:
Throwable
visitPrepareCommand
public Object visitPrepareCommand(InvocationContext ctx,
PrepareCommand command)
throws Throwable
- Specified by:
visitPrepareCommand
in interface Visitor
- Overrides:
visitPrepareCommand
in class AbstractVisitor
- Throws:
Throwable
visitRollbackCommand
public Object visitRollbackCommand(InvocationContext ctx,
RollbackCommand command)
throws Throwable
- Specified by:
visitRollbackCommand
in interface Visitor
- Overrides:
visitRollbackCommand
in class AbstractVisitor
- Throws:
Throwable
visitPutKeyValueCommand
public Object visitPutKeyValueCommand(InvocationContext ctx,
PutKeyValueCommand command)
throws Throwable
- Specified by:
visitPutKeyValueCommand
in interface Visitor
- Overrides:
visitPutKeyValueCommand
in class AbstractVisitor
- Throws:
Throwable
visitPutMapCommand
public Object visitPutMapCommand(InvocationContext ctx,
PutMapCommand command)
throws Throwable
- Specified by:
visitPutMapCommand
in interface Visitor
- Overrides:
visitPutMapCommand
in class AbstractVisitor
- Throws:
Throwable
visitRemoveCommand
public Object visitRemoveCommand(InvocationContext ctx,
RemoveCommand command)
throws Throwable
- Specified by:
visitRemoveCommand
in interface Visitor
- Overrides:
visitRemoveCommand
in class AbstractVisitor
- Throws:
Throwable
visitClearCommand
public Object visitClearCommand(InvocationContext ctx,
ClearCommand command)
throws Throwable
- Specified by:
visitClearCommand
in interface Visitor
- Overrides:
visitClearCommand
in class AbstractVisitor
- Throws:
Throwable
visitReplaceCommand
public Object visitReplaceCommand(InvocationContext ctx,
ReplaceCommand command)
throws Throwable
- Specified by:
visitReplaceCommand
in interface Visitor
- Overrides:
visitReplaceCommand
in class AbstractVisitor
- Throws:
Throwable
runPreparePhase
protected void runPreparePhase(PrepareCommand prepareMethod,
GlobalTransaction gtx,
InvocationContext ctx)
throws Throwable
- Calls prepare(GlobalTransaction,List,Address,boolean)) in all members except self. Waits for all responses. If one
of the members failed to prepare, its return value will be an exception. If there is one exception we rethrow it.
This will mark the current transaction as rolled back, which will cause the afterCompletion(int) callback to have
a status of MARKED_ROLLBACK. When we get that call, we simply roll back the transaction.
If
everything runs okay, the afterCompletion(int) callback will trigger the @link
#runCommitPhase(GlobalTransaction)).
- Throws:
Exception
Throwable
Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.