站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 3.2.7 Cache API Documentation 英文版文档

ReplicationInterceptor (JBoss Cache API) - JBoss 3.2.7 Cache API Documentation 英文版文档


org.jboss.cache.interceptors
Class ReplicationInterceptor

java.lang.Object
  extended byorg.jboss.cache.interceptors.Interceptor
      extended byorg.jboss.cache.interceptors.ReplicationInterceptor
All Implemented Interfaces:
Replicatable

public class ReplicationInterceptor
extends Interceptor
implements Replicatable

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.6.2.3 2004/12/30 17:08:24 starksm Exp $
Author:
Bela Ban

Constructor Summary
ReplicationInterceptor()
          Map>.
 
Method Summary
 Object invoke(org.jgroups.blocks.MethodCall m)
           
 void replicate(List method_calls)
          Receives and applies a number of method calls
 Object replicate(org.jgroups.blocks.MethodCall method_call)
          Received as result of replication sent from another node to this node
protected  void runCommitPhase(GlobalTransaction gtx)
          Asynchronously calls #commit(GlobalTransaction) in all members
protected  void runPreparePhase(GlobalTransaction tx, org.jgroups.blocks.MethodCall prepare_method, org.jgroups.Address coordinator, List modifications, boolean async)
          Calls #prepare(GlobalTransaction,List,org.jgroups.Address,boolean)) in all members except self.
protected  void runRollbackPhase(GlobalTransaction gtx)
          Asynchronously calls #rollback(GlobalTransaction) in all members
 void setCache(TreeCache cache)
           
 
Methods inherited from class org.jboss.cache.interceptors.Interceptor
getNext, setNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplicationInterceptor

public ReplicationInterceptor()
Map>. Mapping between local transactions and their modifications, populated on reception of PREPARE. Elements are removed on TX commit or rollback

Method Detail

setCache

public void setCache(TreeCache cache)
Overrides:
setCache in class Interceptor

invoke

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

replicate

public Object replicate(org.jgroups.blocks.MethodCall method_call)
                 throws Throwable
Received as result of replication sent from another node to this node

Specified by:
replicate in interface Replicatable
Parameters:
method_call -
Returns:
Throws:
Throwable

replicate

public void replicate(List method_calls)
               throws Throwable
Description copied from interface: Replicatable
Receives and applies a number of method calls

Specified by:
replicate in interface Replicatable
Parameters:
method_calls - List
Throws:
Throwable

runPreparePhase

protected void runPreparePhase(GlobalTransaction tx,
                               org.jgroups.blocks.MethodCall prepare_method,
                               org.jgroups.Address coordinator,
                               List modifications,
                               boolean async)
                        throws Exception
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 #runCommitPhase(GlobalTransaction)).

Parameters:
tx -
coordinator -
prepare_method - The MethodCall representing the prepare() method
async - Run this asynchronously
Throws:
Exception

runCommitPhase

protected void runCommitPhase(GlobalTransaction gtx)
Asynchronously calls #commit(GlobalTransaction) in all members


runRollbackPhase

protected void runRollbackPhase(GlobalTransaction gtx)
Asynchronously calls #rollback(GlobalTransaction) in all members



Copyright © 2002 JBoss Group, LLC. All Rights Reserved.