[jboss-cvs] JBossAS SVN: r58967 - trunk/system/src/main/org/jboss/system/server/profileservice

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Dec 10 20:06:50 EST 2006


Author: scott.stark at jboss.org
Date: 2006-12-10 20:06:48 -0500 (Sun, 10 Dec 2006)
New Revision: 58967

Modified:
   trunk/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java
Log:
Use reflection to reset the log manager to avoid compile time dependencies

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java	2006-12-11 01:02:32 UTC (rev 58966)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/ServerImpl.java	2006-12-11 01:06:48 UTC (rev 58967)
@@ -23,6 +23,7 @@
 package org.jboss.system.server.profileservice;
 
 import java.io.File;
+import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.Date;
 import java.util.Properties;
@@ -38,7 +39,6 @@
 import org.jboss.kernel.plugins.deployment.BasicKernelDeployer;
 import org.jboss.kernel.spi.event.KernelEvent;
 import org.jboss.logging.Logger;
-import org.jboss.logging.jdk.JBossJDKLogManager;
 import org.jboss.net.protocol.URLStreamHandlerFactory;
 import org.jboss.system.server.Server;
 import org.jboss.system.server.ServerConfig;
@@ -723,13 +723,20 @@
          if (log.isTraceEnabled())
             log.trace("Shutdown caller:", new Throwable("Here"));
 
-         // Execute the jdk JBossJDKLogManager doReset
+         // Execute the jdk JBossJDKLogManager doReset via reflection
          LogManager lm = LogManager.getLogManager();
-         if (lm instanceof JBossJDKLogManager)
+         try
          {
-            JBossJDKLogManager jbosslm = (JBossJDKLogManager)lm;
-            jbosslm.doReset();
-         } 
+            Class[] sig = {};
+            Method doReset = lm.getClass().getDeclaredMethod("doReset", sig);
+            Object[] args = {};
+            doReset.invoke(lm, args);
+         }
+         catch(Exception e)
+         {
+            if(log.isTraceEnabled())
+               log.trace("No doReset found?", e);
+         }
 
          Notification msg = new Notification(Server.STOP_NOTIFICATION_TYPE, this, 2);
          sendNotification(msg);




More information about the jboss-cvs-commits mailing list