1 22 package org.jboss.aspects.remoting; 23 24 import org.jboss.ha.framework.server.HATarget; 25 26 import java.util.ArrayList ; 27 import java.util.Map ; 28 29 35 public class ReplicantsManagerInterceptor implements org.jboss.aop.advice.Interceptor, ClusterConstants 36 { 37 private final Map families; 38 39 public ReplicantsManagerInterceptor(Map families) 40 { 41 this.families = families; 42 } 43 44 public String getName() 45 { 46 return this.getClass().getName(); 47 } 48 49 public Object invoke(org.jboss.aop.joinpoint.Invocation invocation) throws Throwable 50 { 51 Object response = invocation.invokeNext(); 52 String clientFamily = (String ) invocation.getMetaData(CLUSTERED_REMOTING, CLUSTER_FAMILY); 53 54 HATarget target = (HATarget) families.get(clientFamily); 55 if (target == null) 56 { 57 return response; 58 } 59 60 Long clientViewId = (Long ) invocation.getMetaData(CLUSTERED_REMOTING, CLUSTER_VIEW_ID); 61 if (clientViewId == null) 62 { 63 return response; 65 } 66 if (clientViewId.longValue() != target.getCurrentViewId()) 67 { 68 invocation.addResponseAttachment("replicants", new ArrayList (target.getReplicants())); 69 invocation.addResponseAttachment("viewId", new Long (target.getCurrentViewId())); 70 } 71 return response; 72 } 73 } 74 | Popular Tags |