admin@glassfish.java.net

CODE REVIEW: 3433: "WARNING in log file when stopping an instance"

From: Lloyd L Chambers <Lloyd.Chambers_at_Sun.COM>
Date: Thu, 26 Jul 2007 12:16:13 -0700

TIMEOUT: 17:00 PST 7/26/07

https://glassfish.dev.java.net/issues/show_bug.cgi?id=3433

A check for null is inserted now; CallFlow might not be available.

Index: src/java/com/sun/enterprise/management/monitor/
ServerRootMonitorImpl.java
===================================================================
RCS file: /cvs/glassfish/admin/mbeanapi-impl/src/java/com/sun/
enterprise/management/monitor/ServerRootMonitorImpl.java,v
retrieving revision 1.13
diff -w -u -r1.13 ServerRootMonitorImpl.java
--- src/java/com/sun/enterprise/management/monitor/
ServerRootMonitorImpl.java 5 May 2007 05:23:31 -0000 1.13
+++ src/java/com/sun/enterprise/management/monitor/
ServerRootMonitorImpl.java 26 Jul 2007 19:14:19 -0000
@@ -41,6 +41,7 @@
import java.util.Collections;
import javax.management.ObjectName;
+import javax.management.MBeanServer;
import javax.management.JMException;
import com.sun.appserv.management.base.XTypes;
@@ -48,6 +49,7 @@
import com.sun.appserv.management.base.AMX;
import com.sun.appserv.management.j2ee.J2EETypes;
import com.sun.appserv.management.util.misc.GSetUtil;
+import com.sun.appserv.management.util.misc.ExceptionUtil;
import com.sun.appserv.management.monitor.ServerRootMonitor;
import com.sun.appserv.management.monitor.CallFlowMonitor;
@@ -121,13 +123,20 @@
         {
             if ( getLoader().isDAS() )
             {
+ final MBeanServer mbeanServer = getMBeanServer();
+ final ObjectName callFlowObjectName =
getCallFlowMonitorObjectName();
+ // ObjectName might or might not be available
+ if ( callFlowObjectName != null )
+ {
             try
             {
- getMBeanServer().unregisterMBean
( getCallFlowMonitorObjectName() );
+ mbeanServer.unregisterMBean( callFlowObjectName );
                 }
                 catch( JMException e )
                 {
- logWarning( "ServerRootMonitorImpl: exception
unregistering CallFlowMonitor: " + e);
+ logWarning( "ServerRootMonitorImpl: exception
unregistering CallFlowMonitor: " +
+ ExceptionUtil.getRootCause(e));
+ }
                 }
                 }
         }