Methods Summary |
---|
private javax.management.ObjectName | _sync(javax.management.ObjectName oldObjectName)
if ( ! getMBeanServer().isRegistered( oldObjectName ) )
{
throw new RuntimeException( new InstanceNotFoundException() );
}
// out of order registration can result in trying to register the same MBean
// more than once.
synchronized( this )
{
ObjectName result = mOldToNewObjectNames.get( oldObjectName );
if ( result == null )
{
try
{
final LoaderOfOld loaderOfOld = findLoaderOfOld( oldObjectName );
if ( loaderOfOld != null )
{
result = loaderOfOld.syncWithOld( oldObjectName );
if ( result == null )
{
throw new IllegalArgumentException( oldObjectName.toString() );
}
}
}
catch( Exception e )
{
final String msg = ExceptionUtil.toString( e );
debug( msg );
getMBeanLogger().warning( msg );
if ( e instanceof RuntimeException )
{
throw (RuntimeException)e;
}
else
{
throw new RuntimeException( e );
}
}
}
return( result );
}
|
private void | addLoaders()
assert( getMBeanServer() != null );
assert( getMBeanLogger() != null );
final List<LoaderOfOld> loaders = new ArrayList<LoaderOfOld>();
loaders.add( new LoaderOfOldConfig( this ) );
loaders.add( new LoaderOfOld77( this ) );
loaders.add( new LoaderOfOldMonitor( this ) );
mLoaders = Collections.unmodifiableList( loaders );
|
protected java.lang.Object | createDomainRoot()
return new DomainRootImpl();
|
private LoaderOfOld | findLoaderOfOld(javax.management.ObjectName candidate)
LoaderOfOld oldLoader = null;
for( final LoaderOfOld loo : mLoaders )
{
if ( loo.shouldSync( candidate ) )
{
oldLoader = loo;
break;
}
}
return( oldLoader );
|
public void | handleMBeanRegistered(javax.management.ObjectName oldObjectName)
trace( "handleMBeanRegistered: " + oldObjectName );
if ( shouldSync( oldObjectName ) )
{
final long start = now();
if ( WAIT_FOR_REGISTRATION )
{
while ( ! getMBeanServer().isRegistered( oldObjectName ) &&
(now() - start) < WAIT_THRESHOLD_MILLIS )
{
mySleep( 50 );
debug( "SLEPT for 50ms waiting for " + oldObjectName );
}
}
if ( ! getMBeanServer().isRegistered( oldObjectName ) )
{
trace( "Loader.handleMBeanRegistered: not found: " + JMXUtil.toString(oldObjectName) );
throw new InstanceNotFoundException( JMXUtil.toString(oldObjectName) );
}
try
{
sync( oldObjectName );
}
catch( Exception e )
{
final Throwable rootCause = ExceptionUtil.getRootCause( e );
if ( rootCause instanceof DeferRegistrationException )
{
mDeferredRegistrationThread.defer( oldObjectName );
}
}
}
|
public void | handleMBeanUnregistered(javax.management.ObjectName oldObjectName)
trace( "handleMBeanUnregistered: " + oldObjectName );
final ObjectName newObjectName =
mOldToNewObjectNames.remove( oldObjectName );
if ( newObjectName != null && getMBeanServer().isRegistered( newObjectName ) )
{
debug( "unregistering: " + newObjectName + " corresponding to " + oldObjectName );
getMBeanServer().unregisterMBean( newObjectName );
}
|
public void | handleNotification(javax.management.Notification notifIn, java.lang.Object handback)
final String type = notifIn.getType();
if ( notifIn instanceof MBeanServerNotification )
{
final MBeanServerNotification notif = (MBeanServerNotification)notifIn;
final ObjectName objectName = notif.getMBeanName();
if ( type == MBeanServerNotification.REGISTRATION_NOTIFICATION )
{
if ( JMXUtil.toString(objectName).equals( "amx:j2eeType=J2EEServer,name=server" ) )
{
debug( "Loader.handleNotification: REGISTER for: " + JMXUtil.toString(objectName) );
}
}
else if ( type == MBeanServerNotification.UNREGISTRATION_NOTIFICATION )
{
//debug( "Loader.handleNotification: UNREGISTER for: " + JMXUtil.toString(objectName) );
}
if ( JMX_DOMAINS_OF_INTEREST.contains( objectName.getDomain() ) &&
shouldSync( objectName ) )
{
final boolean register =
type == MBeanServerNotification.REGISTRATION_NOTIFICATION;
// put it at the end of the registration or unregistration queue
mRegThread.enqueue( register, objectName );
}
}
|
public boolean | isDAS()
return true;
|
public boolean | isStarted()
return super.isStarted() && mQueuedAll &&
mRegThread.isQueueEmpty();
|
protected javax.management.ObjectName | loadSystemInfo(javax.management.MBeanServer server)
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 );
|
protected final void | postRegisterHook()
super.postRegisterHook();
FeatureAvailability.getInstance().registerFeature(
FeatureAvailability.AMX_LOADER_FEATURE, getObjectName() );
|
protected void | preRegisterHook()
mRegThread = new LoaderRegThread( this, mLogger );
mRegThread.start();
|
private void | queueAll()
for( final LoaderOfOld oldLoader : mLoaders )
{
final List<ObjectName> oldObjectNames = oldLoader.findAllOld();
mRegThread.enqueue( true, oldObjectNames );
getMBeanLogger().fine( "Loader: Queued " + oldObjectNames.size() +
" MBeans for loader " + oldLoader.getClass().getName() );
}
|
synchronized javax.management.ObjectName | registerNew(java.lang.Object impl, javax.management.ObjectName implObjectName, javax.management.ObjectName oldObjectName)
//debug( "registering: ", JMXUtil.toString(implObjectName), " corresponding to ", JMXUtil.toString(oldObjectName) );
final ObjectName resultName =
getMBeanServer().registerMBean( impl, implObjectName ).getObjectName();
mOldToNewObjectNames.put( oldObjectName, resultName );
return( resultName );
|
public javax.management.ObjectName | resyncAMXMBean(javax.management.ObjectName amx)
if ( ! getMBeanServer().isRegistered( amx ) )
{
throw new InstanceNotFoundException();
}
if ( ! getAMXJMXDomainName().equals( amx.getDomain() ) )
{
throw new IllegalArgumentException( "" + amx );
}
debug( "resyncAMXMBean: looking for matching delegate MBean" );
ObjectName old = null;
for( final ObjectName oldTemp : mOldToNewObjectNames.keySet() )
{
if ( mOldToNewObjectNames.get( oldTemp ).equals( amx ) )
{
old = oldTemp;
debug( "resyncAMXMBean: found matching delegate MBean: " + old );
break;
}
}
if ( old == null )
{
throw new IllegalArgumentException( "" + amx );
}
debug( "resyncAMXMBean: removing mapping from: " + old + " TO " + amx );
mOldToNewObjectNames.remove( old );
debug( "resyncAMXMBean: unregistering: " + amx );
getMBeanServer().unregisterMBean( amx );
debug( "resyncAMXMBean: handleMBeanRegistered: " + amx );
handleMBeanRegistered( old );
final ObjectName newAMX = mOldToNewObjectNames.get( old );
assert( newAMX != null );
debug( "resyncAMXMBean: new ObjectName: " + newAMX );
return newAMX;
|
private boolean | shouldSync(javax.management.ObjectName oldObjectName)
final String jmxDomain = oldObjectName.getDomain();
final boolean applicable = ObjectNames.kDefaultIASDomainName.equals( jmxDomain );
return applicable ? (findLoaderOfOld( oldObjectName ) != null) : false;
|
protected void | startHook()
super.startHook();
addLoaders();
queueAll();
mQueuedAll = true;
|
public final javax.management.ObjectName | sync(javax.management.ObjectName oldObjectName)
if ( ! mStarted )
{
throw new IllegalStateException();
}
if ( ! shouldSync( oldObjectName ) )
{
throw new IllegalArgumentException( oldObjectName.toString() );
}
ObjectName result = null;
/*
Synchronize for config; ConfigFactory can call sync() explicitly, and there
is a race condition that can attempt duplicate registration with the
one to be done or already done or in progress by handleMBeanRegistered().
*/
final String category = oldObjectName.getKeyProperty( "category" );
if ( category != null && category.equals( "config" ) )
{
synchronized( CONFIG_SYNC )
{
result = _sync( oldObjectName );
}
}
else
{
result = _sync( oldObjectName );
}
return result;
|
public final void | waitAll()
mRegThread.waitAll();
debug( "waitAll() DONE" );
|