FileDocCategorySizeDatePackage
NotificationListenerTracking.javaAPI DocGlassfish v2 API5493Fri May 04 22:31:04 BST 2007com.sun.appserv.management.util.jmx

NotificationListenerTracking

public class NotificationListenerTracking extends Object

Fields Summary
private final List
mInfos
Constructors Summary
public NotificationListenerTracking(boolean synchronize)

	    final List<NotificationListenerInfo> infos    =
	        new ArrayList<NotificationListenerInfo>();
	    
	    mInfos  = synchronize ? Collections.synchronizedList( infos ) : infos;
	
Methods Summary
public voidaddNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)

	    final NotificationListenerInfo  info    =
	        new NotificationListenerInfo( listener, filter, handback );
	        
	    mInfos.add( info );
	
public intgetListenerCount()

        return mInfos.size();
    
private final booleanhandbacksEqual(java.lang.Object handback1, java.lang.Object handback2)

	    return( handback1 == handback2 );
	
private final booleanlistenersEqual(javax.management.NotificationListener listener1, javax.management.NotificationListener listener2)

	    return( listener1 == listener2 );
	
public java.util.ListremoveNotificationListener(javax.management.NotificationListener listener)
Remove all instances of the specified listener and return their corresponding NotificationListenerInfo. This behavior matches the behavior of {@link javax.management.NotificationEmitter}.

return
list of NotificationListenerInfo

	    final Iterator iter   = mInfos.iterator();
	    
	    final List<NotificationListenerInfo>    results = new ArrayList<NotificationListenerInfo>();
	    
	    while( iter.hasNext() )
	    {
	        final NotificationListenerInfo  info =
	            (NotificationListenerInfo)iter.next();
	        
	        if ( listenersEqual( listener, info.getListener() )  )
	        {
	            iter.remove();
	            results.add( info ); 
	        }
	    }
	    
	    return( results );
	
public NotificationListenerInforemoveNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)
Remove the first instance of the specified listener/filter/handback combination and return its corresponding NotificationListenerInfo. This behavior matches the behavior of {@link javax.management.NotificationEmitter}.

return
list of NotificationListenerInfo

	    final Iterator iter   = mInfos.iterator();
	    NotificationListenerInfo result  = null;
	    
	    while( iter.hasNext() )
	    {
	        final NotificationListenerInfo  info =
	            (NotificationListenerInfo)iter.next();
	        
	        if ( listenersEqual( listener, info.getListener() ) &&
	            handbacksEqual( handback, info.getHandback() ) )
	        {
	            iter.remove();
	            result  = info;
	            break;
	        }
	    }
	    
	    return( result );