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,v 1.32 2006/06/12 20:24:31 msurtani Exp $
Author:
Bela Ban

Constructor Summary
ReplicationInterceptor()
           
 
Method Summary
 java.lang.Object invoke(org.jgroups.blocks.MethodCall call)
           
protected  void runPreparePhase(JBCMethodCall prepareMethod, GlobalTransaction gtx)
          Calls prepare(GlobalTransaction,List,org.jgroups.Address,boolean)) in all members except self.
 
Methods inherited from class org.jboss.cache.interceptors.BaseRpcInterceptor
checkResponses, containsModifications, putCallOnAsyncReplicationQueue, replicateCall, replicateCall, setCache
 
Methods inherited from class org.jboss.cache.interceptors.Interceptor
dumpStatistics, getInvocationContext, getNext, getStatisticsEnabled, isActive, isBuddyGroupOrganisationMethod, isOnePhaseCommitPrepareMehod, isPreparing, isTransactionLifecycleMethod, isValid, resetStatistics, setInvocationContext, setNext, setStatisticsEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplicationInterceptor

public ReplicationInterceptor()
Method Detail

invoke

public java.lang.Object invoke(org.jgroups.blocks.MethodCall call)
                        throws java.lang.Throwable
Overrides:
invoke in class Interceptor
Throws:
java.lang.Throwable

runPreparePhase

protected void runPreparePhase(JBCMethodCall prepareMethod,
                               GlobalTransaction gtx)
                        throws java.lang.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:
java.lang.Exception
java.lang.Throwable


Copyright 1998-2005 JBoss Inc . All Rights Reserved.