admin@glassfish.java.net

CODE REVIEW: changes to MBeanServer loading sequence / removal of SunoneInterceptor

From: Lloyd L Chambers <Lloyd.Chambers_at_Sun.COM>
Date: Fri, 05 Jan 2007 12:37:12 -0800

Please review by COB today if possible. Call with questions: 650
483-8010.

For a thorough background discussion of why these changes are useful,
please see:
http://www.glassfishwiki.org/gfwiki/attach/GlassFishAdminReferences/
SunoneInterceptorChanges.html

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

Notes:
1. SunoneInterceptor is being replaced by
com.sun.enterprise.interceptor.InterceptorMBeanServerBuilder. It
allows deferring certain things until later in the startup process,
which in turn allows the MBeanServer to be initialized immediately
upon startup.

2. Many xml files have a <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.ee.admin.AppServerM
BeanServerBuilder</jvm-options>; this has been changed to use
com.sun.enterprise.interceptor.InterceptorMBeanServerBuilder instead;
see (1) above.

Diffs follow. Summary of files below:

NEW FILES

appserv-api/src/java/com/sun/appserv/management/util/misc/
RunnableBase.java
appserv-api/src/java/com/sun/appserv/management/util/misc/Timings.java
appserv-core/src/java/com/sun/enterprise/admin/server/core/
ComSunAppservConfigMBeansIniter.java

REMOVED FILES

appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/
AppServerMBeanServerBuilder.java
appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/
AppServerMBeanServerFactory.java
appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/
SunoneInterceptor.java
appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/
PersistenceChecker.java

CHANGED FILES

appserv-api/src/java/com/sun/appserv/management/base/SystemInfo.java
appserv-api/src/java/com/sun/appserv/management/util/misc/
StringUtil.java

appserv-commons/src/java/com/sun/enterprise/util/
FeatureAvailability.java

appserv-core/src/java/com/sun/enterprise/admin/common/
MBeanServerFactory.java
appserv-core/src/java/com/sun/enterprise/admin/common/ObjectNames.java
appserv-core/src/java/com/sun/enterprise/admin/server/core/
AdminService.java
appserv-core/src/java/com/sun/enterprise/admin/server/core/
ConfigInterceptor.java
appserv-core/src/java/com/sun/enterprise/diagnostics/collect/
MonitoringInfoCollector.java
appserv-core/src/java/com/sun/enterprise/diagnostics/collect/
MonitoringInfoHelper.java
appserv-core/src/java/com/sun/enterprise/server/PELaunch.java
appserv-core/src/java/com/sun/enterprise/server/PEMain.java
appserv-core/src/java/com/sun/enterprise/server/SystemAppLifecycle.java
appserv-core/src/java/com/sun/enterprise/ee/diagnostics/collect/
HadbInfoCollector.java
appserv-core-ee/cms/src/java/com/sun/enterprise/ee/cms/lifecycle/
GMSLifecycleImpl.java
appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/
DomainRepository.java

admin-ee/nodeagent/src/java/com/sun/enterprise/ee/nodeagent/
NodeAgentMain.java

CHANGED (non-code)

admin/templates/pe80/default-domain.xml.template
admin/templates/pe80/default-domain.xml.template.darwin
admin/templates/pe80/cluster/domain.xml.xsl.1
admin/templates/pe80/enterprise/domain.xml.xsl.1
admin/validator/tests/com/sun/enterprise/config/serverbeans/
validation/domain.flatten.xml
admin/validator/tests/com/sun/enterprise/config/serverbeans/
validation/flatten.xml
admin/ws-mgmt/tests/com/sun/enterprise/admin/wsmgmt/registry/
connectionpool-domain.xml
admin-ee/templates/ee80/changePEDomain2SEDomain.xml

admin/validator/tests/com/sun/enterprise/config/serverbeans/
validation/domain.flatten.xml
admin-ee/templates/ee80/default-domain.xml.template



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

MB2:/gf/build/glassfish lloyd$ cvs diff -w -u


cvs server: Diffing admin/mbeanapi-impl/src/java/com/sun/enterprise/
management/support
Index: admin/mbeanapi-impl/src/java/com/sun/enterprise/management/
support/Loader.java
===================================================================
RCS file: /cvs/glassfish/admin/mbeanapi-impl/src/java/com/sun/
enterprise/management/support/Loader.java,v
retrieving revision 1.16
diff -w -u -r1.16 Loader.java
--- admin/mbeanapi-impl/src/java/com/sun/enterprise/management/
support/Loader.java 19 Dec 2006 16:26:11 -0000 1.16
+++ admin/mbeanapi-impl/src/java/com/sun/enterprise/management/
support/Loader.java 5 Jan 2007 20:19:38 -0000
@@ -70,6 +70,8 @@
  import com.sun.enterprise.management.support.TypeInfos;
  import com.sun.enterprise.management.DomainRootImpl;

+import com.sun.enterprise.util.FeatureAvailability;
+
  import com.sun.enterprise.admin.common.ObjectNames;

  /**
@@ -113,6 +115,19 @@
                 mRegThread.start();
         }

+ protected void
+ postRegisterHook()
+ {
+ FeatureAvailability.getInstance().registerFeature(
+ FeatureAvailability.AMX_LOADER_FEATURE, getObjectName() );
+ }
+
+ /**
+ WORKAROUND_FOR_BUG_SRIDATTA_FOUND (force synchronous handling)
+ (not an AMX bug, rather an internal bug in server startup
sequence).
+ */
+ private static final boolean
SYNCHRONOUS_NOTIFICATION_HANDLING = true;
+
                 public void
         handleNotification(
                 final Notification notifIn,
@@ -397,23 +412,6 @@
                 return( resultName );
         }

- protected ObjectName
- loadSystemInfo( final MBeanServer server )
- throws NotCompliantMBeanException,
MBeanRegistrationException,
- InstanceAlreadyExistsException
- {
- final BootUtil bootUtil = BootUtil.getInstance
();
-
- final SystemInfoImpl systemInfo = new
SystemInfoImpl( server, bootUtil );
-
- final ObjectName tempName =
mObjectNames.getSingletonObjectName( systemInfo.J2EE_TYPE );
-
- final ObjectName objectName =
mServer.registerMBean( systemInfo, tempName ).getObjectName();
-
- debug( "loaded SystemInfo" );
- return( objectName );
- }
-
                 private void
         addLoaders()
         {
Index: admin/mbeanapi-impl/src/java/com/sun/enterprise/management/
support/LoaderBase.java
===================================================================
RCS file: /cvs/glassfish/admin/mbeanapi-impl/src/java/com/sun/
enterprise/management/support/LoaderBase.java,v
retrieving revision 1.4
diff -w -u -r1.4 LoaderBase.java
--- admin/mbeanapi-impl/src/java/com/sun/enterprise/management/
support/LoaderBase.java 19 Dec 2006 16:26:11 -0000 1.4
+++ admin/mbeanapi-impl/src/java/com/sun/enterprise/management/
support/LoaderBase.java 5 Jan 2007 20:19:38 -0000
@@ -67,6 +67,8 @@

  import com.sun.enterprise.management.support.TypeInfos;

+import com.sun.enterprise.util.FeatureAvailability;
+
  /**

   */
@@ -84,6 +86,8 @@
             final boolean offline = false;
                 BootUtil.init( false );

+ FeatureAvailability.getInstance().registerFeature
( FeatureAvailability.AMX_BOOT_UTIL_FEATURE, this );
+
                 mServer = null;

                 new StringifierRegistryIniterImpl
( StringifierRegistryImpl.DEFAULT );
@@ -133,7 +137,7 @@
                 return( System.currentTimeMillis() );
         }

- protected ObjectName
+ protected final ObjectName
         loadSystemInfo( final MBeanServer server )
                 throws NotCompliantMBeanException,
MBeanRegistrationException,
                 InstanceAlreadyExistsException
@@ -148,7 +152,12 @@

                 final ObjectName objectName =
mServer.registerMBean( systemInfo, tempName ).getObjectName();

- debug( "loaded SystemInfo" );
+ FeatureAvailability.getInstance().registerFeature
( FeatureAvailability.SYSTEM_INFO_FEATURE, objectName );
+
+ debug( "loaded SystemInfo as " + objectName );
+ FeatureAvailability.getInstance().waitForFeature
( FeatureAvailability.SYSTEM_INFO_FEATURE, "loadSystemInfo");
+ debug( "waited for SystemInfo OK" );
+
                 return( objectName );
         }

@@ -163,7 +172,7 @@
                 final ObjectName objectNameIn)
                 throws Exception
         {
- debug( "preRegister" );
+ debug( "preRegister: " + objectNameIn);
                 final ObjectName superObjectName =
super.preRegister( server, objectNameIn );

                 mObjectNames = ObjectNames.getInstance
( getAMXJMXDomainName() );
@@ -177,16 +186,13 @@
                 {
                         loadSystemInfo( server );

- final MBeanServerNotificationFilter
filter =
- new MBeanServerNotificationFilter();
-
+ final MBeanServerNotificationFilter
filter = new MBeanServerNotificationFilter();
              filter.enableAllObjectNames();
-
                         JMXUtil.listenToMBeanServerDelegate
( mServer, this, filter, null );
-
                 }
                 catch( Exception e )
                 {
+ debug( e );
                         throw new RuntimeException( e );
                 }

Index: admin/mbeanapi-impl/src/java/com/sun/enterprise/management/
support/SystemInfoImpl.java
===================================================================
RCS file: /cvs/glassfish/admin/mbeanapi-impl/src/java/com/sun/
enterprise/management/support/SystemInfoImpl.java,v
retrieving revision 1.5
diff -w -u -r1.5 SystemInfoImpl.java
--- admin/mbeanapi-impl/src/java/com/sun/enterprise/management/
support/SystemInfoImpl.java 19 Dec 2006 17:14:14 -0000 1.5
+++ admin/mbeanapi-impl/src/java/com/sun/enterprise/management/
support/SystemInfoImpl.java 5 Jan 2007 20:19:38 -0000
@@ -204,6 +204,26 @@
                 return( result.booleanValue() );
         }

+
+ /**
+ Return a Map keyed by an arbitrary String denoting some
feature. The value
+ is the time in milliseconds. Code should not rely on the
keys as they are subject to
+ changes, additions, or removal at any time, except as
otherwise documented.
+ Even documented items should be used only for informational
purposes,
+ such as assessing performance.
+
+ @return Map<String,Long>
+ */
+ public Map<String,Long>
+ getPerformanceMillis()
+ {
+ // ensure that we return a copy which is a HashMap, not some
other variant of Map
+ final HashMap<String,Long> result = new HashMap<String,Long>
();
+
+ result.putAll( SystemInfoData.getInstance
().getPerformanceMillis() );
+
+ return result;
+ }
  }


Index: admin/mbeanapi-impl/src/java/com/sun/enterprise/management/
support/TypeInfos.java
===================================================================
RCS file: /cvs/glassfish/admin/mbeanapi-impl/src/java/com/sun/
enterprise/management/support/TypeInfos.java,v
retrieving revision 1.18
diff -w -u -r1.18 TypeInfos.java
--- admin/mbeanapi-impl/src/java/com/sun/enterprise/management/
support/TypeInfos.java 19 Dec 2006 16:30:13 -0000 1.18
+++ admin/mbeanapi-impl/src/java/com/sun/enterprise/management/
support/TypeInfos.java 5 Jan 2007 20:19:38 -0000
@@ -173,7 +173,7 @@
      /**
          Call exactly once, and before getInstance() is called.
       */
