admin@glassfish.java.net

CODE REVIEW: MBeanServer initialization at startup (bug #1409)

From: Lloyd L Chambers <Lloyd.Chambers_at_Sun.COM>
Date: Thu, 12 Apr 2007 16:12:49 -0700

TIMEOUT: April 12, 12:00pm Pacific Standard time (Please review by
that time for your comments to be considered)

Minimizing impact as much as possible, I've addressed the following bug:
https://glassfish.dev.java.net/issues/show_bug.cgi?id=1409

This fix is non-trivial. I will also be sending out changed files
and asking other engineers to test it first, before committing. QL
EE passes twice in a row on my Mac OS X quad-core system. I'll also
test it on Solaris, but I NEED HELP to test it on Windows and Linux.

The basic idea is that at startup, DynamicInterceptor is inserted as
the MBeanServer. It delegates to the standard JMX MBeanServer.
SunoneInterceptor cannot be created at that time, so when
AdminService runs at a later time, it inserts SunoneInterceptor as a
hook into DynamicInterceptor. This preserves the existing behavior
of SunoneInterceptor, while precluding bugs like #1409 (hardly unique).

The change also enables some optimizations for much faster startup;
with the MBeanServer available right away, various services can
initialize themselves without waiting.

Lloyd

---------------------

RCS file: /cvs/glassfish/admin/mbeanapi-impl/src/java/com/sun/
enterprise/management/support/LoaderBase.java,v
retrieving revision 1.8
diff -w -u -r1.8 LoaderBase.java
--- admin/mbeanapi-impl/src/java/com/sun/enterprise/management/
support/LoaderBase.java 7 Feb 2007 02:14:01 -0000 1.8
+++ admin/mbeanapi-impl/src/java/com/sun/enterprise/management/
support/LoaderBase.java 12 Apr 2007 22:54:54 -0000
@@ -186,6 +186,11 @@

              filter.enableAllObjectNames();

+ if ( mServer != server )
+ {
+ throw new IllegalStateException();
+ }
+
                         JMXUtil.listenToMBeanServerDelegate
( mServer, this, filter, null );

                 }


RCS file: /cvs/glassfish/admin/mbeanapi-impl/src/java/com/sun/
enterprise/management/support/LoaderRegThread.java,v
retrieving revision 1.7
diff -w -u -r1.7 LoaderRegThread.java
--- admin/mbeanapi-impl/src/java/com/sun/enterprise/management/
support/LoaderRegThread.java 10 Jan 2007 04:22:38 -0000 1.7
+++ admin/mbeanapi-impl/src/java/com/sun/enterprise/management/
support/LoaderRegThread.java 12 Apr 2007 22:54:54 -0000
@@ -41,8 +41,6 @@
  import java.util.concurrent.ArrayBlockingQueue;

  import javax.management.ObjectName;
-import javax.management.MBeanRegistration;
-import javax.management.NotificationListener;

  import com.sun.appserv.management.util.misc.ExceptionUtil;
  import com.sun.appserv.management.util.jmx.JMXUtil;
@@ -62,7 +60,7 @@
      }

         private volatile boolean mQuit;
- private ArrayBlockingQueue<QueueItem> mQueue;
+ private final ArrayBlockingQueue<QueueItem> mQueue;
         private final Logger mLogger;
         private final LoaderRegHandler mRegHandler;




RCS file: /cvs/glassfish/admin-core/admin/src/java/com/sun/enterprise/
admin/meta/MBeanRegistry.java,v
retrieving revision 1.11
diff -w -u -r1.11 MBeanRegistry.java
--- admin-core/admin/src/java/com/sun/enterprise/admin/meta/
MBeanRegistry.java 3 Apr 2007 01:13:39 -0000 1.11
+++ admin-core/admin/src/java/com/sun/enterprise/admin/meta/
MBeanRegistry.java 12 Apr 2007 22:54:55 -0000
@@ -218,7 +218,6 @@
  import javax.management.DynamicMBean;
  import javax.management.ObjectName;
  import javax.management.Descriptor;
-import javax.management.MBeanServerFactory;
  import javax.management.MalformedObjectNameException;

  import com.sun.org.apache.commons.modeler.ManagedBean;
@@ -241,6 +240,8 @@
  import com.sun.enterprise.config.serverbeans.ServerXPathHelper;
  import com.sun.enterprise.config.ConfigContextEvent;

+import com.sun.enterprise.util.FeatureAvailability;
+
  /**
   * Provides naming support for Mbeans
   */
