FileDocCategorySizeDatePackage
ClientMethodInterceptorHA.javaAPI DocJBoss 4.2.12716Fri Jul 13 20:52:38 BST 2007org.jboss.invocation.http.interfaces

ClientMethodInterceptorHA

public class ClientMethodInterceptorHA extends org.jboss.proxy.Interceptor implements Externalizable
Handle toString, equals, hashCode locally on the client.
author
Scott.Stark@jboss.org
version
$Revision: 57188 $

Fields Summary
private static final long
serialVersionUID
The serialVersionUID
Constructors Summary
Methods Summary
public java.lang.Objectinvoke(org.jboss.invocation.Invocation mi)
Handle methods locally on the client

param
mi
return
throws
Throwable


                  
        
   
      Method m = mi.getMethod();
      String methodName = m.getName();
      HttpInvokerProxyHA proxy = (HttpInvokerProxyHA) mi.getInvocationContext().getInvoker();
      // Implement local methods
      if( methodName.equals("toString") )
      {
         return toString(proxy);
      }
      if( methodName.equals("equals") )
      {
         Object[] args = mi.getArguments();
         String thisString = toString(proxy);
         String argsString = args[0] == null ? "" : args[0].toString();
         return new Boolean(thisString.equals(argsString));
      }
      if( methodName.equals("hashCode") )
      {
         return (Integer) mi.getObjectName();
      }

      return getNext().invoke(mi);
   
private java.lang.StringtoString(HttpInvokerProxyHA proxy)

      StringBuffer tmp = new StringBuffer(proxy.toString());
      tmp.append('{");
      tmp.append("clusterInfo="+proxy.getClusterInfo());
      tmp.append('}");
      return tmp.toString();