- public static void
+ public static synchronized void
      preload()
      {
          if ( INSTANCE != null )
@@ -187,17 +187,10 @@
                 public static TypeInfos
         getInstance()
         {
- // 'INSTANCE' must be volatile!
- if ( INSTANCE != null )
+ if ( INSTANCE == null )
          {
- return INSTANCE;
+ throw new IllegalStateException();
          }
-
- final long start = System.nanoTime();
- // wait until its ready
- FeatureAvailability.getInstance().waitForFeature
( TYPE_INFOS_FEATURE, "TypeInfos.getInstance()" );
- final long elapsed = System.nanoTime() - start;
-
          return INSTANCE;
         }


  cvs server: Diffing admin/templates/pe80
Index: admin/templates/pe80/default-domain.xml.template
===================================================================
RCS file: /cvs/glassfish/admin/templates/pe80/default-
domain.xml.template,v
retrieving revision 1.57
diff -w -u -r1.57 default-domain.xml.template
--- admin/templates/pe80/default-domain.xml.template 3 Jan 2007
22:39:37 -0000 1.57
+++ admin/templates/pe80/default-domain.xml.template 5 Jan 2007
20:19:39 -0000
@@ -182,7 +182,7 @@
      <jvm-options>-Djavax.net.ssl.trustStore=$
{com.sun.aas.instanceRoot}/config/cacerts.jks</jvm-options>
      <jvm-options>-Djava.ext.dirs=${com.sun.aas.javaRoot}/lib/ext$
{path.separator}${com.sun.aas.javaRoot}/jre/lib/ext${path.separator}$
{com.sun.aas.instanceRoot}/lib/ext${path.separator}$
{com.sun.aas.derbyRoot}/lib</jvm-options>
     <jvm-options>-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver</
jvm-options>
- <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.admin.server.core.j
mx.AppServerMBeanServerBuilder</jvm-options>
+ <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.interceptor.Interce
ptorMBeanServerBuilder</jvm-options>
      <jvm-options>-
Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.ente
rprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-
options>
      <jvm-options>-Dcom.sun.enterprise.taglibs=appserv-jstl.jar,jsf-
impl.jar</jvm-options>
      <jvm-options>-Dcom.sun.enterprise.taglisteners=jsf-impl.jar</
jvm-options>
Index: admin/templates/pe80/default-domain.xml.template.darwin
===================================================================
RCS file: /cvs/glassfish/admin/templates/pe80/default-
domain.xml.template.darwin,v
retrieving revision 1.34
diff -w -u -r1.34 default-domain.xml.template.darwin
--- admin/templates/pe80/default-domain.xml.template.darwin 8 Dec
2006 17:55:52 -0000 1.34
+++ admin/templates/pe80/default-domain.xml.template.darwin 5 Jan
2007 20:19:39 -0000
@@ -175,7 +175,7 @@
      <jvm-options>-Djavax.net.ssl.trustStore=$
{com.sun.aas.instanceRoot}/config/cacerts.jks</jvm-options>
      <jvm-options>-Djava.ext.dirs=${com.sun.aas.javaRoot}/lib/ext$
{path.separator}${com.sun.aas.instanceRoot}/lib/ext${path.separator}$
{com.sun.aas.derbyRoot}/lib</jvm-options>
     <jvm-options>-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver</
jvm-options>
- <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.admin.server.core.j
mx.AppServerMBeanServerBuilder</jvm-options>
+ <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.interceptor.Interce
ptorMBeanServerBuilder</jvm-options>
      <jvm-options>-
Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.ente
rprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-
options>
      <jvm-options>-Dcom.sun.enterprise.taglibs=appserv-jstl.jar,jsf-
impl.jar</jvm-options>
      <jvm-options>-Dcom.sun.enterprise.taglisteners=jsf-impl.jar</
jvm-options>
cvs server: Diffing admin/templates/pe80/cluster
Index: admin/templates/pe80/cluster/domain.xml.xsl.1
===================================================================
RCS file: /cvs/glassfish/admin/templates/pe80/cluster/domain.xml.xsl.1,v
retrieving revision 1.10
diff -w -u -r1.10 domain.xml.xsl.1
--- admin/templates/pe80/cluster/domain.xml.xsl.1 18 Dec 2006
20:57:02 -0000 1.10
+++ admin/templates/pe80/cluster/domain.xml.xsl.1 5 Jan 2007
20:19:39 -0000
@@ -105,7 +105,7 @@
    <xsl:template match="java-config">
      <xsl:copy>
        <xsl:apply-templates select="@*"/>
- <xsl:element name="jvm-options">-
Djavax.management.builder.initial=com.sun.enterprise.ee.admin.AppServerM
BeanServerBuilder</xsl:element>
+ <xsl:element name="jvm-options">-
Djavax.management.builder.initial=com.sun.enterprise.interceptor.Interce
ptorMBeanServerBuilder</xsl:element>
        <xsl:element name="jvm-options">-
Dcom.sun.appserv.pluggable.features=com.sun.enterprise.ee.server.pluggab
le.EEPluggableFeatureImpl</xsl:element>
        <xsl:element name="jvm-options">-Djava.endorsed.dirs=$
{com.sun.aas.installRoot}/lib/endorsed</xsl:element>
        <xsl:element name="jvm-options">-Djava.security.policy=$
{com.sun.aas.instanceRoot}/config/server.policy</xsl:element>
cvs server: Diffing admin/templates/pe80/developer
cvs server: Diffing admin/templates/pe80/enterprise
Index: admin/templates/pe80/enterprise/domain.xml.xsl.1
===================================================================
RCS file: /cvs/glassfish/admin/templates/pe80/enterprise/
domain.xml.xsl.1,v
retrieving revision 1.8
diff -w -u -r1.8 domain.xml.xsl.1
--- admin/templates/pe80/enterprise/domain.xml.xsl.1 18 Dec 2006
20:57:02 -0000 1.8
+++ admin/templates/pe80/enterprise/domain.xml.xsl.1 5 Jan 2007
20:19:39 -0000
@@ -107,7 +107,7 @@
    <xsl:template match="java-config">
      <xsl:copy>
        <xsl:apply-templates select="@*"/>
- <xsl:element name="jvm-options">-
Djavax.management.builder.initial=com.sun.enterprise.ee.admin.AppServerM
BeanServerBuilder</xsl:element>
+ <xsl:element name="jvm-options">-
Djavax.management.builder.initial=com.sun.enterprise.interceptor.Interce
ptorMBeanServerBuilder</xsl:element>
        <xsl:element name="jvm-options">-
Dcom.sun.appserv.pluggable.features=com.sun.enterprise.ee.server.pluggab
le.EEPluggableFeatureImpl</xsl:element>
        <xsl:element name="jvm-options">-Djava.endorsed.dirs=$
{com.sun.aas.installRoot}/lib/endorsed</xsl:element>
        <xsl:element name="jvm-options">-Djava.security.policy=$
{com.sun.aas.instanceRoot}/config/server.policy</xsl:element>
cvs server: Diffing admin/templates/pe80/resources
cvs server: Diffing admin/templates/pe80/resources/jdbc
cvs server: Diffing admin/util
cvs server: Diffing admin/util/src
cvs server: Diffing admin/util/src/java
cvs server: Diffing admin/util/src/java/com
cvs server: Diffing admin/util/src/java/com/sun
cvs server: Diffing admin/util/src/java/com/sun/enterprise
cvs server: Diffing admin/util/src/java/com/sun/enterprise/management
cvs server: Diffing admin/util/src/java/com/sun/enterprise/management/
util
Index: admin/util/src/java/com/sun/enterprise/management/util/
J2EEManagementObjectManager.java
===================================================================
RCS file: /cvs/glassfish/admin/util/src/java/com/sun/enterprise/
management/util/J2EEManagementObjectManager.java,v
retrieving revision 1.15
diff -w -u -r1.15 J2EEManagementObjectManager.java
--- admin/util/src/java/com/sun/enterprise/management/util/
J2EEManagementObjectManager.java 4 Nov 2006 01:41:24 -0000
1.15
+++ admin/util/src/java/com/sun/enterprise/management/util/
J2EEManagementObjectManager.java 5 Jan 2007 20:19:39 -0000
@@ -109,6 +109,8 @@
  import com.sun.appserv.management.util.jmx.JMXUtil;
  import com.sun.enterprise.management.support.WebModuleSupport;

+import com.sun.enterprise.management.support.BootUtil;
+
  /**
   * J2EEManagementObjectManager is responsible for managing
   * all JSR77 managed objects (MBeans).
@@ -2012,49 +2014,15 @@
         }
      }

- /*
- public ObjectName getServerON(boolean amx, String serverName) {
- ObjectName serverON = null;
- try {
- String strON = getServerBaseON(amx, serverName);
- serverON = findObjectName(strON + ",*");
- } catch (Exception e) {
- e.printStackTrace();
- _logger.log(Level.WARNING, "admin.getServerON
exception", e);
- }
- return serverON;
- }
- */
-
      public String getServerBaseON(boolean amx, String serverName) {

              String domainName = null;

              // get domain name
              if (amx) {
- try {
- ObjectName pattern = Util.newObjectNamePattern(
- "*", LoaderMBean.LOADER_NAME_PROPS );
- Set names = server.queryNames(pattern, null);
- assert( names.size() == 1 );
- ObjectName loaderON = (ObjectName)
SetUtil.getSingleton(names);
- domainName =
- (String) server.getAttribute(loaderON,
"AdministrativeDomainName");
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- //domainName = "amx";
+ domainName= BootUtil.getInstance
().getAppserverDomainName();
              } else {
- /*
- ObjectName pattern = Util.newObjectNamePattern(
- "*", "j2eeType=J2EEDomain,category=runtime");
- Set names = server.queryNames(pattern, null);
- assert( names.size() == 1 );
- ObjectName domainON = (ObjectName)
SetUtil.getSingleton(names);
- domainName = (String) server.getAttribute(domainON,
"name");
- */
- domainName =
- ApplicationServer.getServerContext
().getDefaultDomainName();
+ domainName = ApplicationServer.getServerContext
().getDefaultDomainName();
              }

              return getServerBaseON(domainName, serverName);

cvs server: Diffing admin/validator/tests/com/sun/enterprise/config/
serverbeans/validation
Index: admin/validator/tests/com/sun/enterprise/config/serverbeans/
validation/domain.flatten.xml
===================================================================
RCS file: /cvs/glassfish/admin/validator/tests/com/sun/enterprise/
config/serverbeans/validation/domain.flatten.xml,v
retrieving revision 1.3
diff -w -u -r1.3 domain.flatten.xml
--- admin/validator/tests/com/sun/enterprise/config/serverbeans/
validation/domain.flatten.xml 25 Dec 2005 03:44:47 -0000 1.3
+++ admin/validator/tests/com/sun/enterprise/config/serverbeans/
validation/domain.flatten.xml 5 Jan 2007 20:19:39 -0000
@@ -168,7 +168,7 @@
          <jvm-options>-
Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.ente
rprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-
options>
          <jvm-options>-Dcom.sun.enterprise.taglibs=appserv-
jstl.jar,jsf-impl.jar</jvm-options>
          <jvm-options>-XX:NewRatio=2</jvm-options>
- <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.ee.admin.AppServerM
BeanServerBuilder</jvm-options>
+ <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.interceptor.Interce
ptorMBeanServerBuilder</jvm-options>
          <jvm-options>-
Dcom.sun.appserv.pluggable.features=com.sun.enterprise.ee.server.pluggab
le.EEPluggableFeatureImpl</jvm-options>
        </java-config>
        <thread-pools>
Index: admin/validator/tests/com/sun/enterprise/config/serverbeans/
validation/flatten.xml
===================================================================
RCS file: /cvs/glassfish/admin/validator/tests/com/sun/enterprise/
config/serverbeans/validation/flatten.xml,v
retrieving revision 1.3
diff -w -u -r1.3 flatten.xml
--- admin/validator/tests/com/sun/enterprise/config/serverbeans/
validation/flatten.xml 25 Dec 2005 03:44:47 -0000 1.3
+++ admin/validator/tests/com/sun/enterprise/config/serverbeans/
validation/flatten.xml 5 Jan 2007 20:19:39 -0000
@@ -168,7 +168,7 @@
          <jvm-options>-
Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.ente
rprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-
options>
          <jvm-options>-Dcom.sun.enterprise.taglibs=appserv-
jstl.jar,jsf-impl.jar</jvm-options>
          <jvm-options>-XX:NewRatio=2</jvm-options>
- <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.ee.admin.AppServerM
BeanServerBuilder</jvm-options>
+ <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.interceptor.Interce
ptorMBeanServerBuilder</jvm-options>
          <jvm-options>-
Dcom.sun.appserv.pluggable.features=com.sun.enterprise.ee.server.pluggab
le.EEPluggableFeatureImpl</jvm-options>
        </java-config>
        <thread-pools>



cvs server: Diffing admin/ws-mgmt/tests/com/sun/enterprise/admin/
wsmgmt/registry
Index: admin/ws-mgmt/tests/com/sun/enterprise/admin/wsmgmt/registry/
connectionpool-domain.xml
===================================================================
RCS file: /cvs/glassfish/admin/ws-mgmt/tests/com/sun/enterprise/admin/
wsmgmt/registry/connectionpool-domain.xml,v
retrieving revision 1.5
diff -w -u -r1.5 connectionpool-domain.xml
--- admin/ws-mgmt/tests/com/sun/enterprise/admin/wsmgmt/registry/
connectionpool-domain.xml 25 Dec 2005 03:45:19 -0000 1.5
+++ admin/ws-mgmt/tests/com/sun/enterprise/admin/wsmgmt/registry/
connectionpool-domain.xml 5 Jan 2007 20:19:39 -0000
@@ -171,7 +171,7 @@
          <jvm-options>-Dcom.sun.enterprise.taglibs=appserv-
jstl.jar,jsf-impl.jar</jvm-options>
          <jvm-options>-Dcom.sun.enterprise.taglisteners=jsf-
impl.jar</jvm-options>
          <jvm-options>-XX:NewRatio=2</jvm-options>
- <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.ee.admin.AppServerM
BeanServerBuilder</jvm-options>
+ <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.interceptor.Interce
ptorMBeanServerBuilder</jvm-options>
          <jvm-options>-
Dcom.sun.appserv.pluggable.features=com.sun.enterprise.ee.server.pluggab
le.EEPluggableFeatureImpl</jvm-options>
          <jvm-options>-Dcom.sun.appserv.nss.db=$
{com.sun.aas.instanceRoot}/config</jvm-options>
        </java-config>



cvs server: Diffing admin-core/admin
Index: admin-core/admin/build.xml
===================================================================
RCS file: /cvs/glassfish/admin-core/admin/build.xml,v
retrieving revision 1.6
diff -w -u -r1.6 build.xml
--- admin-core/admin/build.xml 27 Oct 2006 18:00:20 -0000 1.6
+++ admin-core/admin/build.xml 5 Jan 2007 20:19:39 -0000
@@ -64,6 +64,7 @@
              failonerror="true">
                 <classpath refid="compile.classpath"/>
              <include name="com/sun/enterprise/admin/**"/>
+ <include name="com/sun/enterprise/interceptor/**"/>
              <exclude name="com/sun/enterprise/management/**"/>
              <exclude name="com/sun/enterprise/admin/jmx/**"/>
              <exclude name="com/sun/enterprise/admin/config/mbeans/
**"/>



cvs server: Diffing admin-core/admin/src/java/com/sun/enterprise/
admin/meta
Index: admin-core/admin/src/java/com/sun/enterprise/admin/meta/
MBeanRegistry.java
===================================================================
RCS file: /cvs/glassfish/admin-core/admin/src/java/com/sun/enterprise/
admin/meta/MBeanRegistry.java,v
retrieving revision 1.8
diff -w -u -r1.8 MBeanRegistry.java
--- admin-core/admin/src/java/com/sun/enterprise/admin/meta/
MBeanRegistry.java 16 May 2006 18:31:38 -0000 1.8
+++ admin-core/admin/src/java/com/sun/enterprise/admin/meta/
MBeanRegistry.java 5 Jan 2007 20:19:39 -0000
@@ -546,8 +546,9 @@
       * ConfigException is also chained.
       *
       * @see generateAndRegisterAllDottedNames
+ @return number of MBeans that were registered
       */
- public void instantiateAndRegisterAllConfigMBeans(
+ public int instantiateAndRegisterAllConfigMBeans(
                                  ConfigContext ctx,
                                  String domainName)
                                  throws MBeanMetaException
@@ -565,9 +566,10 @@
              throw new MBeanMetaException
                  ("ConfigException in getting Domain bean from
config context", e);
          }
- instantiateAndRegisterConfigMBeans(bean, domainName);
+ final int numRegistered = instantiateAndRegisterConfigMBeans
(bean, domainName);
          _sLogger.log(Level.FINEST,
              "Instantiated All Config MBeans in MBeanRegistry
Successfully");
+ return numRegistered;
      }


@@ -655,10 +657,12 @@
       * all possible mbeans without throwing any exceptions--a best
effort
       * solution.
       */
- private void instantiateAndRegisterConfigMBeans(ConfigBean bean,
String domainName)
+ private int instantiateAndRegisterConfigMBeans(ConfigBean bean,
String domainName)
      {
          if(bean == null)
- return;
+ return(0);
+ int numRegistered = 0;
+
          String xpath = bean.getAbsoluteXPath("");
          ConfigContext ctx = bean.getConfigContext();
          try
@@ -672,6 +676,7 @@
  //register here
                      BaseAdminMBean mbean = instantiateConfigMBean
(objectName, null, ctx) ;
                      registerMBean(mbean, objectName);
+ ++numRegistered;
                  }
              }
          }
@@ -695,7 +700,7 @@
                      }

                      try {
- instantiateAndRegisterConfigMBeans(beans[i],
domainName);
+ numRegistered +=
instantiateAndRegisterConfigMBeans(beans[i], domainName);
                      } catch(Exception e1) {
                          //ignore
                           _sLogger.log(Level.FINEST,
@@ -709,6 +714,7 @@
               _sLogger.log(Level.FINEST,
                          "Exception in
instantiateAndRegisterConfigMBeans:", e);
          }
+ return numRegistered;
      }

      /**


cvs server: Diffing admin-ee/lb-admin/tests/com/sun/enterprise/ee/
admin/lbadmin
Index: admin-ee/lb-admin/tests/com/sun/enterprise/ee/admin/lbadmin/
test-domain.xml
===================================================================
RCS file: /cvs/glassfish/admin-ee/lb-admin/tests/com/sun/enterprise/
ee/admin/lbadmin/test-domain.xml,v
retrieving revision 1.1.1.1
diff -w -u -r1.1.1.1 test-domain.xml
--- admin-ee/lb-admin/tests/com/sun/enterprise/ee/admin/lbadmin/test-
domain.xml 8 Aug 2006 19:48:39 -0000 1.1.1.1
+++ admin-ee/lb-admin/tests/com/sun/enterprise/ee/admin/lbadmin/test-
domain.xml 5 Jan 2007 20:19:40 -0000
@@ -170,7 +170,7 @@
          <jvm-options>-
Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.ente
rprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-
options>
          <jvm-options>-Dcom.sun.enterprise.taglibs=appserv-
jstl.jar,jsf-impl.jar</jvm-options>
          <jvm-options>-XX:NewRatio=2</jvm-options>
- <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.ee.admin.AppServerM
BeanServerBuilder</jvm-options>
+ <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.interceptor.Interce
ptorMBeanServerBuilder</jvm-options>
          <jvm-options>-
Dcom.sun.appserv.pluggable.features=com.sun.enterprise.ee.server.pluggab
le.EEPluggableFeatureImpl</jvm-options>
        </java-config>
        <thread-pools>
Index: admin-ee/lb-admin/tests/com/sun/enterprise/ee/admin/lbadmin/
test-domain2.xml
===================================================================
RCS file: /cvs/glassfish/admin-ee/lb-admin/tests/com/sun/enterprise/
ee/admin/lbadmin/test-domain2.xml,v
retrieving revision 1.1.1.1
diff -w -u -r1.1.1.1 test-domain2.xml
--- admin-ee/lb-admin/tests/com/sun/enterprise/ee/admin/lbadmin/test-
domain2.xml 8 Aug 2006 19:48:39 -0000 1.1.1.1
+++ admin-ee/lb-admin/tests/com/sun/enterprise/ee/admin/lbadmin/test-
domain2.xml 5 Jan 2007 20:19:40 -0000
@@ -170,7 +170,7 @@
          <jvm-options>-
Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.ente
rprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-
options>
          <jvm-options>-Dcom.sun.enterprise.taglibs=appserv-
jstl.jar,jsf-impl.jar</jvm-options>
          <jvm-options>-XX:NewRatio=2</jvm-options>
- <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.ee.admin.AppServerM
BeanServerBuilder</jvm-options>
+ <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.interceptor.Interce
ptorMBeanServerBuilder</jvm-options>
          <jvm-options>-
Dcom.sun.appserv.pluggable.features=com.sun.enterprise.ee.server.pluggab
le.EEPluggableFeatureImpl</jvm-options>
        </java-config>
        <thread-pools>


cvs server: Diffing admin-ee/nodeagent/src/java/com/sun/enterprise/ee/
nodeagent
Index: admin-ee/nodeagent/src/java/com/sun/enterprise/ee/nodeagent/
NodeAgentMain.java
===================================================================
RCS file: /cvs/glassfish/admin-ee/nodeagent/src/java/com/sun/
enterprise/ee/nodeagent/NodeAgentMain.java,v
retrieving revision 1.3
diff -w -u -r1.3 NodeAgentMain.java
--- admin-ee/nodeagent/src/java/com/sun/enterprise/ee/nodeagent/
NodeAgentMain.java 21 Nov 2006 07:27:37 -0000 1.3
+++ admin-ee/nodeagent/src/java/com/sun/enterprise/ee/nodeagent/
NodeAgentMain.java 5 Jan 2007 20:19:40 -0000
@@ -51,7 +51,12 @@
  import com.sun.enterprise.admin.event.AdminEventListenerException;
  import com.sun.enterprise.security.store.IdentityManager;

+import com.sun.appserv.management.helper.AMXDebugHelper;
+import com.sun.enterprise.util.RunnableBase;
+import com.sun.enterprise.util.FeatureAvailability;
+
  class Shutdown implements ShutdownEventListener {
+
      private BaseNodeAgent bna=null;

      public Shutdown(BaseNodeAgent bna) {
@@ -74,6 +79,8 @@
  }

  public class NodeAgentMain {
+ private static final AMXDebugHelper _Debug = new AMXDebugHelper
( "NodeAgent" );
+ private static void debug( final Object... args )
{ _Debug.println( args ); }

      private static final StringManager
_strMgr=StringManager.getManager(NodeAgentMain.class);
      private static AgentConfig _config = null;
@@ -174,7 +181,35 @@

      }

+ static private final String BUILDER_SYSTEM_PROPERTY =
"javax.management.builder.initial";
+
+ private static class MBeanServerIniter extends
com.sun.enterprise.util.RunnableBase {
+ MBeanServerIniter()
+ {
+ final String builder = System.getProperty
( BUILDER_SYSTEM_PROPERTY );
+ if ( builder != null )
+ {
+ throw new Error(
+ "initializeMBeanServer: expecting standard
MBeanServer, not " + builder);
+ }
+ }
+
+ protected void doRun() {
+ final long start = System.currentTimeMillis();
+ final MBeanServer server =
java.lang.management.ManagementFactory.getPlatformMBeanServer();
+ FeatureAvailability.getInstance().registerFeature
( FeatureAvailability.MBEAN_SERVER_FEATURE, server );
+ final long elapsed = System.currentTimeMillis() - start;
+ _Debug.println( "MBeanServer created successfully in "
+ elapsed + "ms");
+ }
+ };
+
+
      public static void main (String[] args) {
+ _Debug.setDebug( true );
+ _Debug.setEchoToStdOut( true );
+ final MBeanServerIniter initer = new MBeanServerIniter();
+ initer.submit();
+
          try {
              // look for Debug system property
              if (System.getProperty("Debug") != null) {


cvs server: Diffing admin-ee/synchronization/testsrc/java/com/sun/
enterprise/ee/synchronization
Index: admin-ee/synchronization/testsrc/java/com/sun/enterprise/ee/
synchronization/director-test-domain.xml
===================================================================
RCS file: /cvs/glassfish/admin-ee/synchronization/testsrc/java/com/
sun/enterprise/ee/synchronization/director-test-domain.xml,v
retrieving revision 1.1.1.1
diff -w -u -r1.1.1.1 director-test-domain.xml
--- admin-ee/synchronization/testsrc/java/com/sun/enterprise/ee/
synchronization/director-test-domain.xml 8 Aug 2006 19:48:40
-0000 1.1.1.1
+++ admin-ee/synchronization/testsrc/java/com/sun/enterprise/ee/
synchronization/director-test-domain.xml 5 Jan 2007 20:19:40
-0000
@@ -129,7 +129,7 @@
      <jvm-options>-
Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.ente
rprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-
options>
      <jvm-options>-Dcom.sun.enterprise.taglibs=appserv-jstl.jar,jsf-
impl.jar</jvm-options>
      <jvm-options>-XX:NewRatio=2</jvm-options>
- <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.ee.admin.AppServerM
BeanServerBuilder</jvm-options><jvm-options>-
Dcom.sun.appserv.pluggable.features=com.sun.enterprise.ee.server.pluggab
le.EEPluggableFeatureImpl</jvm-options></java-config>
+ <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.interceptor.Interce
ptorMBeanServerBuilder</jvm-options><jvm-options>-
Dcom.sun.appserv.pluggable.features=com.sun.enterprise.ee.server.pluggab
le.EEPluggableFeatureImpl</jvm-options></java-config>
     <thread-pools>
          <thread-pool thread-pool-id="thread-pool-1" min-thread-pool-
size="0" max-thread-pool-size="200" idle-thread-timeout-in-
seconds="120" num-work-queues="1"/>



cvs server: Diffing admin-ee/templates/ee80
Index: admin-ee/templates/ee80/changePEDomain2SEDomain.xml
===================================================================
RCS file: /cvs/glassfish/admin-ee/templates/ee80/
changePEDomain2SEDomain.xml,v
retrieving revision 1.2
diff -w -u -r1.2 changePEDomain2SEDomain.xml
--- admin-ee/templates/ee80/changePEDomain2SEDomain.xml 21 Nov 2006
13:59:17 -0000 1.2
+++ admin-ee/templates/ee80/changePEDomain2SEDomain.xml 5 Jan 2007
20:19:40 -0000
@@ -31,12 +31,12 @@
      <alteration type="FIRST_OCCURRENCE" elementName="jvm-options"
dnType="text" dnValue="-Djavax.net.ssl.trustStore=$
{com.sun.aas.instanceRoot}/config/cacerts.jks">
            <removeElement/>
      </alteration>
- <alteration type="FIRST_OCCURRENCE" elementName="jvm-options"
dnType="text" dnValue="-
Djavax.management.builder.initial=com.sun.enterprise.admin.server.core.j
mx.AppServerMBeanServerBuilder">
+ <alteration type="FIRST_OCCURRENCE" elementName="jvm-options"
dnType="text" dnValue="-
Djavax.management.builder.initial=com.sun.enterprise.interceptor.Interce
ptorMBeanServerBuilder">
            <removeElement/>
      </alteration>
      <alteration type="FIRST_OCCURRENCE" elementName="java-config">
            <addElement>
- <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.ee.admin.AppServerM
BeanServerBuilder</jvm-options>
+ <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.interceptor.Interce
ptorMBeanServerBuilder</jvm-options>
            </addElement>
      </alteration>
      <alteration type="FIRST_OCCURRENCE" elementName="jms-service">
Index: admin-ee/templates/ee80/default-domain.xml.template
===================================================================
RCS file: /cvs/glassfish/admin-ee/templates/ee80/default-
domain.xml.template,v
retrieving revision 1.10
diff -w -u -r1.10 default-domain.xml.template
--- admin-ee/templates/ee80/default-domain.xml.template 8 Dec 2006
17:58:50 -0000 1.10
+++ admin-ee/templates/ee80/default-domain.xml.template 5 Jan 2007
20:19:40 -0000
@@ -210,7 +210,7 @@
      <jvm-options>-Dcom.sun.enterprise.taglibs=appserv-jstl.jar,jsf-
impl.jar</jvm-options>
      <jvm-options>-Dcom.sun.enterprise.taglisteners=jsf-impl.jar</
jvm-options>
      <jvm-options>-XX:NewRatio=2</jvm-options>
- <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.ee.admin.AppServerM
BeanServerBuilder</jvm-options><jvm-options>-
Dcom.sun.appserv.pluggable.features=com.sun.enterprise.ee.server.pluggab
le.EEPluggableFeatureImpl</jvm-options><jvm-options>-
Dcom.sun.appserv.nss.db=${com.sun.aas.instanceRoot}/config</jvm-
options></java-config>
+ <jvm-options>-
Djavax.management.builder.initial=com.sun.enterprise.interceptor.Interce
ptorMBeanServerBuilder</jvm-options><jvm-options>-
Dcom.sun.appserv.pluggable.features=com.sun.enterprise.ee.server.pluggab
le.EEPluggableFeatureImpl</jvm-options><jvm-options>-
Dcom.sun.appserv.nss.db=${com.sun.aas.instanceRoot}/config</jvm-
options></java-config>
     <availability-service auto-manage-ha-store="false" availability-
enabled="true" ha-store-healthcheck-enabled="false" ha-store-
healthcheck-interval-in-seconds="5">
                  <web-container-availability availability-
enabled="true" http-session-store-pool-name="jdbc/hastore"
persistence-frequency="web-method" persistence-scope="session"
persistence-store-health-check-enabled="false" persistence-type="ha"
sso-failover-enabled="false"/>
                  <ejb-container-availability availability-
enabled="true" sfsb-ha-persistence-type="ha" sfsb-persistence-
type="file" sfsb-store-pool-name="jdbc/hastore"/>



cvs server: Diffing appserv-api/src/java/com/sun/appserv/management/base
Index: appserv-api/src/java/com/sun/appserv/management/base/
SystemInfo.java
===================================================================
RCS file: /cvs/glassfish/appserv-api/src/java/com/sun/appserv/
management/base/SystemInfo.java,v
retrieving revision 1.2
diff -w -u -r1.2 SystemInfo.java
--- appserv-api/src/java/com/sun/appserv/management/base/
SystemInfo.java 19 Dec 2006 17:14:14 -0000 1.2
+++ appserv-api/src/java/com/sun/appserv/management/base/
SystemInfo.java 5 Jan 2007 20:19:42 -0000
@@ -20,15 +20,10 @@
   *
   * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
   */
-
-/*
- * $Header: /cvs/glassfish/appserv-api/src/java/com/sun/appserv/
management/base/SystemInfo.java,v 1.2 2006/12/19 17:14:14 llc Exp $
- * $Revision: 1.2 $
- * $Date: 2006/12/19 17:14:14 $
- */
-
  package com.sun.appserv.management.base;

+import java.util.Map;
+

  /**
         Provides information about the capabilities of the running
server.
@@ -90,5 +85,25 @@



+ /**
+ Key for time for server to complete its startup sequence.
The presence of this item
+ in the Map returned by {_at_link #getPerformanceMillis}
indicates that the server has
+ completed its startup sequence. However, some server
features might still be initializing
+ asynchronously, or might be lazily loaded.
+ @see #getPerformanceMillis
+ */
+ public static final String STARTUP_SEQUENCE_MILLIS_KEY =
"StartupMillis";

+ /**
+ Return a Map keyed by an arbitrary String denoting some
feature. The value
+ is the time in milliseconds. Code should not rely on the
keys as they are subject to
+ changes, additions, or removal at any time, except as
otherwise documented.
+ Even documented items should be used only for informational
purposes,
+ such as assessing performance.
+
+ @return Map<String,Long>
+ */
+ public Map<String,Long> getPerformanceMillis();
  }
+
+



cvs server: appserv-api/src/java/com/sun/appserv/management/util/misc/
RunnableBase.java is a new entry, no comparison available
Index: appserv-api/src/java/com/sun/appserv/management/util/misc/
StringUtil.java
===================================================================
RCS file: /cvs/glassfish/appserv-api/src/java/com/sun/appserv/
management/util/misc/StringUtil.java,v
retrieving revision 1.2
diff -w -u -r1.2 StringUtil.java
--- appserv-api/src/java/com/sun/appserv/management/util/misc/
StringUtil.java 7 Dec 2006 22:30:07 -0000 1.2
+++ appserv-api/src/java/com/sun/appserv/management/util/misc/
StringUtil.java 5 Jan 2007 20:19:42 -0000
@@ -374,7 +374,7 @@
          @return a String describing the elapsed duration
       */
          public static String
- getTimingString( final long nanos )
+ getSecondsString( final long nanos )
      {
          final long seconds = nanos / (1000 * 1000 * 1000 );
          final long millis = nanos % (1000 * 1000 * 1000 ) /
( 1000 * 1000);
@@ -387,8 +387,20 @@
          {
              runTimeString = runTimeString + zeroPad(nanosMod);
          }
+ return runTimeString + " seconds";
+ }

- /*
+ /**
+ @param nanos elapsed nanoseconds
+ @return a String describing the elapsed duration
+ */
+ public static String
+ getTimingString( final long nanos )
+ {
+ final long seconds = nanos / (1000 * 1000 * 1000 );
+ final long millis = nanos % (1000 * 1000 * 1000 ) /
( 1000 * 1000);
+ final long micros = nanos % (1000 * 1000 ) / 1000;
+ final long nanosMod = nanos % 1000;

          String runTimeString = null;
          final long MICROSECOND = 1000;
@@ -405,9 +417,10 @@
          {
              runTimeString = (nanos / MILLISECOND ) + "
milliseconds";
          }
- */
+
          return runTimeString + " seconds";
      }
+

  }




