question: public void addDiscoveryListener ( DiscoveryListener l ) { if ( l == null ) { throw new NullPointerException ( "can't add null listener" ) ; } synchronized ( this ) { if ( terminated ) { throw new IllegalStateException ( "discovery terminated" ) ; } if ( listeners . contains ( l ) ) return ; listeners . add ( l ) ; if ( ! discoveredLocators . isEmpty ( ) ) { HashMap groupsMap = new HashMap ( discoveredLocators . size ( ) ) ; Iterator iter = discoveredLocators . iterator ( ) ; for ( int i = 0 ; iter . hasNext ( ) ; i ++ ) { LocatorReg reg = ( LocatorReg ) iter . next ( ) ; groupsMap . put ( reg . proxy , reg . memberGroups ) ; } ArrayList list = new ArrayList ( 1 ) ; list . add ( l ) ; addNotify ( list , groupsMap , false ) ; } } }
target:  Add a DiscoveryListener to the listener set. The listener's discovered method gets called right way with an array of ServiceRegistrars that have already been discovered, and will be called in the future whenever additional lookup services are discovered.