private void createManagedService ( final BundleContext context ) { ManagedService service = this :: scheduleUpdateConfig ; final Dictionary < String , String > props = new Hashtable <> ( ) ; props . put ( Constants . SERVICE_PID , org . ops4j . pax . web . service . WebContainerConstants . PID ) ; context . registerService ( ManagedService . class , service , props ) ; // If ConfigurationAdmin service is not available, then do a default configuration. // In other cases, ConfigurationAdmin service will always call the ManagedService. if ( context . getServiceReference ( ConfigurationAdmin . class . getName ( ) ) == null ) { try { service . updated ( null ) ; } catch ( ConfigurationException ignore ) { // this should never happen LOG . error ( "Internal error. Cannot set initial configuration resolver." , ignore ) ; } } }
Registers a managed service to listen on configuration updates .