cvs server: Diffing appserv-commons/src/java/com/sun/enterprise/util
Index: appserv-commons/src/java/com/sun/enterprise/util/
FeatureAvailability.java
===================================================================
RCS file: /cvs/glassfish/appserv-commons/src/java/com/sun/enterprise/
util/FeatureAvailability.java,v
retrieving revision 1.2
diff -w -u -r1.2 FeatureAvailability.java
--- appserv-commons/src/java/com/sun/enterprise/util/
FeatureAvailability.java 1 Dec 2006 23:34:20 -0000 1.2
+++ appserv-commons/src/java/com/sun/enterprise/util/
FeatureAvailability.java 5 Jan 2007 20:19:42 -0000
@@ -28,7 +28,8 @@

  import javax.management.MBeanServer;

-//import com.sun.appserv.management.helper.AMXDebugHelper;
+import com.sun.appserv.management.util.misc.StringUtil;
+import com.sun.appserv.management.helper.AMXDebugHelper;

  /**
      Central registry of available features for fine-grained
dependency enforcement in a
@@ -67,7 +68,14 @@
      private final Map<String,Object> mFeatures;
      private final Map<String,CountDownLatch> mLatches;

- // private final AMXDebugHelper mDebug;
+ private final AMXDebugHelper mDebug;
+ private void debug( final Object... args ) { mDebug.println
(args); }
+
+ /** feature stating that the ServerContext is available. Result
data is the ServerContext */
+ public static final String SERVER_CONTEXT_FEATURE =
"ServerContext";
+
+ /** feature stating that the AdminContext is available. Result
data is the ConfigContext */
+ //public static final String CONFIG_CONTEXT_FEATURE =
"ConfigContext";

      /** feature stating that the AdminContext is available. Result
data is the AdminContext */
      public static final String ADMIN_CONTEXT_FEATURE =