@@ -248,6 +249,12 @@
  {
      private final static String MSG_FINDREGISTRYENTRY_FAILED =
"mbean.config.findregistryentry_failed";

+ private final MBeanServer mMBeanServer;
+
+ public MBeanRegistry() {
+ mMBeanServer = FeatureAvailability.getInstance
().getMBeanServer();
+ }
+
      // Logging
      protected static final Logger _sLogger = LogDomains.getLogger
(LogDomains.ADMIN_LOGGER);

@@ -675,8 +682,7 @@
              ObjectName objectName = getObjectNameForConfigBean
(bean, domainName);
              if(objectName!=null)
              {
- MBeanServer mServer = (MBeanServer)
MBeanServerFactory.findMBeanServer(null).get(0);
- if (!mServer.isRegistered(objectName))
+ if (! mMBeanServer.isRegistered(objectName))
                  {
  //register here
                      BaseAdminMBean mbean = instantiateConfigMBean
(objectName, null, ctx) ;
@@ -733,9 +739,8 @@
       */
      private void registerMBean(BaseAdminMBean mbean, ObjectName name)
                                          throws Exception {
- MBeanServer mServer = (MBeanServer)
MBeanServerFactory.findMBeanServer(null).get(0);
- if (!mServer.isRegistered(name)) {
- mServer.registerMBean(mbean, name);
+ if (! mMBeanServer.isRegistered(name)) {
+ mMBeanServer.registerMBean(mbean, name);
          }
      }
      //
************************************************************************
****************************
@@ -758,8 +763,7 @@
      private void addDottedName(String dottedName, ObjectName
objectName) throws Exception
      {
          _sLogger.log(Level.FINE, "******regDottedName*******
"+dottedName +" ObjectName="+objectName);
- MBeanServer mbeanServer = (MBeanServer)
MBeanServerFactory.findMBeanServer(null).get(0);
- mbeanServer.invoke(REGISTRATION_MBEAN_OBJECTNAME,
REGISTRATION_OPERATION_NAME,
+ mMBeanServer.invoke(REGISTRATION_MBEAN_OBJECTNAME,
REGISTRATION_OPERATION_NAME,
                         new Object[]{dottedName, objectName},
                         new String[]{dottedName.getClass().getName
(), objectName.getClass().getName()});
      }
@@ -767,8 +771,7 @@
      private void removeDottedName(ObjectName objectName) throws
Exception
      {
          _sLogger.log(Level.FINE, "******unregDottedName******* for
ObjectName="+objectName);
- MBeanServer mbeanServer = (MBeanServer)
MBeanServerFactory.findMBeanServer(null).get(0);
- mbeanServer.invoke(REGISTRATION_MBEAN_OBJECTNAME,
UNREGISTRATION_OPERATION_NAME,
+ mMBeanServer.invoke(REGISTRATION_MBEAN_OBJECTNAME,
UNREGISTRATION_OPERATION_NAME,
                         new Object[]{objectName},
                         new String[]{objectName.getClass().getName()});
      }
@@ -896,9 +899,8 @@
                  // now, try to unregister MBean
                  try
                  {
- MBeanServer server = (MBeanServer)
MBeanServerFactory.findMBeanServer(null).get(0);
- if(server.isRegistered(objectName))
- server.unregisterMBean(objectName);
+ if( mMBeanServer.isRegistered(objectName))
+ mMBeanServer.unregisterMBean(objectName);
  // else
  // //just to unregister dotted name
  // notifyUnregisterMBean(objectName,
getConfigContext());


RCS file: /cvs/glassfish/admin-core/admin/src/java/com/sun/enterprise/
interceptor/DynamicInterceptor.java,v
retrieving revision 1.2
diff -w -u -r1.2 DynamicInterceptor.java
--- admin-core/admin/src/java/com/sun/enterprise/interceptor/
DynamicInterceptor.java 3 Apr 2007 01:13:40 -0000 1.2
+++ admin-core/admin/src/java/com/sun/enterprise/interceptor/
DynamicInterceptor.java 12 Apr 2007 22:54:55 -0000
@@ -61,7 +61,7 @@
      //private final Logger sLogger = Logger.getLogger
(AdminConstants.kLoggerName);
      //private StringManager localStrings =
StringManager.getManager( SunoneInterceptor.class );

- private MBeanServer mDelegateMBeanServer;
+ private volatile MBeanServer mDelegateMBeanServer;

      protected final AMXDebugHelper mDebug;

@@ -73,7 +73,7 @@
          mDelegateMBeanServer = null;

          mDebug = new AMXDebugHelper( "__DynamicInterceptor__" );
- mDebug.setEchoToStdOut( false ); // must not print to
stdout, or a infinit recursion might result
+ mDebug.setEchoToStdOut( false ); // must not print to
stdout, or a infinite recursion might result
          debug( "DynamicInterceptor.DynamicInterceptor" );

          mHooks = Collections.synchronizedMap( new
HashMap<String,DynamicInterceptorHook>() );
@@ -99,7 +99,9 @@
          {
              throw new IllegalStateException();
          }
- hook.setDelegateMBeanServer( getDelegateMBeanServer() );
+
+ debug( "Added hook for JMX domain ", jmxDomain,
+ " using hook of class ", hook.getClass().getName() );

          mHooks.put( jmxDomain, hook );
      }
@@ -113,7 +115,7 @@
      /**
          Get the MBeanServer to which the request can be delegated.
       */
- protected MBeanServer
+ public MBeanServer
      getDelegateMBeanServer()
      {
          return mDelegateMBeanServer;
@@ -126,7 +128,7 @@
      }

      /** May/must be called once exactly once. */
- void
+ public void
      setDelegateMBeanServer( final MBeanServer server )
      {
          debug( "DynamicInterceptor.setDelegateMBeanServer: " +
server.getClass().getName() );
@@ -135,9 +137,13 @@
              throw new IllegalStateException();
          }
          mDelegateMBeanServer = server;
+
+ //System.out.println( "DynamicInterceptor: set
mDelegateMBeanServer to " +
+ // "MBeanServer of class " + server.getClass().getName() );
      }


+
          public Object
      invoke(
          final ObjectName objectName,
@@ -251,6 +257,7 @@
                  throw e;
              }

+ /*
              if ( "server-instance".equals( objectName.getKeyProperty
( "type" ) ) )
              {
                  final String msg = "MBean " + JMXUtil.toString
(objectName) + " is used, why?";
@@ -258,6 +265,7 @@
                  debug( msg, "\n", e );
                  throw e;
              }
+ */
          }
      }

@@ -294,7 +302,18 @@
          InstanceNotFoundException, IntrospectionException,
ReflectionException
      {
          debug( "DynamicInterceptor.getMBeanInfo: ", objectName );
- return getDelegateMBeanServer().getMBeanInfo( objectName );
+ MBeanInfo result = null;
+
+ final DynamicInterceptorHook hook = getHook(objectName);
+ if ( hook != null )
+ {
+ result = hook.getMBeanInfo( objectName );
+ }
+ else
+ {
+ result = getDelegateMBeanServer().getMBeanInfo
( objectName );
+ }
+ return result;
      }

      public final boolean isRegistered( final ObjectName objectName)
@@ -532,14 +551,39 @@
          throws InstanceNotFoundException
      {
          debug( "DynamicInterceptor.getClassLoader: ", objectName );
- return getDelegateMBeanServer().getClassLoader( objectName );
+
+ ClassLoader result = null;
+
+ final DynamicInterceptorHook hook = getHook(objectName);
+ if ( hook != null )
+ {
+ debug( "calling hook" );
+ result = hook.getClassLoader( objectName );
+ }
+ else
+ {
+ result = getDelegateMBeanServer().getClassLoader
( objectName );
+ }
+ return result;
      }

          public final ClassLoader
      getClassLoaderFor( final ObjectName objectName)
          throws InstanceNotFoundException
      {
- final ClassLoader result = getDelegateMBeanServer
().getClassLoaderFor( objectName );
+ debug( "DynamicInterceptor.getClassLoaderFor: ", objectName);
+ ClassLoader result = null;
+
+ final DynamicInterceptorHook hook = getHook(objectName);
+ if ( hook != null )
+ {
+ debug( "calling hook" );
+ result = hook.getClassLoaderFor( objectName );
+ }
+ else
+ {
+ result = getDelegateMBeanServer().getClassLoaderFor
( objectName );
+ }
          return result;
      }



RCS file: /cvs/glassfish/admin-core/admin/src/java/com/sun/enterprise/
interceptor/DynamicInterceptorHook.java,v
retrieving revision 1.1
diff -w -u -r1.1 DynamicInterceptorHook.java
--- admin-core/admin/src/java/com/sun/enterprise/interceptor/
DynamicInterceptorHook.java 12 Jan 2007 04:14:33 -0000 1.1
+++ admin-core/admin/src/java/com/sun/enterprise/interceptor/
DynamicInterceptorHook.java 12 Apr 2007 22:54:55 -0000
@@ -24,6 +24,7 @@

  import javax.management.MBeanServer;
  import javax.management.ObjectName;
+import javax.management.MBeanInfo;
  import javax.management.Attribute;
  import javax.management.AttributeList;
  import javax.management.InvalidAttributeValueException;
@@ -32,9 +33,12 @@
  import javax.management.MBeanException;
  import javax.management.ReflectionException;
  import javax.management.InstanceNotFoundException;
+import javax.management.IntrospectionException;

  /**
- Interface which must be implemented by
+ Interface which must be implemented by anything wishing to "hook"
+ the DynamicInterceptor for the methods declared here; not all
methods
+ of the MBeanServer are hooked.
   */
  public interface DynamicInterceptorHook
  {
@@ -60,11 +64,11 @@
      public AttributeList setAttributes (final ObjectName
objectName, final AttributeList attributeList)
          throws InstanceNotFoundException, ReflectionException;

+ public ClassLoader getClassLoader(ObjectName objectName) throws
InstanceNotFoundException;
+ public ClassLoader getClassLoaderFor(ObjectName objectName)
throws InstanceNotFoundException;

- /** will be called when hook is set within DynamicInterceptor */
- void setDelegateMBeanServer( final MBeanServer delegate );
-
-
+ public MBeanInfo getMBeanInfo(ObjectName objectName)
+ throws InstanceNotFoundException, IntrospectionException,
ReflectionException;
  };





RCS file: /cvs/glassfish/admin-ee/admin/src/java/com/sun/enterprise/
ee/admin/AppServerMBeanServerBuilder.java,v
retrieving revision 1.3
diff -w -u -r1.3 AppServerMBeanServerBuilder.java
--- admin-ee/admin/src/java/com/sun/enterprise/ee/admin/
AppServerMBeanServerBuilder.java 13 Jan 2007 03:27:39
-0000 1.3
+++ admin-ee/admin/src/java/com/sun/enterprise/ee/admin/
AppServerMBeanServerBuilder.java 12 Apr 2007 22:54:56 -0000
@@ -51,7 +51,6 @@

       /**
        * synchronized on the base class
- */
       public MBeanServer newMBeanServer(String defaultDomain,
                                      MBeanServer outer,
                                      MBeanServerDelegate delegate) {
@@ -71,18 +70,5 @@
               }
           }
       }
-
- /**
- * This method can be used to add interceptors in different
versions
- * of the product. For SE, new cascading interceptor is added.
       */
- protected MBeanServer addInterceptor(MBeanServer mbs) {
-/* //Temporarily returning just the mbs. TBD FIXME
-
- MBeanServer cascadingInterceptor = new
CascadingInterceptor(mbs);
- _logger.log(Level.FINE, "Adding CascadingInterceptor to
MBeanServer");
- return cascadingInterceptor;
-*/
- return mbs;
- }
  }


RCS file: /cvs/glassfish/admin-ee/nodeagent/src/java/com/sun/
enterprise/ee/nodeagent/NodeAgentMain.java,v
retrieving revision 1.6
diff -w -u -r1.6 NodeAgentMain.java
--- admin-ee/nodeagent/src/java/com/sun/enterprise/ee/nodeagent/
NodeAgentMain.java 3 Mar 2007 00:55:18 -0000 1.6
+++ admin-ee/nodeagent/src/java/com/sun/enterprise/ee/nodeagent/
NodeAgentMain.java 12 Apr 2007 22:54:56 -0000
@@ -23,6 +23,9 @@

  package com.sun.enterprise.ee.nodeagent;

+import java.lang.management.ManagementFactory;
+import javax.management.MBeanServer;
+
  import java.io.IOException;
  import java.util.logging.Logger;
  import java.util.logging.Level;
@@ -51,8 +54,15 @@
  import com.sun.enterprise.admin.event.AdminEventListenerException;
  import com.sun.enterprise.security.store.IdentityManager;

+
+import com.sun.appserv.management.util.misc.RunnableBase;
+import com.sun.enterprise.util.FeatureAvailability;
+import static
com.sun.enterprise.util.FeatureAvailability.MBEAN_SERVER_FEATURE;
+
+
+
  class Shutdown implements ShutdownEventListener {
- private BaseNodeAgent bna=null;
+ private final BaseNodeAgent bna;

      public Shutdown(BaseNodeAgent bna) {
          this.bna=bna;
@@ -78,21 +88,21 @@
      private static final StringManager
_strMgr=StringManager.getManager(NodeAgentMain.class);
      private static AgentConfig _config = null;
      private static Logger _logger = null;
- private static boolean bDebug=false;
+ private static volatile boolean bDebug=false;

      private static void usage()
      {
          System.out.println("usage: NodeAgentMain start|stop");
      }

- private static AgentConfig getConfig() {
+ private static synchronized AgentConfig getConfig() {
          if (_config == null) {
              _config = new AgentConfig();
          }
          return _config;
      }

- static Logger getLogger() {
+ static synchronized Logger getLogger() {
          if (_logger == null) {
              _logger = Logger.getLogger
(EELogDomains.NODE_AGENT_LOGGER,
"com.sun.logging.ee.enterprise.system.nodeagent.LogStrings");
              if (bDebug) {
@@ -175,7 +185,28 @@

      }

+
+ /**
+ Load the MBeanServer.
+ */
+ private static final class LoadMBeanServer extends RunnableBase {
+ LoadMBeanServer() {
+ super( "NodeAgentMain-LoadMBeanServer" );
+ }
+ protected void doRun() {
+ final MBeanServer mbeanServer =
ManagementFactory.getPlatformMBeanServer();
+ FeatureAvailability.getInstance().registerFeature(
+ MBEAN_SERVER_FEATURE, mbeanServer);
+ System.out.println( "class of platform MBeanServer is " +
+ mbeanServer.getClass().getName() );
+ }
+ };
+
+
+
      public static void main (String[] args) {
+ new LoadMBeanServer().submit
( RunnableBase.HowToRun.RUN_IN_SEPARATE_THREAD );
+
          try {
              // look for Debug system property
              if (System.getProperty("Debug") != null) {



RCS file: /cvs/glassfish/appserv-addons/impl/src/java/com/sun/
enterprise/addons/AddonController.java,v
retrieving revision 1.4
diff -w -u -r1.4 AddonController.java
--- appserv-addons/impl/src/java/com/sun/enterprise/addons/
AddonController.java 30 Jan 2007 01:42:39 -0000 1.4
+++ appserv-addons/impl/src/java/com/sun/enterprise/addons/
AddonController.java 12 Apr 2007 22:54:56 -0000
@@ -46,6 +46,7 @@
   * functionality for AddonInstallationController and
   * AddonConfigurationController. It is also the basic
   * factory that provide concrete Controller classes.
+ * <p><b>NOT THREAD SAFE: mutable instance variable: logger,
installRoot, servicesAreLoaded</b>
   *
   * @see AddonInstallationController
   * @see AddonConfigurationController
@@ -54,14 +55,14 @@
   */
  public abstract class AddonController {

- private HashMap apiBasedServices = new HashMap();
- private HashMap mainClassBasedServices = new HashMap();
- private HashMap simpleJars = new HashMap();
- private File installRoot = null;
+ private final HashMap apiBasedServices = new HashMap();
+ private final HashMap mainClassBasedServices = new HashMap();
+ private final HashMap simpleJars = new HashMap();
+ private volatile File installRoot = null;
      private boolean servicesAreLoaded = false;

- private Logger logger = null;
- protected static StringManager localStrings =
+ private volatile Logger logger = null;
+ protected static final StringManager localStrings =
      StringManager.getManager(AddonController.class);

      /*
@@ -251,7 +252,7 @@
      /**
       * Return the logger instance used for logging.
       */
- protected Logger getLogger() {
+ protected synchronized Logger getLogger() {
          if (logger == null) {
              return Logger.getAnonymousLogger();
          }



RCS file: /cvs/glassfish/appserv-commons/src/java/com/sun/enterprise/
util/FeatureAvailability.java,v
retrieving revision 1.7
diff -w -u -r1.7 FeatureAvailability.java
--- appserv-commons/src/java/com/sun/enterprise/util/
FeatureAvailability.java 28 Feb 2007 01:01:40 -0000 1.7
+++ appserv-commons/src/java/com/sun/enterprise/util/
FeatureAvailability.java 12 Apr 2007 22:54:57 -0000
@@ -75,6 +75,9 @@
      /** feature stating that the MBeanServer is available. Result
data is the MBeanServer */
      public static final String MBEAN_SERVER_FEATURE =
"MBeanServer";

+ /** feature stating that the SunoneInterceptor is active.
Associated data should be ignored. */
+ public static final String SUN_ONE_INTERCEPTOR_FEATURE =
"SunoneInterceptor";
+
      /** feature stating that the com.sun.appserv:category=config
MBeans are available.
              Result data should not be used */
      public static final String
COM_SUN_APPSERV_CONFIG_MBEANS_FEATURE =
"com.sun.appserv:category=config";



RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/
admin/common/MBeanServerFactory.java,v
retrieving revision 1.6
diff -w -u -r1.6 MBeanServerFactory.java
--- appserv-core/src/java/com/sun/enterprise/admin/common/
MBeanServerFactory.java 7 Feb 2007 02:13:59 -0000 1.6
+++ appserv-core/src/java/com/sun/enterprise/admin/common/
MBeanServerFactory.java 12 Apr 2007 22:54:57 -0000
@@ -23,79 +23,12 @@

  package com.sun.enterprise.admin.common;

-//JDK imports
-
-//JMX imports
  import javax.management.MBeanServer;

-// i18n import
-import com.sun.enterprise.admin.util.SOMLocalStringsManager;
-
  import com.sun.enterprise.util.FeatureAvailability;

-
-/**
- A class to create instances of MBeanServer. Note that this is
not analogous
- to classic Factory Pattern, since this factory needs to be
initialized
- according to context. Server Object Model requires MBeanServer
reference
- only when it runs in the context of admin server (meaning it is
called from
- the admin html GUI). In case of clients that do not run in the
JVM of the
- admin server, i.e. CLI and Plugin, Server Object Model does not
need the
- reference to MBeanServer as it goes via the HTTP connector.
- Hence this class provides a method to initialize the factory.
The factory
- should be initialized at admin server startup. This is currently
done
- in AdminService class.
-
- @version 1.0
- @author Kedar Mhaswade
-*/
-
  public class MBeanServerFactory
  {
- public static final String kDefaultInitializerClassName =
- "com.sun.enterprise.admin.server.core.AdminService";
-
- // i18n SOMLocalStringsManager
- private static SOMLocalStringsManager localizedStrMgr =
- SOMLocalStringsManager.getManager
( MBeanServerFactory.class );
-
- /**
- Initializes this factory. Also creates the singleton
MBeanServer instance
- in the admin server's JVM. It does not allow any class to
initialize the
- factory. Currently only the default initializer is able to
create the
- instance. If the initializer is not the default one then
IllegalArgumentException
- will be thrown. The initializer has to initialize the
MBeanServer instance.
- The parameters may not be null.
- @param initializer instance of Object with proper class.
- @param mbs instance of MBeanServer's implementation that
acts as singleton.
- @throws IllegalArgumentException if the contract is not
satisfied by caller.
- @throws IllegalStateException if the initialize has been
called already.
- */
- public static void initialize(Object initializer, MBeanServer mbs)
- {
- if (initializer == null || mbs == null)
- {
- String msg = localizedStrMgr.getString
( "admin.common.null_arg" );
- throw new IllegalArgumentException( msg );
- }
- if (!initializer.getClass().getName().equals
(kDefaultInitializerClassName))
- {
- String msg = localizedStrMgr.getString
( "admin.common.invalid_initializer" );
- throw new IllegalArgumentException( msg );
- }
-
- FeatureAvailability.getInstance().registerFeature(
- FeatureAvailability.MBEAN_SERVER_FEATURE, mbs );
- }
-
- /**
- Returns the instance of singleton (for Admin Server's JVM)
for MBeanServer.
- Returns null if the factory is not initiazed earlier. Thus a
null will be
- returned when this method is called in a client's context.
In case of
- Server context, since the initiazation of factory is
expected to provide
- the implementation, this should return a non null value (a
valid instance).
- @return instance of MBeanServer, null if Factory is not
initialized.
- */
      public static MBeanServer getMBeanServer()
      {
          return FeatureAvailability.getInstance().getMBeanServer();


RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/
admin/server/core/AdminService.java,v
retrieving revision 1.23
diff -w -u -r1.23 AdminService.java
--- appserv-core/src/java/com/sun/enterprise/admin/server/core/
AdminService.java 10 Apr 2007 16:14:00 -0000 1.23
+++ appserv-core/src/java/com/sun/enterprise/admin/server/core/
AdminService.java 12 Apr 2007 22:54:57 -0000
@@ -105,7 +105,7 @@
  import com.sun.enterprise.util.FeatureAvailability;

  import com.sun.appserv.management.util.misc.RunnableBase;
-
+import com.sun.enterprise.interceptor.DynamicInterceptor;

  /**
   * Admin service is a singleton in every instance and acts as
gateway to server
@@ -151,11 +151,13 @@

      private static AdminService adminService = null;

+ private static final String COM_SUN_APPSERV = "com.sun.appserv";
+
      /** prefix for administrative domain name */
- private static final String ADMIN_DOMAIN_NAME_PREFIX =
"com.sun.appserv.";
+ private static final String ADMIN_DOMAIN_NAME_PREFIX =
COM_SUN_APPSERV + ".";

      /** default administrative domain name */
- private static final String
DEF_ADMIN_DOMAIN_NAME="com.sun.appserv.server";
+ private static final String
DEF_ADMIN_DOMAIN_NAME=ADMIN_DOMAIN_NAME_PREFIX + "server";

      private static final String kTempDirNamePrefix = "s1astemp";
      private static final String kGUITempDirName = "gui";
@@ -269,7 +271,6 @@
       * @throws LifeCycleException in case the initialzation fails.
       */
      void init() throws ServerLifecycleException {
-
          if (isDas()) {
              // remove restart required state file when starting up DAS
              RRStateFactory.removeStateFile();
@@ -277,8 +278,25 @@
          adminChannel = new AdminChannelLifecycle();
          adminChannel.onInitialization(context);

- MBeanServer mbs = null;
+ final DynamicInterceptor dyn = (DynamicInterceptor)
getMBeanServer();
+ final MBeanServer delegateMBeanServer =
dyn.getDelegateMBeanServer();
+ adminContext.setMBeanServer( dyn );
+
+ final SunoneInterceptor sunone =
+ SunoneInterceptor.createInstance(adminContext, dyn,
delegateMBeanServer);
+ dyn.addHook( COM_SUN_APPSERV, sunone );
+ FeatureAvailability.getInstance().registerFeature(
+ FeatureAvailability.SUN_ONE_INTERCEPTOR_FEATURE, "true");
+ AMXLoggingHook.enableLoggingHook();
+ sunone.registerConfigMBeans();

+ sLogger.log(Level.INFO, "core.mbs_init_ok");
+ initCallFlow();
+
+ //initialize JKS properties.
+ setupJKS();
+ /*
+ MBeanServer mbs = null;
          try {
              SunoneInterceptor.setAdminContext(adminContext);
              mbs = SunoneInterceptor.getMBeanServerInstance();
@@ -304,6 +322,7 @@
              }
              throw new ServerLifecycleException(t.getMessage());
          }
+ */
      }

      private void setupJKS() {
@@ -488,6 +507,7 @@
       */
      protected void setAdminContext(AdminContext ctx) {
           adminContext = ctx;
+ adminContext.setMBeanServer( getMBeanServer() );
      }

      /**
@@ -856,7 +876,7 @@
      }

      private void registerLogManagerMBean() {
- MBeanServer mbs = adminContext.getMBeanServer();
+ final MBeanServer mbs = FeatureAvailability.getInstance
().getMBeanServer();
          try {
              Object mbean =
                       
com.sun.enterprise.server.logging.LogMBean.getInstance();
@@ -921,7 +941,7 @@
      public static final String AMX_LOADER_DEFAULT_OBJECTNAME =
          "amx-support:name=mbean-loader";

- private ObjectName mAMXLoaderObjectName = null;
+ private volatile ObjectName mAMXLoaderObjectName = null;

      /**
          Initializes AMX MBeans
@@ -941,6 +961,9 @@
              mAMXLoaderObjectName =
                  getMBeanServer().registerMBean( loader,
tempObjectName ).getObjectName();

+ System.out.println( "REGISTERED AMX LOADER: " +
mAMXLoaderObjectName );
+ System.out.println( "MBeanServer class: " +
getMBeanServer().getClass().getName() );
+
              sLogger.log(Level.INFO, "mbean.init_amx_success");
          }
          catch(Exception e) {
@@ -951,14 +974,9 @@
          }
      }

- private MBeanServer
+ private static MBeanServer
      getMBeanServer() {
- try {
- return AppServerMBeanServerFactory.getMBeanServerInstance
();
- }
- catch( Exception e ) {
- throw new RuntimeException( e );
- }
+ return FeatureAvailability.getInstance().getMBeanServer();
      }


@@ -978,7 +996,7 @@

      private void initiateCustomMBeanLoading() throws
ServerLifecycleException {
          try {
- final MBeanServer mbs = adminContext.getMBeanServer();
+ final MBeanServer mbs = getMBeanServer();
          final ConfigContext cc = context.getConfigContext();
          new CustomMBeanRegistrationHelper(mbs, cc).registerMBeans();
          } catch (final Exception e) {



RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/
admin/server/core/jmx/AppServerMBeanServerBuilder.java,v
retrieving revision 1.5
diff -w -u -r1.5 AppServerMBeanServerBuilder.java
--- appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/
AppServerMBeanServerBuilder.java 13 Jan 2007 03:27:28 -0000 1.5
+++ appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/
AppServerMBeanServerBuilder.java 12 Apr 2007 22:54:57 -0000
@@ -37,6 +37,11 @@
  import com.sun.enterprise.admin.common.constant.AdminConstants;
  import java.util.logging.Level;

+import com.sun.enterprise.interceptor.DynamicInterceptor;
+
+import com.sun.enterprise.util.FeatureAvailability;
+
+
  /**
   * AppServer MBSBuilder for PE set as the value for
javax.management.initial.builder
   * in the environment. This builder extends from
javax.management.MBeanServerBuilder
@@ -46,16 +51,11 @@
   * @author sridatta
   */
  public class AppServerMBeanServerBuilder extends
javax.management.MBeanServerBuilder {
-
      private static final MBeanServerBuilder defaultBuilder = new
MBeanServerBuilder();

- protected static final Logger _logger =
- Logger.getLogger(AdminConstants.kLoggerName);
+ protected static final Logger _logger = Logger.getLogger
(AdminConstants.kLoggerName);

- /*
- * indicates whether to instantiate App Server MBS (with
interceptors)
- */
- private static boolean createAppServerMBeanServer = false;
+ private static MBeanServer _defaultMBeanServer = null;

      /** Creates a new instance of MBeanServerBuilder */
      public AppServerMBeanServerBuilder() {
@@ -98,20 +98,26 @@
                                      MBeanServer outer,
                                      MBeanServerDelegate delegate) {

+ MBeanServer mbeanServer = null;
          synchronized (AppServerMBeanServerBuilder.class) {
- if (!createAppServerMBeanServer) {
- _logger.log(Level.FINE,
- "Creating default JMX MBeanServer in
AppServerMBeanServerBuilder");
- return defaultBuilder.newMBeanServer(defaultDomain,
- outer,
- delegate);
- } else {
- _logger.log(Level.FINEST,
- "Creating MBeanServer with appserver
interceptors in AppServerMBeanServerBuilder");
- return newAppServerMBeanServer(defaultDomain,
delegate);
+ /*
+ We *must* create the first MBeanServer as our
special one. Later MBeanServers
+ can be the standard JMX one.
+ */
+ if ( _defaultMBeanServer == null ) { // first time
+ mbeanServer = newAppServerMBeanServer(defaultDomain,
delegate);
+ _defaultMBeanServer = mbeanServer;
               }
+ else {
+ mbeanServer = defaultBuilder.newMBeanServer(
+ defaultDomain, outer, delegate);
          }
       }
+ _logger.log(Level.FINE, "MBeanServer class = " +
+ mbeanServer.getClass().getName() );
+
+ return mbeanServer;
+ }

       /**
        * creates a jmx MBeanServer
@@ -127,36 +133,14 @@
        */
       protected MBeanServer newAppServerMBeanServer(String
defaultDomain,
                                                  MBeanServerDelegate
delegate) {
- try {
- // To allow outer to be set to the extra interceptor
- // It does not affect PE in anyway.
- MBeanServer appserverMBS = new SunoneInterceptor();
- MBeanServer newAppserverMBS = addInterceptor
(appserverMBS);
- MBeanServer jmxMBS =
- defaultBuilder.newMBeanServer(defaultDomain,
- newAppserverMBS,
- delegate);
- ((SunoneInterceptor) appserverMBS).setJmxMBeanServer
(jmxMBS);
- _logger.log(Level.FINEST,
- "Created MBeanServer in AppServerMBeanServerBuilder");
- return newAppserverMBS;
-
- } catch (InitException e) {
- _logger.log(Level.FINE, "InitException while creating
MBeanServer", e);
- throw new RuntimeException(e.getMessage(), e.getCause());
- }
- }
+ // we cannot yet create the SunoneInterceptor; it will be
inserted
+ // later by the AdminService
+ final DynamicInterceptor result = new DynamicInterceptor();
+ final MBeanServer jmxMBS = defaultBuilder.newMBeanServer(
+ defaultDomain, result, delegate);
+ result.setDelegateMBeanServer( jmxMBS );

- /**
- * This method can be used to add interceptors in different
versions
- * of the product. For PE, additional interceptor is not required
- */
- protected MBeanServer addInterceptor(MBeanServer mbs) {
- // no additional interceptors in PE.
- _logger.log(Level.FINEST,
- "No additional interceptors added in" +
- "addInterceptor() in AppServerMBeanServerBuilder");
- return mbs;
+ return result;
      }

      /**
@@ -178,18 +162,18 @@
      /**
       * This method is used to set the state whether to create jmx mbs
       * or AppServer mbs. This method is package specific.
- */
      static void enableAppServerMBeanServer(boolean flag) {
          createAppServerMBeanServer = flag;
      }
+ */

      /**
       * whether to create AppServer or just the vanilla jmx ri mbs
       * @return boolean
- */
      static protected boolean createAppServerMBeanServer() {
          return createAppServerMBeanServer;
      }
+ */

      /**
       * jmx ri default builder



RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/
admin/server/core/jmx/AppServerMBeanServerFactory.java,v
retrieving revision 1.6
diff -w -u -r1.6 AppServerMBeanServerFactory.java
--- appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/
AppServerMBeanServerFactory.java 13 Jan 2007 03:27:24 -0000 1.6
+++ appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/
AppServerMBeanServerFactory.java 12 Apr 2007 22:54:57 -0000
@@ -26,51 +26,8 @@
  import javax.management.MBeanServer;
  import java.lang.management.ManagementFactory;

-/**
- * AppServer's MBS factory to create a singleton MBS
- * (with interceptors) necessary for the appserver.
- *
- * @author sridatta
- */
  public class AppServerMBeanServerFactory {
-
- private static MBeanServer _mbs = null;
-
- /**
- * Factory method to generate the only instance of this class in
the JVM.
- * Makes sure that the constructor of this class is called
exactly once.
- *
- * @return MBeanServer instance by calling private constructor.
- * @throws InitException if the MBeanServer can not be initialized.
- */
- public synchronized static MBeanServer getMBeanServerInstance()
- throws InitException {
- if (_mbs == null) {
- _mbs = getAppServerMBeanServer();
- //Also bind in JNDI // TBD FIXME
- // so that it can be used in a generic way
- }
- return ( _mbs );
- }
-
- /**
- * This method gets app server's MBS. First, it
- * enables AppServer MBS on the builder, then creates
- * the MBS using the standard mechanism and then
- * resets the flag. It is synchronized on the builder
- * since we do not want anyone creating an MBS
- * during this period.
- */
- private static MBeanServer getAppServerMBeanServer() {
- MBeanServer ms = null;
- synchronized (AppServerMBeanServerBuilder.class) {
- AppServerMBeanServerBuilder.enableAppServerMBeanServer
(true);
- try {
- ms = ManagementFactory.getPlatformMBeanServer();
- } finally {
-
AppServerMBeanServerBuilder.enableAppServerMBeanServer(false);
- }
- }
- return ms;
+ public static MBeanServer getMBeanServerInstance() {
+ return ManagementFactory.getPlatformMBeanServer();
      }
  }


RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/
admin/server/core/jmx/FlushConfigHook.java,v
retrieving revision 1.1
diff -w -u -r1.1 FlushConfigHook.java
--- appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/
FlushConfigHook.java 12 Jan 2007 04:34:27 -0000 1.1
+++ appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/
FlushConfigHook.java 12 Apr 2007 22:54:57 -0000
@@ -386,6 +386,27 @@
          return result;
      }

+
+
+ public ClassLoader getClassLoader( final ObjectName objectName)
+ throws InstanceNotFoundException
+ {
+ return mDelegateMBeanServer.getClassLoader( objectName );
+ }
+
+
+ public ClassLoader getClassLoaderFor( final ObjectName objectName)
+ throws InstanceNotFoundException
+ {
+ return mDelegateMBeanServer.getClassLoaderFor( objectName );
+ }
+
+ public MBeanInfo getMBeanInfo( final ObjectName objectName)
+ throws InstanceNotFoundException, IntrospectionException,
ReflectionException
+ {
+ return mDelegateMBeanServer.getMBeanInfo( objectName );
+ }
+
  }




RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/
admin/server/core/jmx/SunoneInterceptor.java,v
retrieving revision 1.10
diff -w -u -r1.10 SunoneInterceptor.java
--- appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/
SunoneInterceptor.java 13 Jan 2007 03:27:20 -0000 1.10
+++ appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/
SunoneInterceptor.java 12 Apr 2007 22:54:57 -0000
@@ -32,32 +32,8 @@
  import java.util.logging.Logger;

  //JMX imports
-import javax.management.MBeanServer;
-import javax.management.QueryExp;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-import javax.management.Attribute;
-import javax.management.AttributeList;
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.InvalidAttributeValueException;
-import javax.management.InstanceNotFoundException;
-import javax.management.AttributeNotFoundException;
-import javax.management.ReflectionException;
-import javax.management.MBeanException;
-import javax.management.IntrospectionException;
-import javax.management.ListenerNotFoundException;
-import javax.management.MBeanInfo;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanNotificationInfo;
-import javax.management.MBeanOperationInfo;
-import javax.management.MBeanConstructorInfo;
-import javax.management.MBeanRegistrationException;
-import javax.management.NotificationListener;
-import javax.management.NotificationFilter;
-import javax.management.NotCompliantMBeanException;
-import javax.management.OperationsException;
-import javax.management.MBeanRegistrationException;
-import javax.management.NotCompliantMBeanException;
+import javax.management.*;
+import java.lang.reflect.InvocationTargetException;

  import com.sun.enterprise.admin.meta.MBeanRegistry;
  import com.sun.enterprise.admin.meta.MBeanRegistryFactory;
@@ -87,6 +63,11 @@
  import
com.sun.enterprise.admin.server.core.jmx.storage.MBeanManufacturer;
  import com.sun.enterprise.server.ondemand.entry.*;

+
+import com.sun.enterprise.interceptor.DynamicInterceptorHook;
+import com.sun.appserv.management.helper.AMXDebugHelper;
+
+
  /** A class that is a poor man's interceptor. There are following
reasons that led
   * to use this interceptor and not the standard JMX 1.2 interceptor.
   * <LI> Tight deadlines and smoke test has to work :( </LI>
@@ -112,78 +93,94 @@
   * @since 8.0
  */

-public class SunoneInterceptor implements MBeanServer, EntryPoint {
+public final class SunoneInterceptor
+ implements DynamicInterceptorHook {

- public static final String HOT_CONFIG_METHOD_NAME =
"canApplyConfigChanges";
- public static final String FORCE_APPLY_METHOD_NAME =
"overwriteConfigChanges";
- public static final String APPLY_METHOD_NAME =
"applyConfigChanges";
- public static final String USE_MANUAL_METHOD_NAME =
"useManualConfigChanges";
- public static final String GET_HOST_AND_PORT_METHOD_NAME =
"getHostAndPort";
+ protected final AMXDebugHelper mDebug;

+ // this stuff is probably all DEFUNCT
+ private static final String HOT_CONFIG_METHOD_NAME =
"canApplyConfigChanges";
+ private static final String FORCE_APPLY_METHOD_NAME =
"overwriteConfigChanges";
+ private static final String APPLY_METHOD_NAME =
"applyConfigChanges";
+ private static final String USE_MANUAL_METHOD_NAME =
"useManualConfigChanges";
+ private static final String GET_HOST_AND_PORT_METHOD_NAME =
"getHostAndPort";

      private static final Logger sLogger =
              Logger.getLogger(AdminConstants.kLoggerName);
- private static StringManager localStrings =
+ private static final StringManager localStrings =
                 StringManager.getManager( SunoneInterceptor.class );
- private static AdminContext adminContext;

- private MBeanServer realMBeanServer;
+ private final AdminContext adminContext;

- /**
- The private constructor so that only the factory method is
called.
- Also makes sure that there is single instance of MBeanServer
in the JVM.
+ // MBeanServer to which requests ultimately get delegated
+ private final MBeanServer delegateMBeanServer;

- @param defaultDomainName represents the domain of the
MBeanServer.
- @throws InitException in case the System Mbeans can't be
registered. The
- System MBeans are ServerController and GenericConfigurator.
- */
+ // MBeanServer which wraps 'delegateMBeanServer'
+ private final MBeanServer proxyMBeanServer;

- SunoneInterceptor(String defaultDomainName) throws InitException {
+ // MBeanServer to which MBeans should be registered;
+ // the "real" MBeanServer enclosing this one
+ private final MBeanServer outerMBeanServer;
+
+ private static SunoneInterceptor _Instance = null;
+
+ protected final void
+ debug( final Object... args)
+ {
+ mDebug.println( args );
      }

      /**
- * Added new method. Description tBd
- */
- void setJmxMBeanServer(MBeanServer jmxMBS) throws InitException {
- realMBeanServer = (MBeanServer)ProxyFactory.createProxy(
- MBeanServer.class, jmxMBS,
+ @param adminContextIn the AdminContext
+ @param outerMBeanServer the MBeanServer to be used for
registering MBeans
+ @param delegateMBeanServer the MBeanServer to which requests
are forwarded
+ */
+ private
+ SunoneInterceptor(
+ final AdminContext adminContextIn,
+ final MBeanServer outerMBeanServerIn,
+ final MBeanServer delegateMBeanServerIn ) {
+
+ mDebug = new AMXDebugHelper( "__SunoneInterceptor__" );
+ mDebug.setEchoToStdOut( true );
+ debug( "SunoneInterceptor.SunoneInterceptor" );
+
+
+ adminContext = adminContextIn;
+ delegateMBeanServer = delegateMBeanServerIn;
+
+ outerMBeanServer = outerMBeanServerIn;
+ proxyMBeanServer = (MBeanServer)ProxyFactory.createProxy(
+ MBeanServer.class, delegateMBeanServer,
                      adminContext.getMBeanServerInterceptor());
          logMBeanServerInfo();
+ try {
          initialize();
+ } catch( Exception e ) {
+ throw new RuntimeException(e);
      }
-
- /**
- The private constructor so that only the factory method is
called.
- Also makes sure that there is single instance of MBeanServer
in the JVM.
- The default domain of this MBeanServer will be "ias".
-
- @throws InitException in case the System Mbeans can't be
registered. The
- System MBeans are ServerController and GenericConfigurator.
- */
-
- SunoneInterceptor() throws InitException {
- this(ServiceName.DOMAIN);
      }

- /**
- Factory method to generate the only instance of this class
in the JVM.
- Makes sure that the constructor of this class is called
exactly once.
+ public static synchronized SunoneInterceptor
+ createInstance(
+ final AdminContext adminContext,
+ final MBeanServer outerMBeanServer,
+ final MBeanServer delegateMBeanServer) {
+ if ( _Instance != null ) {
+ throw new IllegalStateException();
+ }
+ _Instance = new SunoneInterceptor(
+ adminContext, outerMBeanServer, delegateMBeanServer );
+ return _Instance;
+ }

- @return MBeanServer instance by calling private constructor.
- @throws InitException if the MBeanServer can not be
initialized.
- @deprecated use
AppServerMBeanServerBuilder.getMBeanServerInstance();
- */

- public static MBeanServer getMBeanServerInstance()
- throws InitException {
- return AppServerMBeanServerFactory.getMBeanServerInstance
();
+ public static synchronized SunoneInterceptor
+ getInstance() {
+ if ( _Instance == null ) {
+ throw new IllegalStateException();
      }
-
- /**
- * Set admin context.
- */
- public static void setAdminContext(AdminContext ctx) {
- adminContext = ctx;
+ return _Instance;
      }

      /**
@@ -193,30 +190,29 @@
          @throws InitException if any of the System MBeans can't be
initialized.
      */

- private void initialize() throws InitException {
- try {
- ObjectName controllerObjectName
+ private void initialize()
+ throws ClassNotFoundException, NoSuchMethodException,
+ InstantiationException, IllegalAccessException,
+ InvocationTargetException,
InstanceAlreadyExistsException,
+ MBeanRegistrationException, NotCompliantMBeanException
+ {
+ final ObjectName controllerObjectName
                      = ObjectNames.getControllerObjectName();
- ObjectName configObjectName
+ final ObjectName configObjectName
                      = ObjectNames.getGenericConfiguratorObjectName();
- ObjectName[] objectNames = {
+ final ObjectName[] objectNames = {
                  controllerObjectName,
- configObjectName
- };
- String controllerClassName =
+ configObjectName };
+ final String controllerClassName =
               
"com.sun.enterprise.admin.server.core.mbean.config.ServerController";
- String configClassName =
+ final String configClassName =
               
"com.sun.enterprise.admin.server.core.mbean.config.GenericConfigurator";
- String[] clNames = {controllerClassName,
configClassName};
+ final String[] clNames = {controllerClassName,
configClassName};
              for (int i = 0 ; i < clNames.length ; i++) {
                  createAndRegister( clNames[i], objectNames[ i ] );
              }
              registerDottedNameSupport();
          }
- catch (Exception e) {
- throw new InitException(e.getMessage(), e.getCause() );
- }
- }

      /**
         <LLC>
@@ -229,21 +225,23 @@

                 private void
         registerDottedNameSupport()
- throws Exception
+ throws ClassNotFoundException, NoSuchMethodException,
+ InstantiationException, IllegalAccessException,
+ InvocationTargetException
         {
                 final Class initerClass =
Class.forName( DottedMBeansIniterClassName );

                 // invoke new DottedNamesMBeanIniter( MBeanServer m )
                 final Class [] signature = new Class
[] { MBeanServer.class };
                 final java.lang.reflect.Constructor
constructor = initerClass.getConstructor( signature );
- constructor.newInstance( new Object [] { this } );
+ constructor.newInstance( new Object []
{ outerMBeanServer } );
                 // done--it will have done its job
         }

         private ObjectInstance createAndRegister( String className,
ObjectName objectName )
- throws Exception
- {
- try
+ throws ClassNotFoundException, IllegalAccessException,
+ InstantiationException, InstanceAlreadyExistsException,
+ MBeanRegistrationException, NotCompliantMBeanException
                 {
                         final Class
mbeanClass = Class.forName( className );
                         final Object
mbeanImpl = mbeanClass.newInstance();
@@ -252,23 +250,20 @@
                         sLogger.log(Level.FINE,
"core.system_mbean_init_ok", objectName.toString() );
                         return( mbeanInstance );
                 }
- catch( Exception e )
- {
- e.printStackTrace();
- throw e;
- }
- }

      /* </LLC> */

- public ObjectInstance registerMBean(Object object, ObjectName
objectName)
+ private ObjectInstance registerMBean(Object object, ObjectName
objectName)
          throws InstanceAlreadyExistsException,
                  MBeanRegistrationException,
                  NotCompliantMBeanException {
- return (realMBeanServer.registerMBean(object, objectName));
+ // !!! registration must be done with 'outerMBeanServer';
+ // we are not delegating here and so the "outside world"
must see
+ // the registration
+ return outerMBeanServer.registerMBean(object, objectName);
      }

- public void generateEntryContext(Object obj) {
+ private void generateEntryContext(Object obj) {
          ServerEntryHelper.generateMbeanEntryContext((ObjectName) obj);
      }

@@ -276,7 +271,6 @@
      public Object invoke(ObjectName objectName, String operationName,
          Object[] params, String[] signature)
          throws ReflectionException, InstanceNotFoundException,
MBeanException {
-
          generateEntryContext(objectName);

          if(isInstanceMBean(objectName) && isConfigCheckRequired
(operationName)) {
@@ -294,7 +288,7 @@
           }
          registerWithPersistenceCheck(objectName);
          //logMBeanInfo(objectName);
- Object actualResult = realMBeanServer.invoke(objectName,
operationName,
+ Object actualResult = proxyMBeanServer.invoke(objectName,
operationName,
              params, signature );
          return ( actualResult );
      }
@@ -307,7 +301,7 @@
          }
          registerWithPersistenceCheck(objectName);
          //logMBeanInfo(objectName);
- Object value = realMBeanServer.getAttribute(objectName,
attributeName);
+ Object value = proxyMBeanServer.getAttribute(objectName,
attributeName);
          return ( value );
      }

@@ -319,7 +313,7 @@
          }
          registerWithPersistenceCheck(objectName);
          //logMBeanInfo(objectName);
- realMBeanServer.setAttribute(objectName, attribute);
+ proxyMBeanServer.setAttribute(objectName, attribute);
      }

      public AttributeList getAttributes(ObjectName objectName,
String[] attrNames)
@@ -330,7 +324,7 @@
          }

          registerWithPersistenceCheck(objectName);
- return ( realMBeanServer.getAttributes(objectName,
attrNames) );
+ return ( proxyMBeanServer.getAttributes(objectName,
attrNames) );
      }

      public AttributeList setAttributes (ObjectName objectName,
AttributeList attributeList)
@@ -340,167 +334,150 @@
          }

          registerWithPersistenceCheck(objectName);
- return ( realMBeanServer.setAttributes(objectName,
attributeList) );
+ return ( proxyMBeanServer.setAttributes(objectName,
attributeList) );
      }

-
- public void unregisterMBean(ObjectName objectName)
+ /*
+ private void unregisterMBean(ObjectName objectName)
          throws InstanceNotFoundException, MBeanRegistrationException {
- realMBeanServer.unregisterMBean(objectName);
+ proxyMBeanServer.unregisterMBean(objectName);
      }

- public Integer getMBeanCount() {
- return ( realMBeanServer.getMBeanCount() );
+ private Integer getMBeanCount() {
+ return ( proxyMBeanServer.getMBeanCount() );
      }

- public Set queryMBeans(ObjectName name, QueryExp exp) {
+ private Set queryMBeans(ObjectName name, QueryExp exp) {
          registerConfigMBeans();
- return ( realMBeanServer.queryMBeans(name, exp) );
+ return ( proxyMBeanServer.queryMBeans(name, exp) );
      }

- public MBeanInfo getMBeanInfo(ObjectName objName) throws
- InstanceNotFoundException, IntrospectionException,
ReflectionException {
- registerWithPersistenceCheck(objName);
- return ( realMBeanServer.getMBeanInfo(objName) );
+ private boolean isRegistered(ObjectName name) {
+ return proxyMBeanServer.isRegistered(name);
      }

- public boolean isRegistered(ObjectName name) {
- /*
- // This is the actual way to do it
- // since there is a bug in initializing mbeans
- // commenting this for now in the assumption that
- // that the bug will be fixed soon.
-
- boolean isRegistered = realMBeanServer.isRegistered(name);
- if(!isRegistered) {
- try {
- registerWithPersistenceCheck(name);
- isRegistered = true;
- } catch(Exception e) {
- //ignore
- }
- }
- return isRegistered;
- */
- return realMBeanServer.isRegistered(name);
- }
-
- public void addNotificationListener(ObjectName objectName,
+ private void addNotificationListener(ObjectName objectName,
          NotificationListener notificationListener,
          NotificationFilter notificationFilter, Object obj)
          throws InstanceNotFoundException {
- realMBeanServer.addNotificationListener(objectName,
+ proxyMBeanServer.addNotificationListener(objectName,
              notificationListener, notificationFilter, obj);
      }

- public void addNotificationListener (ObjectName objectName,
+ private void addNotificationListener (ObjectName objectName,
          ObjectName objectName1, NotificationFilter notificationFilter,
          Object obj) throws InstanceNotFoundException {
- realMBeanServer.addNotificationListener(objectName,
objectName1,
+ proxyMBeanServer.addNotificationListener(objectName,
objectName1,
          notificationFilter, obj);
      }

- public ObjectInstance createMBean (String str, ObjectName
objectName)
+ private ObjectInstance createMBean (String str, ObjectName
objectName)
          throws ReflectionException, InstanceAlreadyExistsException,
          MBeanRegistrationException, MBeanException,
          NotCompliantMBeanException {
- return realMBeanServer.createMBean (str, objectName);
+ return proxyMBeanServer.createMBean (str, objectName);
      }

- public ObjectInstance createMBean (String str, ObjectName
objectName,
+ private ObjectInstance createMBean (String str, ObjectName
objectName,
          ObjectName objectName2) throws ReflectionException,
          InstanceAlreadyExistsException, MBeanRegistrationException,
          MBeanException, NotCompliantMBeanException,
InstanceNotFoundException {
- return ( realMBeanServer.createMBean (str, objectName,
objectName2) );
+ return ( proxyMBeanServer.createMBean (str, objectName,
objectName2) );
      }

- public ObjectInstance createMBean (String str, ObjectName
objectName,
+ private ObjectInstance createMBean (String str, ObjectName
objectName,
          Object[] obj, String[] str3)
          throws ReflectionException, InstanceAlreadyExistsException,
          MBeanRegistrationException, MBeanException,
NotCompliantMBeanException {
- return realMBeanServer.createMBean (str, objectName, obj,
str3);
+ return proxyMBeanServer.createMBean (str, objectName, obj,
str3);
      }

- public ObjectInstance createMBean (String str, ObjectName
objectName,
+ private ObjectInstance createMBean (String str, ObjectName
objectName,
          ObjectName objectName2, Object[] obj, String[] str4)
          throws ReflectionException, InstanceAlreadyExistsException,
          MBeanRegistrationException, MBeanException,
          NotCompliantMBeanException, InstanceNotFoundException {
- return realMBeanServer.createMBean (str, objectName,
+ return proxyMBeanServer.createMBean (str, objectName,
              objectName2, obj, str4);
      }

- /* deprecated API @since 1.1 - use with caution */
- public ObjectInputStream deserialize (String str, byte[] values)
+ private ObjectInputStream deserialize (String str, byte[] values)
          throws OperationsException, ReflectionException {
- return realMBeanServer.deserialize (str, values);
+ return proxyMBeanServer.deserialize (str, values);
      }

- /* deprecated API @since 1.1 - use with caution */
- public ObjectInputStream deserialize (ObjectName objectName, byte
[] values)
+ private ObjectInputStream deserialize (ObjectName objectName,
byte[] values)
          throws InstanceNotFoundException, OperationsException {
- return realMBeanServer.deserialize (objectName, values);
+ return proxyMBeanServer.deserialize (objectName, values);
      }

- public ObjectInputStream deserialize (String str, ObjectName
objectName,
+ private ObjectInputStream deserialize (String str, ObjectName
objectName,
          byte[] values) throws InstanceNotFoundException,
OperationsException,
          ReflectionException {
- return realMBeanServer.deserialize (str, objectName, values);
+ return proxyMBeanServer.deserialize (str, objectName, values);
      }

- public String getDefaultDomain() {
- return realMBeanServer.getDefaultDomain();
+ private String getDefaultDomain() {
+ return proxyMBeanServer.getDefaultDomain();
      }

- public ObjectInstance getObjectInstance(ObjectName objectName)
+ private ObjectInstance getObjectInstance(ObjectName objectName)
          throws InstanceNotFoundException {
- return realMBeanServer.getObjectInstance(objectName);
+ return proxyMBeanServer.getObjectInstance(objectName);
      }

- public Object instantiate(String str) throws ReflectionException,
+ private Object instantiate(String str) throws ReflectionException,
          MBeanException {
- return realMBeanServer.instantiate(str);
+ return proxyMBeanServer.instantiate(str);
      }

- public Object instantiate(String str, ObjectName objectName)
+ private Object instantiate(String str, ObjectName objectName)
      throws ReflectionException, MBeanException,
InstanceNotFoundException {
- return realMBeanServer.instantiate(str, objectName);
+ return proxyMBeanServer.instantiate(str, objectName);
      }

- public Object instantiate(String str, Object[] obj, String[] str2)
+ private Object instantiate(String str, Object[] obj, String[] str2)
      throws ReflectionException, MBeanException {
- return realMBeanServer.instantiate(str, obj, str2);
+ return proxyMBeanServer.instantiate(str, obj, str2);
      }

- public Object instantiate(String str, ObjectName objectName,
+ private Object instantiate(String str, ObjectName objectName,
      Object[] obj, String[] str3)
      throws ReflectionException, MBeanException,
InstanceNotFoundException {
- return realMBeanServer.instantiate(str, objectName, obj, str3);
+ return proxyMBeanServer.instantiate(str, objectName, obj,
str3);
      }

- public boolean isInstanceOf (ObjectName objectName, String str)
+ private boolean isInstanceOf (ObjectName objectName, String str)
      throws InstanceNotFoundException {
- return realMBeanServer.isInstanceOf(objectName, str);
+ return proxyMBeanServer.isInstanceOf(objectName, str);
      }

- public Set queryNames (ObjectName objectName, QueryExp queryExp) {
+ private Set queryNames (ObjectName objectName, QueryExp queryExp) {
          registerConfigMBeans();
- return realMBeanServer.queryNames(objectName, queryExp);
+ return proxyMBeanServer.queryNames(objectName, queryExp);
      }

- public void removeNotificationListener (ObjectName objectName,
+ private void removeNotificationListener (ObjectName objectName,
              ObjectName objectName1)
              throws InstanceNotFoundException,
ListenerNotFoundException {
- realMBeanServer.removeNotificationListener (objectName,
+ proxyMBeanServer.removeNotificationListener (objectName,
                  objectName1);
      }

- public void removeNotificationListener (ObjectName objectName,
+ private void removeNotificationListener (ObjectName objectName,
              NotificationListener notificationListener)
              throws InstanceNotFoundException,
ListenerNotFoundException {
- realMBeanServer.removeNotificationListener (objectName,
+ proxyMBeanServer.removeNotificationListener (objectName,
                  notificationListener);
      }
+ */
+
+ public MBeanInfo getMBeanInfo(ObjectName objName) throws
+ InstanceNotFoundException, IntrospectionException,
ReflectionException {
+ registerWithPersistenceCheck(objName);
+ return ( proxyMBeanServer.getMBeanInfo(objName) );
+ }
+

      // START BACKUP_HOT ISSUE FIX APIs

@@ -513,7 +490,7 @@
              ObjectName instanceObjectName =
ObjectNames.getServerInstanceObjectName(instanceName);
              Object canApply = this.invoke(instanceObjectName,
HOT_CONFIG_METHOD_NAME,
                  null, null);
- //System.out.println("return value" + canApply);
+ //debug("return value" + canApply);
              if (canApply.equals(Boolean.FALSE)) {
                                 String msg = localStrings.getString(
                          
"admin.server.core.jmx.configuration_changed_apply_changes",
@@ -538,20 +515,20 @@
      }

      private boolean isConfigCheckRequired(String operationName) {
- //System.out.println("Entering isConfigCheckRequired:" +
operationName);
+ //debug("Entering isConfigCheckRequired:" + operationName);

          if(GET_HOST_AND_PORT_METHOD_NAME.equals(operationName)) {
- //System.out.println("getHostAndPort: returning FALSE");
+ //debug("getHostAndPort: returning FALSE");
              return false;
          }

          if(FORCE_APPLY_METHOD_NAME.equals(operationName)) {
- //System.out.println("overwriteConfigChanges:
returning FALSE");
+ //debug("overwriteConfigChanges: returning FALSE");
                  return false;
          }

          if(USE_MANUAL_METHOD_NAME.equals(operationName)) {
- //System.out.println("useManualConfigChanges: returning
FALSE");
+ //debug("useManualConfigChanges: returning FALSE");
              return false;
          }

@@ -566,59 +543,55 @@
          }
          //END: Optimization to prevent multiple checks for changes

- //System.out.println("RETURNING true");
+ //debug("RETURNING true");
          return true;
      }


- /**
- * There are many cases where we need to perform lazy
instantiation before
- * accessing the real mbean server. Currently only
getClassLoader and getClassLoaderFor
- * do this now, but FIXTHIS eventually all code that accesses
and object name, throws
- * an instanceNotFound exception and accesses the
realMBeanServer should do so using
- *this convenience method to ensure that lazy instantiation
happens properly.
- */
- private MBeanServer getRealMBeanServerAndInstantiate(ObjectName
objectName) throws InstanceNotFoundException
- {
- registerWithPersistenceCheck(objectName);
- return realMBeanServer;
- }
-
- public ClassLoader getClassLoader(ObjectName objectName)
+ public ClassLoader
+ getClassLoader(final ObjectName objectName)
          throws InstanceNotFoundException {
- return ( getRealMBeanServerAndInstantiate
(objectName).getClassLoader(objectName) );
+ debug( "SunoneInterceptor: getClassLoader: " + objectName );
+ registerWithPersistenceCheck(objectName);
+ return proxyMBeanServer.getClassLoader( objectName );
      }

- public ClassLoader getClassLoaderFor(ObjectName objectName)
+ public ClassLoader
+ getClassLoaderFor(final ObjectName objectName)
          throws InstanceNotFoundException {
- return ( getRealMBeanServerAndInstantiate
(objectName).getClassLoaderFor(objectName) );
-
+ debug( "SunoneInterceptor: getClassLoaderFor: " + objectName );
+ registerWithPersistenceCheck(objectName);
+ return proxyMBeanServer.getClassLoaderFor( objectName );
      }

- public ClassLoaderRepository getClassLoaderRepository() {
- return ( realMBeanServer.getClassLoaderRepository() );
+ private ClassLoaderRepository
+ getClassLoaderRepository() {
+ debug( "SunoneInterceptor: getClassLoaderRepository()" );
+ return ( proxyMBeanServer.getClassLoaderRepository() );
      }

- public String[] getDomains() {
- return ( realMBeanServer.getDomains() );
+ /*
+ private String[] getDomains() {
+ return ( proxyMBeanServer.getDomains() );
      }

- public void removeNotificationListener(ObjectName objectName,
+ private void removeNotificationListener(ObjectName objectName,
          NotificationListener notificationListener, NotificationFilter
          notificationFilter, Object obj) throws
InstanceNotFoundException,
          ListenerNotFoundException {
- realMBeanServer.
+ proxyMBeanServer.
                  removeNotificationListener(objectName,
notificationListener,
                  notificationFilter, obj);
      }

- public void removeNotificationListener(ObjectName objectName,
+ private void removeNotificationListener(ObjectName objectName,
          ObjectName objectName1, NotificationFilter notificationFilter,
          Object obj)
          throws InstanceNotFoundException, ListenerNotFoundException {
- realMBeanServer.removeNotificationListener(objectName,
objectName1,
+ proxyMBeanServer.removeNotificationListener(objectName,
objectName1,
                  notificationFilter, obj);
      }
+ */

      /** Logs the MBeanServer information. It is logged to the
server's output/error
       * log, to convey the information about MBeanServer
implementation used.
@@ -633,22 +606,22 @@
              sLogger.log(Level.FINE, "core.mbs_info");
              //log the implementation name
              String attrName = "ImplementationName";
- String result = (String) realMBeanServer.
+ String result = (String) proxyMBeanServer.
                      getAttribute(oName, attrName);
              sLogger.log(Level.FINE, "core.mbs_implementation",
result);
              //log the implementation vendor
              attrName = "ImplementationVendor";
- result = (String) realMBeanServer.getAttribute
(oName, attrName);
+ result = (String) proxyMBeanServer.getAttribute
(oName, attrName);
              sLogger.log(Level.FINE, "core.mbs_vendor", result);
              //log the impl version
              attrName = "ImplementationVersion";
- result = (String) realMBeanServer.getAttribute(oName,
attrName);
+ result = (String) proxyMBeanServer.getAttribute(oName,
attrName);
              sLogger.log(Level.FINE, "core.jmx_impl_version", result);
              //log the MBeanServerId
              attrName = "MBeanServerId";
- result = (String) realMBeanServer.getAttribute(oName,
attrName);
+ result = (String) proxyMBeanServer.getAttribute(oName,
attrName);
              sLogger.log(Level.FINE, "core.mbs_id", result);
- result = realMBeanServer.getClass().getName();
+ result = proxyMBeanServer.getClass().getName();
              sLogger.log(Level.FINE, "core_mbs_classname", result);
          }
          catch(Exception e) {
@@ -661,21 +634,25 @@
      synchronized private void manufactureAndRegisterMBean
(ObjectName oName) throws Exception
      {
          //the "second" check inside synchronized area (it will
perevent double manufacturing)
- if (realMBeanServer.isRegistered(oName) ) {
+ if ( outerMBeanServer.isRegistered(oName) ) {
              //sLogger.log(Level.FINE, "core.mbean_exists", oName);
+ debug( "manufactureAndRegisterMBean: already registered:
" + oName );
              return; //already registered
          }
          //call to lazy loading here
          final Object product = manufactureMBean(oName);
          if(product==null)
          {
- String msg = localStrings.getString(
+ debug( "manufactureAndRegisterMBean: can't manufacture:
" + oName );
+ final String msg = localStrings.getString(
                         "admin.server.core.jmx.lazybean_not_found",
                         oName.toString());
                  throw new InstanceNotFoundException(msg);
          }
          //register MBean.
+ debug( "manufactureAndRegisterMBean: registering: " + oName );
          this.registerMBean(product, oName);
+ debug( "manufactureAndRegisterMBean: registered: " + oName );
          sLogger.log(Level.FINE, "core.create_and_register", oName);
      }

@@ -688,32 +665,35 @@
       * @exception IllegalArgumentException if oName is a pattern.
       * @exception RuntimeException with actual exception embedded
in case operation fails.
      */
- private void registerWithPersistenceCheck(ObjectName oName)
throws InstanceNotFoundException
+ private void registerWithPersistenceCheck(final ObjectName oName)
+ throws InstanceNotFoundException
      {
          if ( "ias".equals( oName.getDomain() ) ) {
              throw new RuntimeException( "JMX domain 'ias' not
suppported" );
          }

- if (! realMBeanServer.isRegistered(oName) ) {
+ if (! outerMBeanServer.isRegistered(oName) ) {
+ debug( "MBean NOT registered, will try to manufacture: " + oName );
              try {
                  //Manufacture the MBean now.
                  manufactureAndRegisterMBean(oName);
+ debug( "Manufactured: " + oName );
              }
              catch (InstanceNotFoundException infe)
              {
+ debug( "FAILED to manufacture: " + oName + " | " + infe );
                  throw infe;
              }
              catch (RuntimeException re)
              {
+ debug( "FAILED to manufacture: " + oName + " | " + re );
                  throw re;
              }
              catch (Exception e) {
+ debug( "FAILED to manufacture: " + oName + " | " + e );
                  throw new RuntimeException(e);
              }
          }
- //else {
- //sLogger.log(Level.FINE, "core.mbean_exists", oName);
- //}
      }

      private Object manufactureMBean(ObjectName oName) throws
InstanceNotFoundException
@@ -735,8 +715,8 @@
          return ( match );
      }

- public void shutdown() {
- MBeanServerFactory.releaseMBeanServer(realMBeanServer);
+ private void shutdown() {
+ MBeanServerFactory.releaseMBeanServer(proxyMBeanServer);
          sLogger.log(Level.FINE, "core.release_mbs");
      }

@@ -751,7 +731,7 @@
          //This method assumes that the mbean is registered.
         MBeanInfo info = null;
         try {
- info = realMBeanServer.getMBeanInfo(oName);
+ info = proxyMBeanServer.getMBeanInfo(oName);
         } catch (Exception e) {
             e.printStackTrace();
             return;
@@ -800,7 +780,7 @@

      private static boolean _alreadyCalled = false;

- private synchronized void registerConfigMBeans() {
+ public synchronized void registerConfigMBeans() {
          if(! _alreadyCalled ) {
              _alreadyCalled = true;
              try {




RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/
server/PEMain.java,v
retrieving revision 1.16
diff -w -u -r1.16 PEMain.java
--- appserv-core/src/java/com/sun/enterprise/server/PEMain.java 28
Feb 2007 01:01:40 -0000 1.16
+++ appserv-core/src/java/com/sun/enterprise/server/PEMain.java 12
Apr 2007 22:54:58 -0000
@@ -23,6 +23,9 @@

  package com.sun.enterprise.server;

+import java.lang.management.ManagementFactory;
+import javax.management.MBeanServer;
+
  import java.io.IOException;
  import java.io.File;
  import java.io.PrintStream;
@@ -83,6 +86,7 @@

  import com.sun.enterprise.util.FeatureAvailability;
  import static
com.sun.enterprise.util.FeatureAvailability.SERVER_STARTED_FEATURE;
+import static
com.sun.enterprise.util.FeatureAvailability.MBEAN_SERVER_FEATURE;

  /**
    * Start up class for PE/RI
@@ -92,8 +96,6 @@
      private static final long START_TIME_MILLIS =
System.currentTimeMillis();
      public static long getStartTimeMillis() { return
START_TIME_MILLIS; }

-
-
      static {
          // Note: This call must happen before any calls on the logger.
          ErrorStatistics.registerStartupTime();
@@ -125,12 +127,28 @@
          protected void doRun() {
              final Thread thisThread = Thread.currentThread();
              thisThread.setPriority( thisThread.MIN_PRIORITY );
-
              callAMXPreload();
          }
      };

      /**
+ Load the MBeanServer.
+ */
+ private static final class LoadMBeanServer extends RunnableBase {
+ LoadMBeanServer() {
+ super( "PEMain-LoadMBeanServer" );
+ }
+ protected void doRun() {
+ final MBeanServer mbeanServer =
ManagementFactory.getPlatformMBeanServer();
+ FeatureAvailability.getInstance().registerFeature(
+ MBEAN_SERVER_FEATURE, mbeanServer);
+ //System.out.println( "class of platform MBeanServer is " +
+ //mbeanServer.getClass().getName() );
+ }
+ };
+
+
+ /**
       * This object will be created during the Init phase of NSAPI
       */
      public PEMain() {
@@ -143,15 +161,15 @@

      // -----------------------------------------------------
Instance Variables

- public static boolean shutdownStarted = false;
+ public static volatile boolean shutdownStarted = false;

- public static boolean shutdownThreadInvoked = false;
+ public static volatile boolean shutdownThreadInvoked = false;

- private static ApplicationServer _server = null;
+ private static volatile ApplicationServer _server = null;

      private final static String STOP = "stop";

- private static PEMain _instance = null;
+ private static volatile PEMain _instance = null;

      private final static String SERVER_INSTANCE =
                          System.getProperty
("com.sun.aas.instanceName");
@@ -196,6 +214,8 @@

      public static void main(String[] args) {
          new AtStartup().submit( HowToRun.RUN_IN_SEPARATE_THREAD );
+ new LoadMBeanServer().submit
( HowToRun.RUN_IN_SEPARATE_THREAD );
+

         // parse args
         boolean verbose = false;
@@ -336,7 +356,7 @@
         return _server;
      }

- public synchronized static PEMain getInstance() {
+ public static PEMain getInstance() {
          return _instance;
      }

@@ -385,9 +405,9 @@
              //When uncommented, this code can be called to load all
config MBeans so that
              //lazy loading is effectively disabled.
              try {
- SunoneInterceptor.getMBeanServerInstance().queryNames
(null, null);
+ FeatureAvailability.getInstance().getMBeanServer
().queryNames(null, null);
              } catch (Exception ex) {
-
+ // ignore
              }
              FeatureAvailability.getInstance().registerFeature
( SERVER_STARTED_FEATURE, "" );
          }



RCS file: /cvs/glassfish/appserv-core-ee/appserv-core/src/java/com/
sun/enterprise/ee/diagnostics/collect/HadbInfoCollector.java,v
retrieving revision 1.3
diff -w -u -r1.3 HadbInfoCollector.java
--- appserv-core-ee/appserv-core/src/java/com/sun/enterprise/ee/
diagnostics/collect/HadbInfoCollector.java 13 Jan 2007 03:30:53
-0000 1.3
+++ appserv-core-ee/appserv-core/src/java/com/sun/enterprise/ee/
diagnostics/collect/HadbInfoCollector.java 12 Apr 2007 22:54:58
-0000
@@ -158,8 +158,8 @@

          final Object[] params =
{null,null,adminPassword,null,databaseName};
          final String[] types = new String[]
{STRING,STRING,STRING,STRING,STRING};
+ final MBeanServer mbs =
AppServerMBeanServerFactory.getMBeanServerInstance();
          try{
- MBeanServer mbs =
AppServerMBeanServerFactory.getMBeanServerInstance();
              // we always invoke with an array, and so the
              // result is always an Object []
              final Object[] returnValues = (Object[]) mbs.invoke(new
ObjectName(OBJECT_NAME),
@@ -180,9 +180,6 @@

              data = new FileData(file.getName(),DataType.HADB_INFO);
         }
- catch(InitException ie){
- logger.log(Level.WARNING, ie.getMessage(),
ie.fillInStackTrace());
- }
          catch(Exception e){
              logger.log(Level.WARNING, e.getMessage(),
e.fillInStackTrace());
          }