org.jboss.cache.interceptors
Class ReplicationInterceptor
java.lang.Object
org.jboss.cache.commands.AbstractVisitor
org.jboss.cache.interceptors.base.CommandInterceptor
org.jboss.cache.interceptors.BaseRpcInterceptor
org.jboss.cache.interceptors.ReplicationInterceptor
- All Implemented Interfaces:
- Visitor, InterceptorMBean
public class ReplicationInterceptor
- extends BaseRpcInterceptor
Takes care of replicating modifications to other nodes in a cluster. Also
listens for prepare(), commit() and rollback() messages which are received
'side-ways' (see docs/design/Refactoring.txt).
- Version:
- $Id: ReplicationInterceptor.java 5769 2008-04-30 12:00:36Z manik.surtani@jboss.com $
- Author:
- Bela Ban
Method Summary |
protected void |
runPreparePhase(PrepareCommand prepareMethod,
GlobalTransaction gtx,
InvocationContext ctx)
Calls prepare(GlobalTransaction,List,org.jgroups.Address,boolean)) in all members except self. |
protected boolean |
skipReplication(InvocationContext ctx)
|
Object |
visitCommitCommand(InvocationContext ctx,
CommitCommand command)
Visits a CommitCommand. |
Object |
visitMoveCommand(InvocationContext ctx,
MoveCommand command)
Visits a MoveCommand. |
Object |
visitPrepareCommand(InvocationContext ctx,
PrepareCommand command)
Visits a PrepareCommand. |
Object |
visitPutDataMapCommand(InvocationContext ctx,
PutDataMapCommand command)
Visits a PutDataMapCommand. |
Object |
visitPutKeyValueCommand(InvocationContext ctx,
PutKeyValueCommand command)
Visits a PutKeyValueCommand. |
Object |
visitRemoveDataCommand(InvocationContext ctx,
RemoveDataCommand command)
Visits a RemoveDataCommand. |
Object |
visitRemoveKeyCommand(InvocationContext ctx,
RemoveKeyCommand command)
Visits a RemoveKeyCommand. |
Object |
visitRemoveNodeCommand(InvocationContext ctx,
RemoveNodeCommand command)
Visits a RemoveNodeCommand. |
Object |
visitRollbackCommand(InvocationContext ctx,
RollbackCommand command)
Visits a RollbackCommand. |
Methods inherited from class org.jboss.cache.commands.AbstractVisitor |
visitCollection, visitCreateNodeCommand, visitEvictFqnCommand, visitExistsNodeCommand, visitGetChildrenNamesCommand, visitGetDataMapCommand, visitGetKeysCommand, visitGetKeyValueCommand, visitGetNodeCommand, visitGravitateDataCommand, visitInvalidateCommand, visitOptimisticPrepareCommand |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ReplicationInterceptor
public ReplicationInterceptor()
skipReplication
protected boolean skipReplication(InvocationContext ctx)
visitCommitCommand
public Object visitCommitCommand(InvocationContext ctx,
CommitCommand command)
throws Throwable
- Description copied from interface:
Visitor
- Visits a CommitCommand.
- Specified by:
visitCommitCommand
in interface Visitor
- Overrides:
visitCommitCommand
in class AbstractVisitor
- Parameters:
ctx
- invocation contextcommand
- command to visit
- Returns:
- response from the visit
- Throws:
Throwable
- in the event of problems.
visitPrepareCommand
public Object visitPrepareCommand(InvocationContext ctx,
PrepareCommand command)
throws Throwable
- Description copied from interface:
Visitor
- Visits a PrepareCommand.
- Specified by:
visitPrepareCommand
in interface Visitor
- Overrides:
visitPrepareCommand
in class AbstractVisitor
- Parameters:
ctx
- invocation contextcommand
- command to visit
- Returns:
- response from the visit
- Throws:
Throwable
- in the event of problems.
visitRollbackCommand
public Object visitRollbackCommand(InvocationContext ctx,
RollbackCommand command)
throws Throwable
- Description copied from interface:
Visitor
- Visits a RollbackCommand.
- Specified by:
visitRollbackCommand
in interface Visitor
- Overrides:
visitRollbackCommand
in class AbstractVisitor
- Parameters:
ctx
- invocation contextcommand
- command to visit
- Returns:
- response from the visit
- Throws:
Throwable
- in the event of problems.
visitPutKeyValueCommand
public Object visitPutKeyValueCommand(InvocationContext ctx,
PutKeyValueCommand command)
throws Throwable
- Description copied from interface:
Visitor
- Visits a PutKeyValueCommand.
- Specified by:
visitPutKeyValueCommand
in interface Visitor
- Overrides:
visitPutKeyValueCommand
in class AbstractVisitor
- Parameters:
ctx
- invocation contextcommand
- command to visit
- Returns:
- response from the visit
- Throws:
Throwable
- in the event of problems.
visitPutDataMapCommand
public Object visitPutDataMapCommand(InvocationContext ctx,
PutDataMapCommand command)
throws Throwable
- Description copied from interface:
Visitor
- Visits a PutDataMapCommand.
- Specified by:
visitPutDataMapCommand
in interface Visitor
- Overrides:
visitPutDataMapCommand
in class AbstractVisitor
- Parameters:
ctx
- invocation contextcommand
- command to visit
- Returns:
- response from the visit
- Throws:
Throwable
- in the event of problems.
visitMoveCommand
public Object visitMoveCommand(InvocationContext ctx,
MoveCommand command)
throws Throwable
- Description copied from interface:
Visitor
- Visits a MoveCommand.
- Specified by:
visitMoveCommand
in interface Visitor
- Overrides:
visitMoveCommand
in class AbstractVisitor
- Parameters:
ctx
- invocation contextcommand
- command to visit
- Returns:
- response from the visit
- Throws:
Throwable
- in the event of problems.
visitRemoveNodeCommand
public Object visitRemoveNodeCommand(InvocationContext ctx,
RemoveNodeCommand command)
throws Throwable
- Description copied from interface:
Visitor
- Visits a RemoveNodeCommand.
- Specified by:
visitRemoveNodeCommand
in interface Visitor
- Overrides:
visitRemoveNodeCommand
in class AbstractVisitor
- Parameters:
ctx
- invocation contextcommand
- command to visit
- Returns:
- response from the visit
- Throws:
Throwable
- in the event of problems.
visitRemoveKeyCommand
public Object visitRemoveKeyCommand(InvocationContext ctx,
RemoveKeyCommand command)
throws Throwable
- Description copied from interface:
Visitor
- Visits a RemoveKeyCommand.
- Specified by:
visitRemoveKeyCommand
in interface Visitor
- Overrides:
visitRemoveKeyCommand
in class AbstractVisitor
- Parameters:
ctx
- invocation contextcommand
- command to visit
- Returns:
- response from the visit
- Throws:
Throwable
- in the event of problems.
visitRemoveDataCommand
public Object visitRemoveDataCommand(InvocationContext ctx,
RemoveDataCommand command)
throws Throwable
- Description copied from interface:
Visitor
- Visits a RemoveDataCommand.
- Specified by:
visitRemoveDataCommand
in interface Visitor
- Overrides:
visitRemoveDataCommand
in class AbstractVisitor
- Parameters:
ctx
- invocation contextcommand
- command to visit
- Returns:
- response from the visit
- Throws:
Throwable
- in the event of problems.
runPreparePhase
protected void runPreparePhase(PrepareCommand prepareMethod,
GlobalTransaction gtx,
InvocationContext ctx)
throws Throwable
- Calls prepare(GlobalTransaction,List,org.jgroups.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 © 2008 JBoss, a division of Red Hat. All Rights Reserved.