"AdminContext";
@@ -82,41 +90,27 @@
      /** feature stating that the AMX MBean Loader is available (but
not AMX). Data should not be used */
      public static final String AMX_LOADER_FEATURE = "AMXLoader";

+ /** feature stating that SystemInfo MBean is available. Data is
the ObjectName */
+ public static final String SYSTEM_INFO_FEATURE = "SystemInfo";
+
      /** feature stating that the AMX BootUtil class is available.
Data should not be used */
      public static final String AMX_BOOT_UTIL_FEATURE =
"AMXBootUtil";

+ /** feature stating that the AMX is fully initialized and ready
to use. Data is ObjectName of DomainRoot */
+ public static final String AMX_READY_FEATURE = "AMXReady";
+
      private FeatureAvailability()
      {
          mFeatures = new HashMap<String,Object>();
          mLatches = new HashMap<String,CountDownLatch>();

- //mDebug = new AMXDebugHelper( "--
FeatureAvailability--" );
- //mDebug.setEchoToStdOut( true );
+ mDebug = new AMXDebugHelper( "--FeatureAvailability--" );
+ mDebug.setEchoToStdOut( false );
      }

      public static FeatureAvailability getInstance() { return
INSTANCE; }

      private static final boolean DEBUG_ENABLED = false;
- /**
- Internal use, should be replaced with use of
- com.sun.appserv.management.helper.AMXDebugHelper when build-
order problems
- are resolved. Set DEBUG_ENABLED to true to see output.
- */
- private void
- debug( final Object... args)
- {
- if ( DEBUG_ENABLED )
- {
- String msg = "";
- for( int i = 0; i < args.length - 1; ++i )
- {
- msg = msg + args[i] + " ";
- }
- msg = msg + args[args.length-1];
-
- System.out.println( msg );
- }
- }

      /**
          MBeanServer is created very early and is available via this
method exept for code
@@ -149,22 +143,22 @@
      {
          if ( mFeatures.get( featureName ) != null )
          {
- debug( "addFeature: already added: " + featureName );
+ debug( "FeatureAvailability.registerFeature: already
added: ", featureName );
              throw new IllegalStateException();
          }
          if ( data == null )
          {
- System.out.println( "addFeature: data is null for: " +
featureName );
+ debug( "FeatureAvailability.registerFeature: data is
null for: ", featureName );
              throw new IllegalArgumentException();
          }
          mFeatures.put( featureName, data );
- debug( "********** FeatureAvailability.addFeature: " +
featureName + ", data = " + data + "**********");
+ debug( "FeatureAvailability.registerFeature: \"",
featureName, "\", data = ", data );

          if ( mLatches.containsKey( featureName ) )
          {
              final CountDownLatch latch = mLatches.remove
( featureName );
              latch.countDown(); // let all blocked threads proceed
- debug( "addFeature: released latch for: " + featureName );
+ debug( "FeatureAvailability.registerFeature: released
latch for: " + StringUtil.quote(featureName));
          }
      }

@@ -207,13 +201,24 @@
                  debug( "waitForFeature: \"" + featureName + "\" by
" + callerInfo );
                  final long startNanos = System.nanoTime();

- latch.await();
+ long elapsedNanos = 0;
+ while ( true )
+ {
+ final int WAIT_SECONDS = 1;
+ final boolean ready = latch.await( WAIT_SECONDS,
java.util.concurrent.TimeUnit.SECONDS );
+ elapsedNanos = System.nanoTime() - startNanos;
+ if ( ready )
+ break;
+
+ debug( "Still waiting for feature ",
StringUtil.quote(featureName),
+ ", ", StringUtil.getTimingString
( elapsedNanos ),
+ " by ", StringUtil.quote(callerInfo) );
+ }

- final long elapsedNanos = System.nanoTime() -
startNanos;
                  if ( elapsedNanos > 1000 * 1000 ) // 1 millisecond
                  {
                      debug( "FeatureAvailability.waitForFeature:
waited ",
- "" + elapsedNanos,
+ "" + StringUtil.getTimingString
( elapsedNanos ),
                          " for feature \"", featureName, "\" by \"",
callerInfo, "\"" );
                  }
              }



cvs server: Diffing appserv-core/src/java/com/sun/enterprise/admin/
common
Index: appserv-core/src/java/com/sun/enterprise/admin/common/
MBeanServerFactory.java
===================================================================
RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/
admin/common/MBeanServerFactory.java,v
retrieving revision 1.3
diff -w -u -r1.3 MBeanServerFactory.java
--- appserv-core/src/java/com/sun/enterprise/admin/common/
MBeanServerFactory.java 25 Dec 2005 04:13:51 -0000 1.3
+++ appserv-core/src/java/com/sun/enterprise/admin/common/
MBeanServerFactory.java 5 Jan 2007 20:19:43 -0000
@@ -20,86 +20,23 @@
   *
   * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
   */
-
  package com.sun.enterprise.admin.common;

-//JDK imports
+import com.sun.enterprise.util.FeatureAvailability;

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

-// i18n import
-import com.sun.enterprise.admin.util.SOMLocalStringsManager;
-
  /**
- 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
+ This class should be eliminated and replaced with
FeatureAvailability.
+ @see com.sun.enterprise.util.FeatureAvailability
  */

-public class MBeanServerFactory
-{
- public static final String kDefaultInitializerClassName =
- "com.sun.enterprise.admin.server.core.AdminService";
-
- private static MBeanServer sMBeanServerInstance = null;
-
- // 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 (sMBeanServerInstance != null)
- {
- String msg = localizedStrMgr.getString
( "admin.common.already_initialized" );
- throw new IllegalStateException( msg );
- }
- if (initializer == null || mbs == null)
+public final class MBeanServerFactory
          {
- 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 );
- }
- sMBeanServerInstance = mbs;
- }
+ private MBeanServerFactory() {}

- /**
- 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 ( sMBeanServerInstance );
+ return FeatureAvailability.getInstance().getMBeanServer();
      }
  }
Index: appserv-core/src/java/com/sun/enterprise/admin/common/
ObjectNames.java
===================================================================
RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/
admin/common/ObjectNames.java,v
retrieving revision 1.5
diff -w -u -r1.5 ObjectNames.java
--- appserv-core/src/java/com/sun/enterprise/admin/common/
ObjectNames.java 19 Dec 2006 17:11:25 -0000 1.5
+++ appserv-core/src/java/com/sun/enterprise/admin/common/
ObjectNames.java 5 Jan 2007 20:19:43 -0000
@@ -30,8 +30,8 @@
  import com.sun.enterprise.admin.util.Logger;
  import com.sun.enterprise.util.SystemPropertyConstants;

+import com.sun.appserv.management.util.jmx.JMXUtil;
  import com.sun.appserv.management.base.Util;
-
  /**
         A convenience class to create the object names of various
MBeans
         that are of interest. Note that all the Object Names will be
created
@@ -76,6 +76,7 @@
      public static final String kServer = "server";
      public static final String kGenericConfigurator =
"configurator";
      public static final String kSystemServices = "system-
services";
+ public static final String kSynchronization =
"synchronization";
      public static final String kServerInstance = "server-
instance";
      public static final String kApplication =
"application";
      public static final String kModule = "module";
@@ -140,6 +141,9 @@

      public static final String kProfiler = "profiler";

+ private static final String CATEGORY_CONFIG_PROP =
Util.makeProp( kCategoryKeyName, kConfig );
+ private static final String CATEGORY_MONITOR_PROP =
Util.makeProp( kCategoryKeyName, kMonitoringType );
+
      public static final String kConfigCategory = "config";
      public static final String kCategoryConfig =
Util.makeProp( kCategoryKeyName, kConfigCategory );

@@ -157,6 +161,20 @@

      public static ObjectName getHADBConfigObjectName()
{ return HADB_CONFIG_OBJECT_NAME; }

+ /*
+ Many ObjectNames are invariant singletons. Make them just
once.
+ */
+ private static final ObjectName
APPLICATIONS_CONFIG_OBJECT_NAME = makeConfigObjectName
( "applications" );
+ private static final ObjectName RESOURCES_OBJECT_NAME
= makeConfigObjectName( "resources" );
+ private static final ObjectName SYNCHRONIZATION_OBJECT_NAME
= makeConfigObjectName(kSynchronization);
+
+ private static final ObjectName CONTROLLER_OBJECT_NAME =
+ JMXUtil.newObjectName( kDefaultIASDomainName, Util.makeProp
( kTypeKeyName, kController ) );
+
+ private static final ObjectName GENERIC_CONFIGURATOR_OBJECT_NAME =
+ JMXUtil.newObjectName( kDefaultIASDomainName, Util.makeProp
( kTypeKeyName, kGenericConfigurator ) );
+
+
      /**
              Returns the ObjectName of MBean representing Server
Controller.
              This is the Object Name of the entity that makes all
Server side
@@ -166,9 +184,7 @@
      */
      public static ObjectName getControllerObjectName()
      {
- return ( getObjectName(kDefaultIASDomainName,
- new String[]{kTypeKeyName},
- new String[]{kController}) );
+ return CONTROLLER_OBJECT_NAME;
      }

          /**
@@ -182,17 +198,26 @@
                         new String[]{kTypeKeyName, kNameKeyName,
kCategoryKeyName},
                         new String[]{kServer, serverName, kConfig}) );
         }
-
      /**
          Returns the ObjectName of Generic Configurator.
      */
-
      public static ObjectName getGenericConfiguratorObjectName()
      {
- return ( getObjectName(kDefaultIASDomainName,
- new String[]{kTypeKeyName},
- new String[]{kGenericConfigurator}) );
+ return GENERIC_CONFIGURATOR_OBJECT_NAME;
+ }
+
+ private static String makeType ( final String type ) { return
Util.makeProp( kTypeKeyName, type ); }
+ private static ObjectName makeConfigObjectName( final String
type )
+ {
+ return JMXUtil.newObjectName( kDefaultIASDomainName, makeType
(type) + "," + CATEGORY_CONFIG_PROP );
      }
