[Jboss-cvs] JBossAS SVN: r56450 - in branches/JBoss_4_0_0_Case10829: cluster/src/main/org/jboss/ha/framework/interfaces cluster/src/main/org/jboss/ha/framework/server naming/src/main/org/jnp/interfaces

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 30 12:53:13 EDT 2006


Author: scott.stark at jboss.org
Date: 2006-08-30 12:53:07 -0400 (Wed, 30 Aug 2006)
New Revision: 56450

Modified:
   branches/JBoss_4_0_0_Case10829/cluster/src/main/org/jboss/ha/framework/interfaces/HARMIClient.java
   branches/JBoss_4_0_0_Case10829/cluster/src/main/org/jboss/ha/framework/server/HARMIServerImpl.java
   branches/JBoss_4_0_0_Case10829/naming/src/main/org/jnp/interfaces/NamingContext.java
Log:
Update the trace level logging

Modified: branches/JBoss_4_0_0_Case10829/cluster/src/main/org/jboss/ha/framework/interfaces/HARMIClient.java
===================================================================
--- branches/JBoss_4_0_0_Case10829/cluster/src/main/org/jboss/ha/framework/interfaces/HARMIClient.java	2006-08-30 16:38:09 UTC (rev 56449)
+++ branches/JBoss_4_0_0_Case10829/cluster/src/main/org/jboss/ha/framework/interfaces/HARMIClient.java	2006-08-30 16:53:07 UTC (rev 56450)
@@ -15,6 +15,7 @@
 import java.util.ArrayList;
 
 import org.jboss.invocation.MarshalledInvocation;
+import org.jboss.logging.Logger;
 
 /**
  *
@@ -31,6 +32,7 @@
     * @since 
     */ 
    private static final long serialVersionUID = -1227816478666532463L;
+   private static Logger log = Logger.getLogger(HARMIClient.class);
 
    // Attributes ----------------------------------------------------
    
@@ -39,7 +41,7 @@
    protected LoadBalancePolicy loadBalancePolicy;
    //protected transient long currentViewId = 0;
    protected transient Object local = null;
-   
+   private transient boolean trace = log.isTraceEnabled();
    FamilyClusterInfo familyClusterInfo = null;
    
    // Static --------------------------------------------------------
@@ -115,11 +117,16 @@
    
    public Object invokeRemote(Object proxy, Method method, Object[] args) throws Throwable
    {
-      HARMIServer target = (HARMIServer)getRemoteTarget();      
+      HARMIServer target = (HARMIServer)getRemoteTarget();
+      if( trace )
+    	  log.trace("invokeRemote, proxy="+proxy);
       while (target != null)
       {
+    	  Exception lastException = null;
          try
          {
+            if( trace )
+          	  log.trace("trying target="+target);
             MarshalledInvocation mi = new MarshalledInvocation(null, method, args, null, null, null);
             mi.setObjectName (""); //FIXME: Fake value! Bill's optimisations regarding MI make the hypothesis
                                    // that ObjectName is always here otherwise the writeExternal code of MI
@@ -127,33 +134,44 @@
             HARMIResponse rsp = target.invoke(this.familyClusterInfo.getCurrentViewId (), mi);
             if (rsp.newReplicants != null)
             {
-               // System.out.println("new set of replicants" + rsp.newReplicants + " : view : " + rsp.currentViewId); 
+               if( trace )
+            	   log.trace("replicants updates to: "+rsp.newReplicants);
                updateClusterInfo (rsp.newReplicants, rsp.currentViewId);
                //setTargets(rsp.newReplicants);
                //currentViewId = rsp.currentViewId;
             }               
-               
+            if( trace )
+            	log.trace("return rsp: "+rsp);
             return rsp.response;
          }
-         catch (java.rmi.ConnectException ce)
+         catch (java.rmi.ConnectException e)
          {
+        	 lastException = e;
          }
-         catch (java.rmi.ConnectIOException cioe)
+         catch (java.rmi.ConnectIOException e)
          {
+        	 lastException = e;
          }
-         catch (java.rmi.NoSuchObjectException nsoe)
+         catch (java.rmi.NoSuchObjectException e)
          {
+        	 lastException = e;
          }
-         catch (java.rmi.UnmarshalException ue ) 
+         catch (java.rmi.UnmarshalException e) 
          {
+        	 lastException = e;
          }
-         catch (java.rmi.UnknownHostException uhe)
+         catch (java.rmi.UnknownHostException e)
          {
+        	 lastException = e;
          }
+    	 if( trace )
+    		 log.trace("Invoke failed, target="+target+", lastException="+lastException);
          // If we reach here, this means that we must fail-over
          remoteTargetHasFailed(target);
          target = (HARMIServer)getRemoteTarget();
       }
+      if( trace )
+    	  log.trace("invokeRemote failed to find a target");
       // if we get here this means list was exhausted
       throw new java.rmi.RemoteException("Service unavailable.");
       
@@ -218,7 +236,7 @@
       long vid = stream.readLong ();
       this.loadBalancePolicy = (LoadBalancePolicy)stream.readObject();      
       HARMIServer server = (HARMIServer)HARMIServer.rmiServers.get(key);
-      
+      trace = log.isTraceEnabled();
       // keep a reference on our family object
       //
       this.familyClusterInfo = ClusteringTargetsRepository.initTarget (this.key, targets, vid);
@@ -238,6 +256,11 @@
             {}
          }
       }
