FileDocCategorySizeDatePackage
ReplicantsManagerInterceptor.javaAPI DocJBoss 4.2.12532Fri Jul 13 21:02:26 BST 2007org.jboss.aspects.remoting

ReplicantsManagerInterceptor

public class ReplicantsManagerInterceptor extends Object implements org.jboss.aop.advice.Interceptor, ClusterConstants
Checks to see if this object is local in VM
author
Bill Burke
version
$Revision: 57186 $

Fields Summary
private final Map
families
Constructors Summary
public ReplicantsManagerInterceptor(Map families)

      this.families = families;
   
Methods Summary
public java.lang.StringgetName()

      return this.getClass().getName();
   
public java.lang.Objectinvoke(org.jboss.aop.joinpoint.Invocation invocation)

      Object response = invocation.invokeNext();
      String clientFamily = (String) invocation.getMetaData(CLUSTERED_REMOTING, CLUSTER_FAMILY);

      HATarget target = (HATarget) families.get(clientFamily);
      if (target == null)
      {
         return response;
      }

      Long clientViewId = (Long) invocation.getMetaData(CLUSTERED_REMOTING, CLUSTER_VIEW_ID);
      if (clientViewId == null)
      {
         // Maybe we're being invoked upon by a non-clustered proxy
         return response;
      }
      if (clientViewId.longValue() != target.getCurrentViewId())
      {
         invocation.addResponseAttachment("replicants", new ArrayList(target.getReplicants()));
         invocation.addResponseAttachment("viewId", new Long(target.getCurrentViewId()));
      }
      return response;