+
+ public static ObjectName getSynchronizationObjectName()
+ {
+ return SYNCHRONIZATION_OBJECT_NAME;
+ }
+
+
      /** Gets the System Service MBean Object Name in the Admin
Server aka DAS.
       * This method has been deprecated. Use
#getPerInstanceSystemServicesObjectName
       * instead.
@@ -209,6 +234,7 @@
          return ( getPerInstanceSystemServicesObjectName
(SystemPropertyConstants.DEFAULT_SERVER_INSTANCE_NAME) );
      }

+
      /** Returns the ObjectName of the system services MBean that would
       * be available in a given server instance name.
       * @param instanceId String representing the id of instance -
may not be null
@@ -273,7 +299,7 @@
      public static ObjectName getJMSAdminHandlerObjectName(String
instanceName)
      {
          return ( getObjectName(kDefaultIASDomainName,
- new String[]{kTypeKeyName, kServerInstanceKeyName},
+ TYPEKEY_SERVERKEY,
                  new String[]{kJMSAdminHandler, instanceName}) );
      }

@@ -342,7 +368,7 @@
          if(System.getProperty(USE_DEPLOYMENT_MBEAN,"false").equals
("true"))
          {
               return ( getObjectName (kDefaultIASDomainName,
- new String[]{kTypeKeyName, kServerInstanceKeyName},
+ TYPEKEY_SERVERKEY,
                  new String[]{kDeployment, instanceName}));
          }
          else {
@@ -352,6 +378,24 @@


      /**
+ @return ObjectName of type=applications,category=config MBean
+ */
+ public static ObjectName getApplicationsConfigObjectName()
+ {
+ return APPLICATIONS_CONFIG_OBJECT_NAME;
+ }
+
+
+ /**
+ @return ObjectName of type=resources,category=config MBean
+ */
+ public static ObjectName getResourcesConfigObjectName()
+ {
+ return RESOURCES_OBJECT_NAME;
+ }
+
+
+ /**
              Returns the ObjectName of MBean that represents a
managed J2EE
              application, with given name and deployed to given
Server Instance.

@@ -563,10 +607,16 @@
          return pattern;
      }

+ private static final String[] TYPEKEY_SERVERKEY =
+ new String[]{kTypeKeyName, kServerInstanceKeyName};
+
+ private static final String[] TYPEKEY_SERVERKEY_NAMEKEY =
+ new String[]{kTypeKeyName, kServerInstanceKeyName,
kNameKeyName};
+
      public static ObjectName getORBObjectName(String instanceName)
      {
          return ( getObjectName (kDefaultIASDomainName,
- new String[]{kTypeKeyName, kServerInstanceKeyName},
+ TYPEKEY_SERVERKEY,
                  new String[]{kOrbType, instanceName}));
      }

@@ -574,9 +624,7 @@
                                                         String
listenerId)
      {
          return ( getObjectName (kDefaultIASDomainName,
- new String[]{kTypeKeyName,
- kServerInstanceKeyName,
- kNameKeyName},
+ TYPEKEY_SERVERKEY_NAMEKEY,
                  new String[]{kOrbListenerType, instanceName,
listenerId}));
      }

@@ -584,9 +632,7 @@
      getJDBCConnectionPoolObjectName(String instanceName, String
poolName)
      {
          return ( getObjectName (kDefaultIASDomainName,
- new String[]{kTypeKeyName,
- kServerInstanceKeyName,
- kNameKeyName},
+ TYPEKEY_SERVERKEY_NAMEKEY,
                  new String[]{kJdbcConnectionPoolType, instanceName,
poolName}));
      }

@@ -594,9 +640,7 @@
      getJDBCResourceObjectName(String instanceName, String jndiName)
      {
          return ( getObjectName (kDefaultIASDomainName,
- new String[]{kTypeKeyName,
- kServerInstanceKeyName,
- kNameKeyName},
+ TYPEKEY_SERVERKEY_NAMEKEY,
                  new String[]{kJdbcResourceType, instanceName,
jndiName}));
      }

@@ -604,9 +648,7 @@
      getJNDIResourceObjectName(String instanceName, String jndiName)
      {
          return ( getObjectName (kDefaultIASDomainName,
- new String[]{kTypeKeyName,
- kServerInstanceKeyName,
- kNameKeyName},
+ TYPEKEY_SERVERKEY_NAMEKEY,
                  new String[]{kJndiResourceType, instanceName,
jndiName}));
      }

@@ -614,9 +656,7 @@
      getJMSResourceObjectName(String instanceName, String jndiName)
      {
          return ( getObjectName (kDefaultIASDomainName,
- new String[]{kTypeKeyName,
- kServerInstanceKeyName,
- kNameKeyName},
+ TYPEKEY_SERVERKEY_NAMEKEY,
                  new String[]{kJmsResourceType, instanceName,
jndiName}));
      }

@@ -625,9 +665,7 @@
                                                     String jndiName)
      {
          return ( getObjectName (kDefaultIASDomainName,
- new String[]{kTypeKeyName,
- kServerInstanceKeyName,
- kNameKeyName},
+ TYPEKEY_SERVERKEY_NAMEKEY,
                  new String[]{kPersistenceManagerFactoryResourceType,
                               instanceName, jndiName}));
      }
@@ -636,9 +674,7 @@
      getMailResourceObjectName(String instanceName, String jndiName)
      {
          return ( getObjectName (kDefaultIASDomainName,
- new String[]{kTypeKeyName,
- kServerInstanceKeyName,
- kNameKeyName},
+ TYPEKEY_SERVERKEY_NAMEKEY,
                  new String[]{kMailResourceType, instanceName,
jndiName}));
      }

@@ -646,33 +682,28 @@
      getCustomResourceObjectName(String instanceName, String jndiName)
      {
          return ( getObjectName (kDefaultIASDomainName,
- new String[]{kTypeKeyName,
- kServerInstanceKeyName,
- kNameKeyName},
+ TYPEKEY_SERVERKEY_NAMEKEY,
                  new String[]{kCustomResourceType, instanceName,
jndiName}));
      }

      public static ObjectName getWebContainerObjectName(String
instanceName)
      {
          return ( getObjectName (kDefaultIASDomainName,
- new String[]{kTypeKeyName,
- kServerInstanceKeyName},
+ TYPEKEY_SERVERKEY,
                  new String[]{kWebContainer, instanceName}));
      }

      public static ObjectName getEjbContainerObjectName(String
instanceName)
      {
          return ( getObjectName (kDefaultIASDomainName,
- new String[]{kTypeKeyName,
- kServerInstanceKeyName},
+ TYPEKEY_SERVERKEY,
                  new String[]{kEjbContainer, instanceName}));
      }

      public static ObjectName getMdbContainerObjectName(String
instanceName)
      {
          return ( getObjectName (kDefaultIASDomainName,
- new String[]{kTypeKeyName,
- kServerInstanceKeyName},
+ TYPEKEY_SERVERKEY,
                  new String[]{kMdbContainer, instanceName}));
      }

@@ -687,24 +718,21 @@
      public static ObjectName getJTSComponentObjectName(String
instanceName)
      {
          return ( getObjectName (kDefaultIASDomainName,
- new String[]{kTypeKeyName,
- kServerInstanceKeyName},
+ TYPEKEY_SERVERKEY,
                  new String[]{kJtsComponent, instanceName}));
      }

      public static ObjectName getLogServiceObjectName(String
instanceName)
      {
          return ( getObjectName (kDefaultIASDomainName,
- new String[]{kTypeKeyName,
- kServerInstanceKeyName},
+ TYPEKEY_SERVERKEY,
                  new String[]{kLogService, instanceName}));
      }

      public static ObjectName getSecurityServiceObjectName(String
instanceName)
      {
          return ( getObjectName (kDefaultIASDomainName,
- new String[]{kTypeKeyName,
- kServerInstanceKeyName},
+ TYPEKEY_SERVERKEY,
                  new String[]{kSecurityServiceType, instanceName}));
      }

@@ -732,7 +760,7 @@
      public static ObjectName getHttpServiceObjectName(String
instanceName)
      {
          return ( getObjectName (kDefaultIASDomainName,
- new String[]{kTypeKeyName, kServerInstanceKeyName},
+ TYPEKEY_SERVERKEY,
                  new String[]{kHTTPServiceType, instanceName}));
      }

@@ -875,7 +903,7 @@
      public static ObjectName getProfilerObjectName(String
instanceName)
      {
          return ( getObjectName (kDefaultIASDomainName,
- new String[]{kTypeKeyName, kServerInstanceKeyName},
+ TYPEKEY_SERVERKEY,
                  new String[]{kProfiler, instanceName}));
      }



cvs server: Diffing appserv-core/src/java/com/sun/enterprise/admin/
server/core
Index: appserv-core/src/java/com/sun/enterprise/admin/server/core/
AdminService.java
===================================================================
RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/
admin/server/core/AdminService.java,v
retrieving revision 1.17
diff -w -u -r1.17 AdminService.java
--- appserv-core/src/java/com/sun/enterprise/admin/server/core/
AdminService.java 19 Dec 2006 16:30:14 -0000 1.17
+++ appserv-core/src/java/com/sun/enterprise/admin/server/core/
AdminService.java 5 Jan 2007 20:19:43 -0000
@@ -28,13 +28,10 @@
  import java.io.File;
  import java.util.Properties;

-//JMX imports
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-//admin imports
+import javax.management.*;
+
  import com.sun.enterprise.admin.common.MBeanServerFactory;
-import com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor;
+import com.sun.enterprise.admin.server.core.jmx.FlushConfigHook;

  import com.sun.enterprise.admin.event.AdminEventListenerRegistry;
  import com.sun.enterprise.admin.event.AdminEventListener;
@@ -86,7 +83,6 @@
  import com.sun.enterprise.admin.AdminContext;
  import com.sun.enterprise.admin.meta.MBeanRegistry;
  import com.sun.enterprise.admin.meta.MBeanRegistryFactory;
-import
com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerFactory;
  import com.sun.enterprise.admin.common.ObjectNames;
  import com.sun.enterprise.admin.server.core.channel.RRStateFactory;

@@ -97,11 +93,32 @@
  import com.sun.enterprise.admin.monitor.callflow.Agent;
  import com.sun.enterprise.admin.monitor.callflow.AgentAdapter;

+//import
com.sun.enterprise.admin.server.core.jmx.storage.PersistenceChecker;
+import
com.sun.enterprise.admin.server.core.jmx.storage.MBeanManufacturer;
+
+import com.sun.enterprise.util.FeatureAvailability;
+import com.sun.appserv.management.util.misc.RunnableBase;
+import com.sun.enterprise.interceptor.DynamicInterceptor;
+
+import com.sun.appserv.management.helper.AMXDebugHelper;
+import com.sun.appserv.management.util.jmx.JMXUtil;
+import com.sun.appserv.management.util.misc.PrintMillis;
+
+import com.sun.appserv.management.base.SystemInfo;
+import com.sun.appserv.management.client.ProxyFactory;
+
+
  /**
   * Admin service is a singleton in every instance and acts as
gateway to server
   * administration tasks.
   */
  public class AdminService {
+ private static final AMXDebugHelper sDebug = new AMXDebugHelper
( "__AdminService__" );
+ private void debug( final Object... args ) { sDebug.println
(args); }
+
+ public static final String PRIVATE_MBEAN_DOMAIN_NAME =
ObjectNames.kDefaultIASDomainName;
+
+ public static final String CALL_FLOW_AGENT_FEATURE =
"CallFlowAgent";

      /**
       * Admin service type DASD. Used to identify admin service in a
server
@@ -147,51 +164,31 @@
      /** default administrative domain name */
      private static final String
DEF_ADMIN_DOMAIN_NAME="com.sun.appserv.server";

+ /* The temporary directory name should be a function of domain
name,
+ * admin-server id and the install root, otherwise it won't
+ * work for the multiple installations on the same machine. */
      private static String kTempDirNamePrefix = "s1astemp";
      private static String kGUITempDirName = "gui";
      private static String kTempDirNameSuffix =
              "" + ((System.getProperty(Constants.IAS_ROOT) != null) ?
              System.getProperty(Constants.IAS_ROOT).hashCode() : 0);
- /* The temporary directory name should be a function of domain
name,
- * admin-server id and the install root, otherwise it won't
- * work for the multiple installations on the same machine. */
- private static int sMBeanServerID;
- public static final int kDefaultImpl = 0;
- private static final String SS_MBEAN_CLASS =
"com.sun.enterprise.admin.mbeans.SystemServicesMBean";
+
      private String adminServiceType;
      private ServerContext context;
- private AdminContext adminContext;
- private ServerLifecycle adminChannel;
+ private volatile AdminContext mAdminContext;
+ private volatile ServerLifecycle adminChannel;
      private String mTempDirPath;
      private String mGUITempDirPath;
      private AutoDeployController autoDeployController;

- /** A field to denote the default name for all the config and
runtime mbeans that are
- * generated from the meta-information (descriptor, like admin-
mbean-descriptor.xml) */
- public static final String PRIVATE_MBEAN_DOMAIN_NAME =
"com.sun.appserv";
- public static final String DAS_DIAGNOSTIC_MBEAN_CLASS_NAME =
- "com.sun.enterprise.admin.mbeans.DomainDiagnostics";

+ public AdminContext getAdminContext() { return mAdminContext; }

      /**
       * private constructor. AdminService instance should be
initialized
       * through package method createAdminService().
       */
      private AdminService() {
- sMBeanServerID = kDefaultImpl; //the only implementation for
now
-
- preloadAMXTypeInfos();
- }
-
- private static void preloadAMXTypeInfos() {
- try {
- final Class c = Class.forName
( "com.sun.enterprise.management.support.TypeInfos" );
- final java.lang.reflect.Method m = c.getMethod
( "preload", (Class[])null );
- m.invoke( (Object[])null );
- }
- catch( Exception e ) {
- throw new Error( e );
- }
      }

      /**
@@ -263,6 +260,13 @@
          return adminService;
      }

+ private RunnableBase _adminChannelIniter = null;
+ private RunnableBase _callflowAndJKSIniter = null;
+ private ComSunAppservConfigMBeansIniter _configMBeansIniter = null;
+
+ private static int SUBMIT_TYPE = RunnableBase.SUBMIT_ASYNC;
+ private static boolean FORCE_FINISH_METHOD = true;
+
      /**
       * Initialize admin service. This is called just after creating
the
       * instance and before any public methods are called on admin
service.
@@ -279,29 +283,40 @@
              // remove restart required state file when starting up DAS
              RRStateFactory.removeStateFile();
          }
+ // initialize AdminChannel
+ _adminChannelIniter = new RunnableBase( "AdminService
_adminChannelIniter") {
+ protected void doRun() throws Exception {
          adminChannel = new AdminChannelLifecycle();
          adminChannel.onInitialization(context);
+ }
+ };
+ _adminChannelIniter.submit( SUBMIT_TYPE );

- MBeanServer mbs = null;
+
+ FeatureAvailability.getInstance().waitForFeature
( FeatureAvailability.MBEAN_SERVER_FEATURE, "AdminService.init" );
+ final MBeanServer mbs = getMBeanServer();

          try {
- if (sMBeanServerID == kDefaultImpl) {
- SunoneInterceptor.setAdminContext(adminContext);
- mbs = SunoneInterceptor.getMBeanServerInstance();
- MBeanServerFactory.initialize(this, mbs);
- } else {
- throw new RuntimeException(localStrings.getString(
- "admin.server.core.mbs_init_error"));
- }
- if (adminContext != null) {
- adminContext.setMBeanServer(mbs);
- }
- sLogger.log(Level.INFO, "core.mbs_init_ok");
+ mAdminContext.setMBeanServer( mbs );
+ final FlushConfigHook hook = new FlushConfigHook
( mAdminContext );
+ ((DynamicInterceptor)mbs).addHook( "com.sun.appserv",
hook );
+ sLogger.info( "core.mbs_init_ok");
+ debug( ">>>>>>>>>>>>>>>>>>>>> Loaded FlushConfigHook
<<<<<<<<<<<<<<<<<<<<<" );
+
+ // initialize com.sun.appserv:category=config MBeans
+ _configMBeansIniter = new ComSunAppservConfigMBeansIniter(
+ "com.sun.appserv", getMBeanServer(), getAdminContext
() );
+ _configMBeansIniter.submit( SUBMIT_TYPE ); // it will
call FeatureAvailability.registerFeature() when ready.
+
+ // initialize CallFlow
+ _callflowAndJKSIniter = new RunnableBase( "Admin
Service _callflowAndJKSIniter" ) {
+ protected void doRun() throws Exception {
             initCallFlow();
-
- //initialize JKS properties.
              setupJKS();
          }
+ };
+ _callflowAndJKSIniter.submit( SUBMIT_TYPE );
+ }
          catch (Throwable t) {
              sLogger.log(Level.FINEST, t.getMessage(), t);
              if (isDas()) {
@@ -334,6 +349,7 @@
                       
"com.sun.enterprise.admin.monitor.callflow.AgentImpl");
              Agent agent = (Agent) cl.newInstance();
              Switch.getSwitch().setCallFlowAgent(agent);
+ FeatureAvailability.getInstance().registerFeature
( CALL_FLOW_AGENT_FEATURE, agent );
          } catch (Throwable t) {
              sLogger.log(Level.SEVERE,
"core.callflow_agent_init_failed", t);
              Switch.getSwitch().setCallFlowAgent(new AgentAdapter());
@@ -346,22 +362,33 @@
       * receive public method calls.
       */
      void start() throws ServerLifecycleException {
- com.sun.enterprise.ManagementObjectManager mgmtObjManager =
com.sun.enterprise.Switch.getSwitch().getManagementObjectManager();
+ final com.sun.enterprise.ManagementObjectManager
mgmtObjManager =
+ com.sun.enterprise.Switch.getSwitch
().getManagementObjectManager();
+
          if (isDas()) {
              startAdminInstance();
              mgmtObjManager.registerJ2EEDomain();
          }

+ final RunnableBase loadAMX = new RunnableBase
( "AdminService loadAMX" ){
+ protected void doRun() throws Exception {
          initializeAMXMBeans( isDas() );
+ }
+ };
+ loadAMX.submit( SUBMIT_TYPE );
+
+ final RunnableBase otherStuff = new RunnableBase
( "AdminService otherStuff" ) {
+ protected void doRun() throws Exception {
+
+ registerOtherMBeans();
+
+ FeatureAvailability.getInstance().waitForFeature(
+ FeatureAvailability.AMX_BOOT_UTIL_FEATURE,
"AdminService.start" );

- // Register JVM and J2EEServer managed objects
          mgmtObjManager.registerJVM();
          mgmtObjManager.registerJ2EEServer();

          if (isDas()) {
- // das j2ee server should have been registered prior to this
- // so
- // mgmtObjManager.registerJ2EEServer() should run before
this
              mgmtObjManager.registerDasJ2EEServers();
              mgmtObjManager.registerAllJ2EEClusters();
         }
@@ -370,7 +397,6 @@
              startNormalInstance();
          }

-
          initializePerInstanceSystemService();
          //This code initializes dotted names by enumerating
          // all objectnames using domain.xml
@@ -382,7 +408,9 @@
          WsUtil.start();
          // register DASDiagnosticMBean
          createDASDiagnosticMBean();
-
+ }
+ };
+ otherStuff.submit( SUBMIT_TYPE );
      }

      /**
@@ -393,9 +421,10 @@
             //check and start autodeploy service -FIX for 4933846
             startAutoDeployService();
          }
- if (adminChannel != null) {
+
+ _adminChannelIniter.waitDoneThrow();
              adminChannel.onReady(context);
- }
+
          initiateCustomMBeanLoading();
          registerJVMMonitoringMBeans();

@@ -451,13 +480,6 @@
      }

      /**
- * Get admin context.
- */
- public AdminContext getAdminContext() {
- return adminContext;
- }
-
- /**
       * Returns the administrative domain name for this server. If
       * administrative domain name property is not defined,
       * DEF_ADMIN_DOMAIN_NAME is returned.
@@ -466,8 +488,8 @@
       */
      public String getAdministrativeDomainName() throws
