[jboss-cvs] JBossAS SVN: r67538 - branches/Branch_4_2/cluster/src/main/org/jboss/ha/framework/server.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Nov 28 00:04:07 EST 2007


Author: bstansberry at jboss.com
Date: 2007-11-28 00:04:07 -0500 (Wed, 28 Nov 2007)
New Revision: 67538

Modified:
   branches/Branch_4_2/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
Log:
[JBAS-4986] Remove compile-time dependency on Debugger

Modified: branches/Branch_4_2/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
===================================================================
--- branches/Branch_4_2/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java	2007-11-28 04:47:15 UTC (rev 67537)
+++ branches/Branch_4_2/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java	2007-11-28 05:04:07 UTC (rev 67538)
@@ -22,6 +22,7 @@
 package org.jboss.ha.framework.server;
 
 
+import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.net.InetAddress;
 import java.rmi.dgc.VMID;
@@ -46,7 +47,6 @@
 import org.jgroups.Channel;
 import org.jgroups.JChannel;
 import org.jgroups.Version;
-import org.jgroups.debug.Debugger;
 import org.jgroups.jmx.JChannelFactoryMBean;
 import org.jgroups.jmx.JmxConfigurator;
 import org.w3c.dom.Attr;
@@ -97,7 +97,7 @@
    protected JChannelFactoryMBean multiplexer = null;
    protected String stackName = null;
    protected org.jgroups.JChannel channel;
-   protected Debugger debugger=null;
+   protected Object debugger=null;
    protected boolean use_debugger=false;
 
    protected String nodeName = null;
@@ -343,8 +343,7 @@
       
       if(use_debugger && debugger == null)
       {
-         debugger=new Debugger(channel);
-         debugger.start();
+         startChannelDebugger();
       }
       channel.setOpt(Channel.AUTO_RECONNECT, Boolean.TRUE);
       channel.setOpt(Channel.AUTO_GETSTATE, Boolean.TRUE);
@@ -529,8 +528,20 @@
    {
       if(debugger == null)
       {
-         debugger=new Debugger(this.channel, accumulative);
-         debugger.start();
+         try
+         {
+            Class clazz = getClass().getClassLoader().loadClass("org.jgroups.debug.Debugger");
+            Constructor ctor = clazz.getConstructor(new Class[]
+            {JChannel.class, boolean.class});
+            debugger = ctor.newInstance(new Object[]
+            {channel, Boolean.valueOf(accumulative)});
+            Method start = clazz.getDeclaredMethod("start", new Class[] {});
+            start.invoke(debugger, new Object[] {});
+         }
+         catch (Exception e)
+         {
+            log.error("Unable to start Debugger", e);
+         }
       }
    }
 
@@ -538,7 +549,16 @@
    {
       if(debugger != null)
       {
-         // debugger.stop(); // uncomment when new JGroups version is available
+         Class clazz = debugger.getClass();
+         try
+         {
+            Method stop = clazz.getDeclaredMethod("stop", new Class[] {});
+            stop.invoke(debugger, new Object[]{});
+         }
+         catch (Exception e)
+         {
+            log.error("Unable to cleanly stop Debugger", e);
+         }
          debugger=null;
       }
    }




More information about the jboss-cvs-commits mailing list