+      if( trace )
+      {
+    	  log.trace("readObject, key="+key+", familyClusterInfo="+familyClusterInfo
+    			  +", loadBalancePolicy="+loadBalancePolicy);
+      }
    }
    private void writeObject (ObjectOutputStream stream)
       throws IOException

Modified: branches/JBoss_4_0_0_Case10829/cluster/src/main/org/jboss/ha/framework/server/HARMIServerImpl.java
===================================================================
--- branches/JBoss_4_0_0_Case10829/cluster/src/main/org/jboss/ha/framework/server/HARMIServerImpl.java	2006-08-30 16:38:09 UTC (rev 56449)
+++ branches/JBoss_4_0_0_Case10829/cluster/src/main/org/jboss/ha/framework/server/HARMIServerImpl.java	2006-08-30 16:53:07 UTC (rev 56450)
@@ -48,6 +48,7 @@
    protected String key;
    protected Class intf;
    protected RefreshProxiesHATarget target;
+   private boolean trace;
 
    public HARMIServerImpl(HAPartition partition,
                           String replicantName,
@@ -81,6 +82,7 @@
    {
       this.handler = handler;
       this.log = Logger.getLogger(this.getClass());
+      this.trace = log.isTraceEnabled();
       this.intf = intf;
       this.key = partition.getPartitionName() + "/" + replicantName;
 
@@ -181,6 +183,8 @@
    {
       mi.setMethodMap(invokerMap);
       Method method = mi.getMethod();
+      if( trace )
+    	  log.trace("begin invoke");
 
       try
       {
@@ -206,6 +210,11 @@
       {
          throw (Exception)ite.getTargetException();
       }
+      finally
+      {
+	      if( trace )
+	    	  log.trace("end invoke");
+      }
    }
 
    public List getReplicants() throws Exception

Modified: branches/JBoss_4_0_0_Case10829/naming/src/main/org/jnp/interfaces/NamingContext.java
===================================================================
--- branches/JBoss_4_0_0_Case10829/naming/src/main/org/jnp/interfaces/NamingContext.java	2006-08-30 16:38:09 UTC (rev 56449)
+++ branches/JBoss_4_0_0_Case10829/naming/src/main/org/jnp/interfaces/NamingContext.java	2006-08-30 16:53:07 UTC (rev 56450)
@@ -517,7 +517,10 @@
       // Empty?
       if (name.isEmpty ())
          return new NamingContext (refEnv, prefix, naming);
-      
+
+      boolean trace = log.isTraceEnabled();
+      if( trace )
+    	  log.trace("Begin lookup: "+name);
       try
       {
          Name n = getAbsoluteName (name);
@@ -654,6 +657,11 @@
          ex.setRootCause (e);
          throw ex;
       }
+      finally
+      {
+          if( trace )
+        	  log.trace("End lookup: "+name);
+      }
    }
    
    public void unbind (String name)




More information about the jboss-cvs-commits mailing list