ConfigException {

- String serverName = adminContext.getServerName();
- ConfigContext ctx = adminContext.getAdminConfigContext();
+ String serverName = getAdminContext().getServerName();
+ ConfigContext ctx = getAdminContext().getAdminConfigContext();
          String aDomainName =
              ServerHelper.getAdministrativeDomainName(ctx, serverName);

@@ -484,13 +506,16 @@
       * Set admin context.
       */
      protected void setAdminContext(AdminContext ctx) {
- adminContext = ctx;
+ mAdminContext = ctx;
      }

      /**
       * Get name of server instance.
       */
      public String getInstanceName() {
+ if ( context == null ) {
+ throw new IllegalStateException
( "AdminService.getInstanceName" );
+ }
          return ((context == null) ? null : context.getInstanceName());
      }

@@ -834,7 +859,7 @@
      private void registerTransactionsRecoveryEventMBean() {
          try {
              MBeanRegistryFactory.getAdminMBeanRegistry
().instantiateMBean(
- "transactions-recovery", new String[]
{adminContext.getDomainName()}, null, null, true );
+ "transactions-recovery", new String[]
{getAdminContext().getDomainName()}, null, null, true );
          } catch (Throwable t) {
              sLogger.log(Level.FINE,
"core.transactions_recovery_mbean_register_error", t);
          }
@@ -848,11 +873,9 @@
      }

      private void registerLogManagerMBean() {
- MBeanServer mbs = adminContext.getMBeanServer();
          try {
- Object mbean =
-
com.sun.enterprise.server.logging.LogMBean.getInstance();
- mbs.registerMBean(mbean, getLogManagerMBeanName());
+ final Object mbean =
com.sun.enterprise.server.logging.LogMBean.getInstance();
+ getMBeanServer().registerMBean(mbean,
getLogManagerMBeanName());
          } catch (Throwable t) {
              sLogger.log(Level.WARNING,
"core.logmgr_mbean_not_registered");
              sLogger.log(Level.FINE,
"core.logmgr_mbean_register_error", t);
@@ -862,10 +885,10 @@
      private ObjectName getLogManagerMBeanName()
              throws MalformedObjectNameException {
          Properties props = new Properties();
- props.put("server", adminContext.getServerName());
+ props.put("server", getAdminContext().getServerName());
          props.put("category", "runtime");
          props.put("name", "logmanager");
- ObjectName on = new ObjectName(adminContext.getDomainName(),
props);
+ ObjectName on = new ObjectName( getAdminContext
().getDomainName(), props);
          return on;
      }

@@ -888,13 +911,13 @@
       * <li> download of stubs in case of DAS </li>
       * <li> synchronization in case of non DAS instances </li>.
       */
+ private static final String SS_MBEAN_CLASS =
"com.sun.enterprise.admin.mbeans.SystemServicesMBean";
      private void initializePerInstanceSystemService() throws
ServerLifecycleException {
- ObjectName on = null;
          try {
- final MBeanServer mbs = getMBeanServer();
- on = ObjectNames.getPerInstanceSystemServicesObjectName
(this.getInstanceName());
+ final ObjectName on =
ObjectNames.getPerInstanceSystemServicesObjectName
(this.getInstanceName());
              final Object impl = Class.forName
(SS_MBEAN_CLASS).newInstance();
- mbs.registerMBean(impl, on);
+ getMBeanServer().registerMBean(impl, on);
+ debug( "initializePerInstanceSystemService: " +
impl.getClass().getName() + " as" + on);
              sLogger.finer("Admin Message: System Services MBean
Registered with on: " + on.toString());
          }
          catch (final Exception e) {
@@ -919,12 +942,12 @@
          Initializes AMX MBeans
          Uses Class.forName() due to build-order issues.
       */
- private void initializeAMXMBeans( boolean isDAS ) {
+ private void initializeAMXMBeans( boolean isDas ) {
          try {
              // can't 'import' it because it's in the admin module,
which
              // compiles after the module this file is in.
              final String loaderClassname =
- isDAS ? AMX_DAS_LOADER_CLASSNAME :
AMX_NON_DAS_LOADER_CLASSNAME;
+ isDas ? AMX_DAS_LOADER_CLASSNAME :
AMX_NON_DAS_LOADER_CLASSNAME;

              final Class loaderClass = Class.forName
( loaderClassname );
              final Object loader = loaderClass.newInstance();
@@ -933,6 +956,9 @@
              mAMXLoaderObjectName =
                  getMBeanServer().registerMBean( loader,
tempObjectName ).getObjectName();

+ FeatureAvailability.getInstance().registerFeature(
+ FeatureAvailability.AMX_LOADER_FEATURE,
loaderClassname );
+
              sLogger.log(Level.INFO, "mbean.init_amx_success");
          }
          catch(Exception e) {
@@ -945,12 +971,7 @@

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


@@ -960,40 +981,109 @@
       */
      private void notifyAMXThatAdminServiceIsReady() {
          try {
+ FeatureAvailability.getInstance().waitForFeature(
+ FeatureAvailability.AMX_LOADER_FEATURE,
"notifyAMXThatAdminServiceIsReady" );
+
              getMBeanServer().invoke( mAMXLoaderObjectName,
"adminServiceReady", null, null );
          }
          catch( Exception e ) {
+ e.printStackTrace();
              throw new RuntimeException( e );
          }
      }

+ private Object manufactureMBean(final ObjectName oName) throws
InstanceNotFoundException
+ {
+ // final PersistenceChecker checker = new
PersistenceChecker( getAdminContext() );
+ // final Object storedObject =
checker.findElement(oName);
+ Object match = null;
+ //if (storedObject != null)
+ {
+ final MBeanManufacturer producer = new MBeanManufacturer
(oName, null);
+ producer.setAdminContext( getAdminContext() );
+ match = producer.createMBeanInstance();
+ }
+ //else
+ //{
+ //this is severe - storage is not in sync with whatever
is requested to be done.
+ //sLogger.log(Level.FINEST, "core.not_in_config", oName);
+ // }
+
+ return ( match );
+ }
+
+ private boolean
+ supportsMultipleServers()
+ {
+ final ObjectName systemInfoObjectName = (ObjectName)
+ FeatureAvailability.getInstance().waitForFeature(
+ FeatureAvailability.SYSTEM_INFO_FEATURE,
"AdminService.supportsMultipleServers" );
+
+ debug
( "*********************************************************************
*************************************** GOT SYSTEM INFO" );
+
+ final SystemInfo systemInfo = (SystemInfo)
+ MBeanServerInvocationHandler.newProxyInstance(
+ getMBeanServer(), systemInfoObjectName,
SystemInfo.class, false );
+
+ return systemInfo.supportsFeature
( SystemInfo.MULTIPLE_SERVERS_FEATURE );
+ }
+
+ private void
+ registerOtherMBeans()
+ throws ServerLifecycleException
+ {
+ try
+ {
+ if ( isDas() && supportsMultipleServers() )
+ {
+ final ObjectName sync =
ObjectNames.getSynchronizationObjectName();
+ final Object mbean = manufactureMBean( sync );
+ getMBeanServer().registerMBean( mbean, sync );
+ }
+
+ final ObjectName on = JMXUtil.newObjectName
( ObjectNames.kDefaultIASDomainName,
+ "type=DomainDiagnostics,name=" + getInstanceName() +
",category=monitor");
+ final Class cl = Class.forName
( DAS_DIAGNOSTIC_MBEAN_CLASS_NAME );
+ getMBeanServer().registerMBean( cl.newInstance(), on);
+ }
+ catch( Exception e )
+ {
+ throw new ServerLifecycleException(e);
+ }
+ }
+
+
+ public final ClassLoader
+ getClassLoaderFor( final ObjectName objectName)
+ throws InstanceNotFoundException
+ {
+ debug( "DynamicInterceptor.getClassLoaderFor: ", objectName );
+ return getMBeanServer().getClassLoaderFor(objectName);
+ }
+

      private void initiateCustomMBeanLoading() throws
ServerLifecycleException {
          try {
- final MBeanServer mbs = adminContext.getMBeanServer();
          final ConfigContext cc = context.getConfigContext();
- new CustomMBeanRegistrationHelper(mbs, cc).registerMBeans();
- } catch (final Exception e) {
+ new CustomMBeanRegistrationHelper( getMBeanServer(),
cc).registerMBeans();
+ }
+ catch (final Exception e) {
              e.printStackTrace();
              throw new ServerLifecycleException(e); // we must not
abort the startup, we must not affect other operations that may follow
          }
          initializeMBeanEventListeners();
      }

+
+ /** Name for all the config and runtime mbeans that are
+ * generated from the meta-information (descriptor, like admin-
mbean-descriptor.xml) */
+ public static final String DAS_DIAGNOSTIC_MBEAN_CLASS_NAME =
+ "com.sun.enterprise.admin.mbeans.DomainDiagnostics";
+
      // createDASDiagnosticMBean
- private void createDASDiagnosticMBean() {
- try {
- final MBeanServer mbs = getMBeanServer();
- ObjectName on = new ObjectName(
- PRIVATE_MBEAN_DOMAIN_NAME + ":" +
- "type=DomainDiagnostics,name=" + getInstanceName() +
",category=monitor");
- Class cl = Class.forName
(DAS_DIAGNOSTIC_MBEAN_CLASS_NAME);
- mbs.registerMBean(cl.newInstance(), on);
- } catch (Throwable t) {
- t.printStackTrace();
- sLogger.log(Level.INFO,
"core.das_diag__mbean_not_registered", t.getMessage());
- }
+ private void createDASDiagnosticMBean() throws
InstantiationException, ClassNotFoundException {
      }
+
      private void initializeMBeanEventListeners() {
          try {
              Class c = null; //Class for listener of
MBeanElementChange events
cvs server: appserv-core/src/java/com/sun/enterprise/admin/server/
core/ComSunAppservConfigMBeansIniter.java is a new entry, no
comparison available
Index: appserv-core/src/java/com/sun/enterprise/admin/server/core/
ConfigInterceptor.java
===================================================================
RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/
admin/server/core/ConfigInterceptor.java,v
retrieving revision 1.3
diff -w -u -r1.3 ConfigInterceptor.java
--- appserv-core/src/java/com/sun/enterprise/admin/server/core/
ConfigInterceptor.java 25 Dec 2005 04:14:20 -0000 1.3
+++ appserv-core/src/java/com/sun/enterprise/admin/server/core/
ConfigInterceptor.java 5 Jan 2007 20:19:43 -0000
@@ -64,7 +64,6 @@
   * Config interceptor for MBeans
   */
  public class ConfigInterceptor extends InterceptorImpl {
-
      private AdminContext adminContext;
      private Logger _logger;
      private static AuditManager auditManager =
@@ -90,8 +89,6 @@
       * Failure cases will be handled later
       */
      public void postInvoke(CallStack callStack) {
-
-
          if (callStack.getStackSize() == 1) {
              Call call = callStack.getActiveCall();
              if (call.getState().isSuccess() && isFlushNeeded(call)) {
@@ -109,9 +106,6 @@
                  new AdminNotificationHelper
(adminContext).sendNotification();
              }
          }
- auditInvocation(callStack.getActiveCall());
-
-
      }

      /**
@@ -147,7 +141,6 @@
      }

      public void preInvoke(CallStack callstack) {
-
          if (callstack.getStackSize() == 1) {
              EventStack stack = new EventStack();
              stack.setConfigContext
(adminContext.getAdminConfigContext());
@@ -155,252 +148,4 @@
          }

      }
-
-/*
- private void sendNotification() {
- ConfigContext context = adminContext.getAdminConfigContext();
- String instanceName = adminContext.getServerName();
- AdminEventCache cache =
- AdminEventCache.getInstance(instanceName);
- cache.setAdminConfigContext(context);
- ArrayList changeList = context.getConfigChangeList();
- context.resetConfigChangeList();
- ArrayList eventList = null;
- if (changeList.size() <= 0) {
- eventList = new ArrayList();
- // Return, no changes to process
- //return;
- }
- else
- {
- cache.processConfigChangeList(changeList, false, false);
- eventList = cache.getAndResetCachedEvents();
-
- //***********************************
- //ElementChange events
- try {
- ElementChangeHelper elementHelper = new
ElementChangeHelper(); //FIXME: need to put it as member
- AdminEvent[] elementChangeEvents =
elementHelper.generateElementChangeEventsFromChangeList(instanceName,
changeList, context);
- if(elementChangeEvents!=null)
- for(int i=0; i<elementChangeEvents.length; i++)
- eventList.add(elementChangeEvents[i]);
- } catch (Exception e) {
- // ignore
- }
- //***********************************
-
- }
- EventStack stack = EventContext.getEventStackFromThreadLocal();
- List newEventList = stack.getEvents();
- newEventList.addAll(eventList);
-
- boolean requiresRestart = false;
-
- Iterator iter = newEventList.iterator();
- while (iter.hasNext()) {
- AdminEvent event = (AdminEvent)iter.next();
- if (_logger.isLoggable(Level.FINEST)) {
- _logger.log(Level.FINEST, "mbean.event_sent",
- event.getEventInfo());
- } else {
- _logger.log(Level.INFO, "mbean.send_event",
event.toString());
- }
- AdminEventResult
result=AdminEventMulticaster.multicastEvent(event);
- _logger.log(Level.FINE, "mbean.event_res",
result.getResultCode());
- _logger.log(Level.FINEST, "mbean.event_reply",
- result.getAllMessagesAsString());
- if (!AdminEventResult.SUCCESS.equals(result.getResultCode
())) {
- requiresRestart = true;
- cache.setRestartNeeded(true);
- // if there was an error in the listener, admin event
- // multicaster already sets the restart required to
true
- //_logger.log(Level.INFO, "mbean.notif_failed");
- _logger.log(Level.INFO, "mbean.event_result_error",
- result.getAllResultCodesAsString() );
- }
-
- }
- ServerContext svcCtx = ApplicationServer.getServerContext();
- PluggableFeatureFactory featureFactory = null;
- if (svcCtx != null) {
- featureFactory = svcCtx.getPluggableFeatureFactory();
-
- // see if there were any non reconfigurabled changes
- NotificationFactory nFactory =
- featureFactory.getNotificationFactory();
- RestartEventHelper helper =
nFactory.createRestartEventHelper();
- helper.setRestartRequiredForTarget(context, changeList);
-
- }
- return;
- }
-*/
-
-
- //
************************************************************************
*****
- /*
- * ADMIN AUDIT FOR CALL
- */
- private void auditInvocation(Call call)
- {
- if(auditManager.isAuditOn())
- {
- if (/*auditManager.isAuditOn() &&*/ isAuditable(call)){
- SecurityContext sc = SecurityContext.getCurrent();
-//XXX remove audit API
-/*
- auditManager.adminInvocation(
- sc.getCallerPrincipal().getName(), //caller
- sc.getSubject(), //subject
- auditManager.getRemoteHost(), // host
- getObjectNameForCall(call),//ObjectName
- getOperationName(call), //operation name
- "JMXLocal", //mode JMXLocal,JMXRemote-
http,JMXRemote-rmi,JMXRemote-jmxmp
- getAuditedParamsString(call),
- call.getState().isSuccess());
-*/
-/*
-System.out.println(
-"\nCaller: "+sc.getCallerPrincipal().getName() +
-"\nSubject: "+ sc.getSubject() +
-"\nHost: "+ auditManager.getRemoteHost() +
-"\nObjectName: "+ getObjectNameForCall(call)+
-"\nOperation: "+ getOperationName(call)+
-"\nParams: "+ getAuditedParamsString(call)+
-"\nSuccess: "+ call.getState().isSuccess() );
-*/
- }
- }
- }
- /**
- * check call using method name/params/objectname
- * - whether it auditable or not
- */
- private boolean isAuditable(Call call) {
- if(call==null)
- return false;
- String methodName = call.getMethod().getName();
- if( !methodName.equals("setAttribute") &&
- !methodName.equals("setAttributes") &&
- !methodName.equals("invoke"))
- return false;
- if(methodName.equals("invoke"))
- {
- String opName = getOperationName(call);
- if(opName==null ||
- opName.startsWith("get") ||
- opName.startsWith("list") ||
- opName.startsWith("is") )
- return false;
- }
- String objectName = getObjectNameForCall(call);
- if(objectName==null || objectName.indexOf("category=config")<0)
- return false;
- return true;
- }
-
-
- /**
- * returns OperationName invoking in MBean
- */
- private String getOperationName(Call call) {
- if(call==null)
- return null;
- String methodName = call.getMethod().getName();
- if(methodName.equals("invoke"))
- {
- Object[] params = call.getArguments();
- if(params!=null && params.length>1 && (params[1]
instanceof String))
- methodName = (String)params[1];
- }
- return methodName;
- }
-
- /**
- * represents parameters of call in printable form fro audit module
- */
- private String getAuditedParamsString(Call call) {
- if(call==null)
- return null;
- Object[] params = call.getArguments();
- if(params==null)
- return null;
- int i=0;
- String methodName = call.getMethod().getName();
- if(methodName.equals("invoke"))
- {
- if(params.length>2)
- return paramToString(params[2]);
- }
- else
- if(methodName.equals("setAttribute") ||
- methodName.equals("setAttributes") )
- {
- if(params.length>1)
- return paramToString(params[1]);
- }
- return null;
- }
-
- /**
- * represents parameter of call in printable form fro audit module
- */
- private String paramToString(Object obj) {
- if(obj==null)
- return null;
- String res = null;
- if(obj instanceof Object[])
- {
- res = "{";
- for(int i=0; i<((Object[])obj).length; i++)
- res += paramToString(((Object[])obj)[i]) + ";";
- res += "}";
- }
- else if(obj instanceof ArrayList)
- {
- res = "{";
- for(int i=0; i<((ArrayList)obj).size(); i++)
- res += paramToString(((ArrayList)obj).get(i)) + ";";
- res += "}";
- }
- else if(obj instanceof Properties)
- {
- res = "{";
- Enumeration keys = ((Properties)obj).keys();
- while (keys.hasMoreElements())
- {
- final String key = (String)keys.nextElement();
- res += key + "=" + ((Properties)obj).get(key) + ";";
- }
- res += "}";
- }
- else if(obj instanceof Attribute)
- {
- res = ""+((Attribute)obj).getName()+"="+((Attribute)
obj).getValue();
- }
- else if(obj instanceof String ||
- obj instanceof Number ||
- obj instanceof ObjectName )
- {
- res = obj.toString();
- }
- else
- res = "<?>";
- return res;
- }
-
- /**
- * returns ObjectName of invoking MBean
- */
- private String getObjectNameForCall(Call call) {
- if(call==null)
- return null;
- Object[] params = call.getArguments();
- if( params==null ||
- params.length<1 ||
- !(params[0] instanceof ObjectName))
- return null;
- return params[0].toString();
- }
-
  }
cvs server: Diffing appserv-core/src/java/com/sun/enterprise/admin/
server/core/channel
cvs server: Diffing appserv-core/src/java/com/sun/enterprise/admin/
server/core/jmx
cvs server: appserv-core/src/java/com/sun/enterprise/admin/server/
core/jmx/AppServerMBeanServerBuilder.java was removed, no comparison
available
cvs server: appserv-core/src/java/com/sun/enterprise/admin/server/
core/jmx/AppServerMBeanServerFactory.java was removed, no comparison
available
Index: appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/
DomainRepository.java
===================================================================
RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/
admin/server/core/jmx/DomainRepository.java,v
retrieving revision 1.3
diff -w -u -r1.3 DomainRepository.java
--- appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/
DomainRepository.java 25 Dec 2005 04:14:24 -0000 1.3
+++ appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/
DomainRepository.java 5 Jan 2007 20:19:43 -0000
@@ -42,7 +42,7 @@
  import com.sun.enterprise.admin.common.ObjectNameHelper;
  import com.sun.enterprise.admin.common.CombinedPatternMatcher;
  import com.sun.enterprise.admin.util.IPatternMatcher;
-import
com.sun.enterprise.admin.server.core.jmx.storage.PersistenceChecker;
+//import
com.sun.enterprise.admin.server.core.jmx.storage.PersistenceChecker;
  import
com.sun.enterprise.admin.server.core.jmx.storage.MBeanManufacturer;

  /**
@@ -133,7 +133,7 @@
          @return MBean that is registered, null otherwise. In case
of the MBean
          that exists in both MBeanRepository and persistent store
simply the
          object in memory is returned.
- */
+ *
      public Object findPersistent(ObjectName objectName)
      {
          Object match = null, cachedMatch = null;
@@ -158,6 +158,7 @@
          //sLogger.info("*In find:INFO: match from store = " + match);
          return ( match );
      }
+ */

      /**
          Adds an Object in the repository. Neither Object nor the
ObjectName
@@ -385,7 +386,7 @@
          is null, it means that the MBean is not in cache.
          @return the object found, null, if there is no such Object
in persistent store.
      */
-
+/*
      private Object findInPersistentStore(ObjectName objectName, Object
              cachedObject)
      {
@@ -397,7 +398,7 @@
                 {
                         return cachedObject;
                 }
- PersistenceChecker checker = new
PersistenceChecker();
+ PersistenceChecker checker = new
PersistenceChecker(null);
          Object storedObject = null;
          try {
              storedObject = checker.findElement(objectName);
@@ -411,20 +412,20 @@
              if (cachedObject != null)
              {
                  //sLogger.info("*In findInPersistentStore: stored-
cached nonnull");
- /*
+ *
                      MBean is registered, cachedObject is in sync
with storedObject,
                      no need to do anything. Most of the times, this
is the case.
                      Hence simply return the cached object.
- */
+ *
                  match = cachedObject;
              }
              else
              {
- /*
+ *
                      We will have to construct the proper Object
                      and register it as MBean. Will be invoked: for the
                      first time any MBean is invoked.
- */
+ *
                                 MBeanManufacturer producer = new
MBeanManufacturer(objectName, storedObject);
                                 match = producer.createMBeanInstance();
                                 this.add(objectName, match);
@@ -438,7 +439,7 @@
              match = null; // if not found in persistent store, just
return null.
              if (cachedObject != null)
              {
- /* This means that the cached copy is stale and out
of sync, remove it */
+ * This means that the cached copy is stale and out
of sync, remove it *
                  this.remove(objectName);
                  //sLogger.info("*In findInPersistentStore: stored
is null, "
                  // + "cached is non-null, removed it");
@@ -447,11 +448,12 @@
              {
                  //sLogger.info("*In findInPersistentStore: stored
is null, "
                  // + "cached is null, no prob");
- /* do nothing, as persistent store does not
- have it and the cached store also does not have it */
+ //* do nothing, as persistent store does not
+ // have it and the cached store also does not have it
              }
          }
          //Now return the stored object, be it null or non-null.
          return ( match );
      }
+ */
  }
Index: appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/
IRepository.java
===================================================================
RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/
admin/server/core/jmx/IRepository.java,v
retrieving revision 1.3
diff -w -u -r1.3 IRepository.java
--- appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/
IRepository.java 25 Dec 2005 04:14:24 -0000 1.3
+++ appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/
IRepository.java 5 Jan 2007 20:19:43 -0000
@@ -90,7 +90,7 @@
          that exists in both MBeanRepository and persistent store
simply the
          object in memory is returned.
      */
- public Object findPersistent(ObjectName objectName);
+ //public Object findPersistent(ObjectName objectName);

      /**
                 Returns the number of Objects stored in the
repository for
cvs server: appserv-core/src/java/com/sun/enterprise/admin/server/
core/jmx/SunoneInterceptor.java was removed, no comparison available

Index: appserv-core/src/java/com/sun/enterprise/deployment/client/
DeploymentClientUtils.java
===================================================================
RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/
deployment/client/DeploymentClientUtils.java,v
retrieving revision 1.13
diff -w -u -r1.13 DeploymentClientUtils.java
--- appserv-core/src/java/com/sun/enterprise/deployment/client/
DeploymentClientUtils.java 4 Dec 2006 20:38:23 -0000 1.13
+++ appserv-core/src/java/com/sun/enterprise/deployment/client/
DeploymentClientUtils.java 5 Jan 2007 20:19:43 -0000
@@ -52,12 +52,11 @@
  import javax.management.MBeanServerConnection;
  import javax.management.ObjectName;

+import com.sun.enterprise.admin.common.ObjectNames;
+
  public class DeploymentClientUtils {

- private static final String APPS_CONFIG_MBEAN =
- "com.sun.appserv:type=applications,category=config";
- private static ObjectName applicationsMBean =
- JMXUtil.newObjectName(APPS_CONFIG_MBEAN);
+ private static ObjectName applicationsMBean =
ObjectNames.getApplicationsConfigObjectName();

      public static final String mapModuleTypeToXType(ModuleType
moduleType) {
          if (ModuleType.EAR.equals(moduleType)) {
cvs server: Diffing appserv-core/src/java/com/sun/enterprise/
deployment/client/local
cvs server: Diffing appserv-core/src/java/com/sun/enterprise/
diagnostics/collect
Index: appserv-core/src/java/com/sun/enterprise/diagnostics/collect/
MonitoringInfoCollector.java
===================================================================
RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/
diagnostics/collect/MonitoringInfoCollector.java,v
retrieving revision 1.4
diff -w -u -r1.4 MonitoringInfoCollector.java
--- appserv-core/src/java/com/sun/enterprise/diagnostics/collect/
MonitoringInfoCollector.java 25 Dec 2005 04:15:28 -0000 1.4
+++ appserv-core/src/java/com/sun/enterprise/diagnostics/collect/
MonitoringInfoCollector.java 5 Jan 2007 20:19:43 -0000
@@ -27,9 +27,9 @@
  import com.sun.enterprise.diagnostics.DiagnosticException;
  import com.sun.enterprise.diagnostics.Defaults;
  import com.sun.enterprise.diagnostics.Constants;
-import
com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerFactory;
  import com.sun.logging.LogDomains;

+import com.sun.enterprise.util.FeatureAvailability;

  import javax.management.*;
  import java.util.*;
@@ -178,8 +178,7 @@

                      ArrayList<String> list = getIndividualProperties
(cmdOutput);

- MBeanServer mbs = AppServerMBeanServerFactory.
- getMBeanServerInstance();
+ final MBeanServer mbs =
FeatureAvailability.getInstance().getMBeanServer();

                      final String[] types = new String[]
{String.class.getName()};

Index: appserv-core/src/java/com/sun/enterprise/diagnostics/collect/
MonitoringInfoHelper.java
===================================================================
RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/
diagnostics/collect/MonitoringInfoHelper.java,v
retrieving revision 1.2
diff -w -u -r1.2 MonitoringInfoHelper.java
--- appserv-core/src/java/com/sun/enterprise/diagnostics/collect/
MonitoringInfoHelper.java 25 Dec 2005 04:15:28 -0000 1.2
+++ appserv-core/src/java/com/sun/enterprise/diagnostics/collect/
MonitoringInfoHelper.java 5 Jan 2007 20:19:43 -0000
@@ -26,12 +26,12 @@

  import com.sun.enterprise.admin.util.ClassUtil;
  import com.sun.enterprise.admin.util.ArrayConversion;
-import
com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerFactory;
  import com.sun.enterprise.admin.server.core.jmx.InitException;

  import com.sun.enterprise.diagnostics.DiagnosticException;
  import com.sun.logging.LogDomains;

+import com.sun.enterprise.util.FeatureAvailability;
  import javax.management.*;


@@ -185,8 +185,7 @@

          try {

- MBeanServer mbs = AppServerMBeanServerFactory.
- getMBeanServerInstance();
+ final MBeanServer mbs = FeatureAvailability.getInstance
().getMBeanServer();
              // we always invoke with an array, and so the
              // result is always an Object []
              final Object[] returnValues = (Object[]) mbs.
cvs server: Diffing appserv-core/src/java/com/sun/enterprise/
diagnostics/report


cvs server: Diffing appserv-core/src/java/com/sun/enterprise/server
Index: appserv-core/src/java/com/sun/enterprise/server/PELaunch.java
===================================================================
RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/
server/PELaunch.java,v
retrieving revision 1.16
diff -w -u -r1.16 PELaunch.java
--- appserv-core/src/java/com/sun/enterprise/server/
PELaunch.java 8 Mar 2006 09:25:09 -0000 1.16
+++ appserv-core/src/java/com/sun/enterprise/server/
PELaunch.java 5 Jan 2007 20:19:43 -0000
@@ -59,6 +59,8 @@
   */

  public class PELaunch {
+ private static final long START_TIME_MILLIS =
System.currentTimeMillis();
+ public static long getStartTimeMillis() { return
START_TIME_MILLIS; }

      //The new ClassLoader Hierarchy would be enabled only when this
system
      //property is set.
Index: appserv-core/src/java/com/sun/enterprise/server/PEMain.java
===================================================================
RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/
server/PEMain.java,v
retrieving revision 1.10
diff -w -u -r1.10 PEMain.java
--- appserv-core/src/java/com/sun/enterprise/server/PEMain.java 13
Nov 2006 20:04:43 -0000 1.10
+++ appserv-core/src/java/com/sun/enterprise/server/PEMain.java 5 Jan
2007 20:19:43 -0000
@@ -66,25 +66,36 @@
  import com.sun.enterprise.server.ss.ASLazyKernel;
  import com.sun.enterprise.admin.server.core.channel.RRStateFactory;

-/**kebbs**/
- import com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor;

   import com.sun.enterprise.server.ondemand.OnDemandServer;

  import com.sun.enterprise.security.audit.AuditManager;
  import com.sun.enterprise.security.audit.AuditManagerFactory;

+import com.sun.appserv.management.helper.AMXDebugHelper;
+
+import javax.management.MBeanServer;
+import com.sun.enterprise.interceptor.DynamicInterceptor;
+import com.sun.enterprise.util.FeatureAvailability;
+import com.sun.appserv.management.util.misc.RunnableBase;
+
+import com.sun.enterprise.management.support.SystemInfoData;
+
  /**
    * Start up class for PE/RI
    */

-public class PEMain {
+public final class PEMain {
+ 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();
      }

+ private static final AMXDebugHelper _Debug = new AMXDebugHelper
( "PEMain" );
+
      //------------------------------------------------------------
Constructor

      /**
@@ -144,10 +155,79 @@
          return _logger;
      }

+ static private final String BUILDER_SYSTEM_PROPERTY =
"javax.management.builder.initial";
+ static private final String MBEAN_SERVER_BUILDER =
+ "com.sun.enterprise.interceptor.InterceptorMBeanServerBuilder";
+
+ private static final class MBeanServerIniter extends RunnableBase {
+ MBeanServerIniter()
+ {
+ final String builder = System.getProperty
( BUILDER_SYSTEM_PROPERTY );
+ if ( ! builder.equals( MBEAN_SERVER_BUILDER ) )
+ {
+ throw new Error( "initializeMBeanServer: incorrect
MBeanServer was specified--" +
+ builder + ", should be " + MBEAN_SERVER_BUILDER);
+ }
+ }
+
+ protected void doRun() {
+ final long start = System.currentTimeMillis();
+
+ final MBeanServer server =
java.lang.management.ManagementFactory.getPlatformMBeanServer();
+
+ if ( ! (server instanceof DynamicInterceptor) ) {
+ // Logging should not be used for this; it has not
even been initialized yet
+ // this message indicates a development bug and so
doesn't need I18N
+ final String msg = "initializeMBeanServer: incorrect
MBeanServer created: " +
+ server.getClass().getName() + ", should be " +
MBEAN_SERVER_BUILDER;
+ System.err.println( msg );
+ throw new Error( msg );
+ }
+ FeatureAvailability.getInstance().registerFeature(
+ FeatureAvailability.MBEAN_SERVER_FEATURE, server );
+
+ final long elapsed = System.currentTimeMillis() - start;
+ _Debug.println( "MBeanServer created successfully in "
+ elapsed + "ms");
+ }
+ };
+
+ /**
+ Thread into which canb be inserted any code that can be run
threaded to pre-initialize
+ anything that <b>will</b> be needed during server startup.
+ */
+ private static final class Preloader extends RunnableBase {
+ Preloader() {
+ }
+
+ private void preloadAMXTypeInfos() {
+ try {
+ final Class c = Class.forName
( "com.sun.enterprise.management.support.TypeInfos" );
+ final java.lang.reflect.Method m = c.getMethod
( "preload", (Class[])null );
+ m.invoke( (Object[])null );
+ }
+ catch( Exception e ) {
+ throw new Error( e );
+ }
+ }
+
+ protected void doRun() {
+ final long start = System.currentTimeMillis();
+
+ preloadAMXTypeInfos();
+
+ final long elapsed = System.currentTimeMillis() - start;
+ _Debug.println( "Preload " + elapsed + "ms");
+ }
+ };
+
+
      // ---------------------------------------------------------
Public Methods

      public static void main(String[] args) {
-
+ final MBeanServerIniter initer = new MBeanServerIniter();
+ initer.submit();
+ final Preloader preloader = new Preloader();
+ preloader.submit();

         // parse args
         boolean verbose = false;
@@ -259,6 +339,12 @@

             peMain.run(System.getProperty(Constants.IAS_ROOT));

+ final long now = System.currentTimeMillis();
+ final long pemainMillis = now - getStartTimeMillis();
+ final long pelaunchMillis = now -
PELaunch.getStartTimeMillis();
+ SystemInfoData.getInstance().addPerformanceMillis
( "PEMain.startup", pemainMillis );
+ SystemInfoData.getInstance().addPerformanceMillis
( "PELaunch.startup", pelaunchMillis );
+
              getLogger().log(Level.INFO, "pemain.startup.complete");

          if (auditManager.isAuditOn()){
@@ -298,12 +384,11 @@

         try {
             context = createServerContext(rootDir);
-
         } catch (ConfigException ce) {
              getLogger().log(Level.SEVERE,
"j2eerunner.cannotCreateServerContext",ce);
+ throw new Error( ce );
          }

-
         // Set up to route System.Out & err thru log formatter
         new SystemOutandErrHandler();

@@ -327,14 +412,6 @@

              _server.onReady();

- //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);
- } catch (Exception ex) {
-
- }
-
          } catch (Exception ee) {
              getLogger().log(Level.SEVERE, "j2eerunner.initError", ee);
             getLogger().log(Level.SEVERE, "pemain.startup.failed");
@@ -464,11 +541,13 @@
          try{
              String serverXml = context.getServerConfigURL();
             // Read server.xml and create a read-only configuration
context
- ConfigContext cfgContext =
- ConfigFactory.createConfigContext(serverXml,
- true,
- false,
- true);
+ final boolean readOnly = true;
+ final boolean autoCommit = false;
+ final boolean cache = true;
+ final ConfigContext cfgContext =
ConfigFactory.createConfigContext(serverXml,
+ readOnly,
+ autoCommit,
+ cache);
             context.setConfigContext(cfgContext);
         } catch (Exception ex){

@@ -485,6 +564,7 @@
          PluggableFeatureFactory ff =
PluggableFeatureFactoryImpl.getFactory();

          context.setPluggableFeatureFactory(ff);
+
          return context;
      }

Index: appserv-core/src/java/com/sun/enterprise/server/
SystemAppLifecycle.java
===================================================================
RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/
server/SystemAppLifecycle.java,v
retrieving revision 1.5
diff -w -u -r1.5 SystemAppLifecycle.java
--- appserv-core/src/java/com/sun/enterprise/server/
SystemAppLifecycle.java 26 Oct 2006 09:30:11 -0000 1.5
+++ appserv-core/src/java/com/sun/enterprise/server/
SystemAppLifecycle.java 5 Jan 2007 20:19:43 -0000
@@ -64,20 +64,6 @@
   * @author Sandhya E
   */
  public final class SystemAppLifecycle extends ApplicationLifecycle {
-
- /**
- * Right now this lifecycle is not registered as a lifecycle.
- * This method will be explicitly called from J2EE Server.
- * This method will call two lifecycle methods: onInit and
onStartup.
- * OnShutdown and onTermination need not be called as the required
- * task will be done ALC for now. This is a mockup startup method
- * which will take care of lifecycle methods till onStartup
- */
- public void startup(ServerContext sc) throws
ServerLifecycleException {
- onInitialization(sc);
- onStartup(sc);
- }
-
      /**
       * Server is starting up applications
       *
@@ -87,7 +73,6 @@
       * error that prevents this subsystem from being used
       */
      public void onStartup(ServerContext sc) throws
ServerLifecycleException {
-
          try {
              //deploys any new system apps
              deploySystemApps();

cvs server: Diffing appserv-core-ee/appserv-core/src/java/com/sun/
enterprise/ee/diagnostics/collect
Index: appserv-core-ee/appserv-core/src/java/com/sun/enterprise/ee/
diagnostics/collect/HadbInfoCollector.java
===================================================================
RCS file: /cvs/glassfish/appserv-core-ee/appserv-core/src/java/com/
sun/enterprise/ee/diagnostics/collect/HadbInfoCollector.java,v
retrieving revision 1.1.1.1
diff -w -u -r1.1.1.1 HadbInfoCollector.java
--- appserv-core-ee/appserv-core/src/java/com/sun/enterprise/ee/
diagnostics/collect/HadbInfoCollector.java 8 Aug 2006 19:48:22
-0000 1.1.1.1
+++ appserv-core-ee/appserv-core/src/java/com/sun/enterprise/ee/
diagnostics/collect/HadbInfoCollector.java 5 Jan 2007 20:19:43
-0000
@@ -35,9 +35,9 @@
  import com.sun.enterprise.config.ConfigException;
  import com.sun.enterprise.config.ConfigBean;
  import com.sun.enterprise.config.serverbeans.*;
-import
com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerFactory;
  import com.sun.enterprise.admin.server.core.jmx.InitException;
  import com.sun.logging.LogDomains;
+import com.sun.enterprise.util.FeatureAvailability;

  import java.io.*;
  import java.util.logging.Logger;
@@ -159,7 +159,8 @@
          final Object[] params =
{null,null,adminPassword,null,databaseName};
          final String[] types = new String[]
{STRING,STRING,STRING,STRING,STRING};
          try{
- MBeanServer mbs =
AppServerMBeanServerFactory.getMBeanServerInstance();
+ final MBeanServer mbs = FeatureAvailability.getInstance
().getMBeanServer();
+
              // 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 +181,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());
          }
cvs server: Diffing appserv-core-ee/appserv-core/src/java/com/sun/
enterprise/ee/diagnostics/report

Index: appserv-core-ee/cms/src/java/com/sun/enterprise/ee/cms/
lifecycle/GMSLifecycleImpl.java
===================================================================
RCS file: /cvs/glassfish/appserv-core-ee/cms/src/java/com/sun/
enterprise/ee/cms/lifecycle/GMSLifecycleImpl.java,v
retrieving revision 1.3
diff -w -u -r1.3 GMSLifecycleImpl.java
--- appserv-core-ee/cms/src/java/com/sun/enterprise/ee/cms/lifecycle/
GMSLifecycleImpl.java 12 Dec 2006 00:40:05 -0000 1.3
+++ appserv-core-ee/cms/src/java/com/sun/enterprise/ee/cms/lifecycle/
GMSLifecycleImpl.java 5 Jan 2007 20:19:43 -0000
@@ -25,7 +25,6 @@

  import com.sun.appserv.server.ServerLifecycleException;
  import com.sun.appserv.server.ServerLifecycleImpl;
-import com.sun.enterprise.admin.common.MBeanServerFactory;
  import com.sun.enterprise.admin.server.core.AdminService;
  import com.sun.enterprise.config.ConfigContext;
  import com.sun.enterprise.config.ConfigException;
@@ -37,6 +36,8 @@
  import com.sun.enterprise.ee.cms.impl.common.GMSConfigConstants;
  import com.sun.enterprise.ee.cms.ext.IiopInfo;
  import com.sun.enterprise.server.ServerContext;
+import com.sun.enterprise.instance.ServerManager;
+import com.sun.enterprise.util.FeatureAvailability;

  import javax.management.*;
  import java.io.Serializable;
@@ -73,6 +74,15 @@
      private final GMSConstants.shutdownType shutdownType =
              GMSConstants.shutdownType.INSTANCE_SHUTDOWN;

+ /**
+ Don't assume that the AdminService is ready by calling
AdminService; check directly.
+ */
+ private static boolean
+ isDas( final ServerContext serverContext)
+ {
+ return ServerManager.ADMINSERVER_ID.equals
( serverContext.getInstanceName() );
+ }
+
      public void onInitialization(final ServerContext serverContext)
              throws ServerLifecycleException {
          instanceName = serverContext.getInstanceName();
@@ -87,7 +97,7 @@
                   
"com.sun.enterprise.ee.admin.mbeans.GMSClientStandardMBean";

          try {
- if(!AdminService.getAdminService().isDas()){
+ if( ! isDas( serverContext ) ) {
                  initializeGMSForThisInstance( serverContext );
              }
              else {
@@ -101,7 +111,8 @@
                  final Constructor gcsmConstructor = gcsmConstructors
[0];
                  mbean = (StandardMBean)gcsmConstructor.newInstance
(initargs);

- mbs = MBeanServerFactory.getMBeanServer();
+ mbs = (MBeanServer)FeatureAvailability.getInstance
().waitForFeature(
+ FeatureAvailability.MBEAN_SERVER_FEATURE,
"GMSLifecycleImpl.onInitialization");
                  final ObjectName gmsClientMBeanObjName = new
ObjectName(GmsClientName);
                  mbs.registerMBean(mbean, gmsClientMBeanObjName );
                  final NotificationListener gmsClientListener =
(NotificationListener)
cvs server: Diffing appserv-core-ee/cms/src/java/com/sun/enterprise/
ee/cms/logging