Changes:
1. Fix for
https://glassfish.dev.java.net/issues/show_bug.cgi?
id=1764. This bug was caused by the increasing number of MBeans, and
the workaround code inserted a few years ago, that forced AMX to
synchronously load MBeans. That code is no longer needed, and it was
causing a race condition (which would chew up cycles, but cause no
harm).
2. Also, optimized Loader to bother only with MBeans in the
com.sun.appserv domain; this cuts off a lots of dead-end processing,
which matters at system startup (anytime an MBean is registered).
Timeout: 2pm Tuesday 12/18. After that code gets committed.
Lloyd
Index: 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.15
diff -u -r1.15 Loader.java
--- src/java/com/sun/enterprise/management/support/Loader.java 17
Nov 2006 21:51:10 -0000 1.15
+++ src/java/com/sun/enterprise/management/support/Loader.java 19
Dec 2006 02:01:03 -0000
@@ -27,6 +27,7 @@
package com.sun.enterprise.management.support;
import java.util.List;
+import java.util.Set;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
@@ -58,6 +59,7 @@
import
com.sun.appserv.management.util.jmx.stringifier.StringifierRegistryInite
r;
import com.sun.appserv.management.util.misc.ExceptionUtil;
+import com.sun.appserv.management.util.misc.GSetUtil;
import
com.sun.appserv.management.util.stringifier.StringifierRegistryIniterImp
l;
import
com.sun.appserv.management.util.stringifier.StringifierRegistryImpl;
@@ -68,6 +70,8 @@
import com.sun.enterprise.management.support.TypeInfos;
import com.sun.enterprise.management.DomainRootImpl;
+import com.sun.enterprise.admin.common.ObjectNames;
+
/**
Implements loading of all MBean API MBeans WITHIN the DAS
(Domain Admin Server).
*/
@@ -78,11 +82,16 @@
private Map<ObjectName,ObjectName> mOldToNewObjectNames;
private LoaderRegThread mRegThread;
+ private final Set<String> JMX_DOMAINS_OF_INTEREST;
+
private final DeferredRegistrationThread
mDeferredRegistrationThread;
public
Loader()
{
+ JMX_DOMAINS_OF_INTEREST =
+ GSetUtil.newUnmodifiableStringSet
( ObjectNames.kDefaultIASDomainName );
+
mOldToNewObjectNames =
Collections.synchronizedMap( new
HashMap<ObjectName,ObjectName>() );
@@ -103,18 +112,12 @@
mRegThread = new LoaderRegThread( this, mLogger );
mRegThread.start();
}
-
- /**
- 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,
final Object handback)
- {
+ {
final String type = notifIn.getType();
if ( notifIn instanceof MBeanServerNotification )
@@ -124,30 +127,20 @@
final MBeanServerNotification notif =
(MBeanServerNotification)notifIn;
- final ObjectName objectName =
notif.getMBeanName();
+ final ObjectName objectName =
notif.getMBeanName();
- if ( shouldSync( objectName ) )
+ if ( JMX_DOMAINS_OF_INTEREST.contains
( objectName.getDomain() ) &&
+ shouldSync( objectName ) )
{
final boolean register =
type ==
MBeanServerNotification.REGISTRATION_NOTIFICATION;
- /** WORKAROUND_FOR_BUG_SRIDATTA_FOUND
(force synchronous handling) */
- if ( SYNCHRONOUS_NOTIFICATION_HANDLING )
- {
- if ( register )
- {
-
mRegThread.processRegistration( objectName );
- }
- else
- {
-
mRegThread.processUnregistration( objectName );
- }
- }
- else
- {
- mRegThread.enqueue( register,
objectName );
- }
+ mRegThread.enqueue( register,
objectName );
}
+ else
+ {
+ // debug( "handleNotification: Ignoring
MBeanServerNotification for: ", JMXUtil.toString(objectName) );
+ }
}
}
@@ -167,6 +160,7 @@
(now() - start) <
WAIT_THRESHOLD_MILLIS )
{
mySleep( 50 );
+ debug( "SLEPT for 50ms waiting for " + oldObjectName );
}
if ( ! getMBeanServer().isRegistered
( oldObjectName ) )
@@ -403,7 +397,7 @@
return( resultName );
}
- public ObjectName
+ protected ObjectName
loadSystemInfo( final MBeanServer server )
throws NotCompliantMBeanException,
MBeanRegistrationException,
InstanceAlreadyExistsException
@@ -434,11 +428,13 @@
}
-
private boolean
- shouldSync( ObjectName oldObjectName )
+ shouldSync( final ObjectName oldObjectName )
{
- return( findLoaderOfOld( oldObjectName ) != null );
+ final String jmxDomain = oldObjectName.getDomain();
+ final boolean applicable =
ObjectNames.kDefaultIASDomainName.equals( jmxDomain );
+
+ return applicable ? (findLoaderOfOld
( oldObjectName ) != null) : false;
}
private LoaderOfOld
Index: 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.3
diff -u -r1.3 LoaderBase.java
--- src/java/com/sun/enterprise/management/support/
LoaderBase.java 25 Dec 2005 03:40:45 -0000 1.3
+++ src/java/com/sun/enterprise/management/support/
LoaderBase.java 19 Dec 2006 02:01:03 -0000
@@ -133,7 +133,7 @@
return( System.currentTimeMillis() );
}
- public ObjectName
+ protected ObjectName
loadSystemInfo( final MBeanServer server )
throws NotCompliantMBeanException,
MBeanRegistrationException,
InstanceAlreadyExistsException
Index: src/java/com/sun/enterprise/management/support/
LoaderRegThread.java
===================================================================
RCS file: /cvs/glassfish/admin/mbeanapi-impl/src/java/com/sun/
enterprise/management/support/LoaderRegThread.java,v
retrieving revision 1.4
diff -u -r1.4 LoaderRegThread.java
--- src/java/com/sun/enterprise/management/support/
LoaderRegThread.java 25 Dec 2005 03:40:47 -0000 1.4
+++ src/java/com/sun/enterprise/management/support/
LoaderRegThread.java 19 Dec 2006 02:01:03 -0000
@@ -208,8 +208,7 @@
return( mRegistrationQueue.size() );
}
- /** WORKAROUND_FOR_BUG_SRIDATTA_FOUND (should not be public)*/
- public synchronized void
+ private void
processRegistration( final ObjectName objectName )
{
try
@@ -226,8 +225,7 @@
}
}
- /** WORKAROUND_FOR_BUG_SRIDATTA_FOUND (should not be public)*/
- public synchronized void
+ private void
processUnregistration( final ObjectName objectName )
{
try
cvs server: Diffing src/java/com/sun/enterprise/management/support/
oldconfig