public synchronized void handleNotification ( Notification notification , Object handback ) { String type = notification . getType ( ) ; if ( REGISTRATION_NOTIFICATION . equals ( type ) ) { jolokiaMBeanServer = lookupJolokiaMBeanServer ( ) ; // We need to add the listener provided during construction time to add the Jolokia MBeanServer // so that it is kept updated, too. if ( jolokiaMBeanServerListener != null ) { JmxUtil . addMBeanRegistrationListener ( jolokiaMBeanServer , jolokiaMBeanServerListener , null ) ; } } else if ( UNREGISTRATION_NOTIFICATION . equals ( type ) ) { jolokiaMBeanServer = null ; } allMBeanServers . clear ( ) ; if ( jolokiaMBeanServer != null ) { allMBeanServers . add ( jolokiaMBeanServer ) ; } allMBeanServers . addAll ( detectedMBeanServers ) ; }
Fetch Jolokia MBeanServer when it gets registered remove it if being unregistered