org.jboss.cache.interceptors
Class ReplicationInterceptor

java.lang.Object
  extended by org.jboss.cache.interceptors.Interceptor
      extended by org.jboss.cache.interceptors.BaseRpcInterceptor
          extended by org.jboss.cache.interceptors.ReplicationInterceptor
All Implemented Interfaces:
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 4503 2007-09-25 13:41:09Z manik.surtani@jboss.com $
Author:
Bela Ban

Field Summary
 
Fields inherited from class org.jboss.cache.interceptors.BaseRpcInterceptor
defaultSynchronous
 
Fields inherited from class org.jboss.cache.interceptors.Interceptor
cache, configuration, last, log, next
 
Constructor Summary
ReplicationInterceptor()
           
 
Method Summary
 Object invoke(InvocationContext ctx)
           
protected  void runPreparePhase(MethodCall prepareMethod, GlobalTransaction gtx, InvocationContext ctx)
          Calls prepare(GlobalTransaction,List,org.jgroups.Address,boolean)) in all members except self.
 
Methods inherited from class org.jboss.cache.interceptors.BaseRpcInterceptor
containsModifications, checkResponses, isSynchronous, putCallOnAsyncReplicationQueue, replicateCall, replicateCall, setCache
 
Methods inherited from class org.jboss.cache.interceptors.Interceptor
dumpStatistics, getLast, getNext, getStatisticsEnabled, isActive, isOnePhaseCommitPrepareMehod, isPreparing, isValid, resetStatistics, setLast, setNext, setStatisticsEnabled, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReplicationInterceptor

public ReplicationInterceptor()
Method Detail

invoke

public Object invoke(InvocationContext ctx)
              throws Throwable
Overrides:
invoke in class Interceptor
Throws:
Throwable

runPreparePhase

protected void runPreparePhase(MethodCall 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 © 2007 JBoss, a division of Red Hat. All Rights Reserved.