FileDocCategorySizeDatePackage
RegistrationListener.javaAPI DocGlassfish v2 API5135Fri May 04 22:23:50 BST 2007com.sun.enterprise.management

RegistrationListener

public final class RegistrationListener extends com.sun.appserv.management.util.jmx.MBeanRegistrationListener
A NotificationListener which tracks registration of MBeans.

Fields Summary
private final MBeanServerConnection
mConn
private final Set
mRegistered
private final Set
mUnregistered
private final Set
mCurrentlyRegistered
Constructors Summary
private RegistrationListener(String name, MBeanServerConnection conn)

	    super( "RegistrationListener", conn, null );
	    
	    mConn   = conn;
	    
	    mRegistered     = new HashSet<ObjectName>();
	    mUnregistered   = new HashSet<ObjectName>();
	    mCurrentlyRegistered    = new HashSet<ObjectName>();
	    
	    queryAllAMX();
	
Methods Summary
public static com.sun.enterprise.management.RegistrationListenercreateInstance(java.lang.String name, javax.management.MBeanServerConnection conn)

        final RegistrationListener listener = new RegistrationListener(name, conn);
        
        JMXUtil.listenToMBeanServerDelegate( conn, listener, null, null );
        
        return listener;
    
public synchronized java.util.SetgetCurrentlyRegistered()

        final Set<ObjectName> all   = new HashSet<ObjectName>( mCurrentlyRegistered );
        
        return all;
    
public java.util.SetgetRegistered()

        return Collections.unmodifiableSet( mRegistered );
    
public java.util.SetgetUnregistered()

        return Collections.unmodifiableSet( mUnregistered );
    
private booleanisAMX(javax.management.ObjectName objectName)

	    return objectName.getDomain().equals( AMX.JMX_DOMAIN );
	
protected synchronized voidmbeanRegistered(javax.management.ObjectName objectName)

        if ( isAMX( objectName ) )
        {
            mRegistered.add( objectName );
            mCurrentlyRegistered.add( objectName );
        }
    
protected synchronized voidmbeanUnregistered(javax.management.ObjectName objectName)

        if ( isAMX( objectName ) )
        {
            mUnregistered.add( objectName );
            mCurrentlyRegistered.remove( objectName );
        }
    
public voidnotifsLost()

	    queryAllAMX();
	
private voidqueryAllAMX()

	    try
	    {
	    final ObjectName pat    = Util.newObjectNamePattern( AMX.JMX_DOMAIN, "*" );
	    final Set<ObjectName>  all = JMXUtil.queryNames( mConn, pat, null );
	    
	    mCurrentlyRegistered.addAll( all );
	    }
	    catch( IOException e )
	    {
	    }