@ SuppressWarnings ( "unchecked" ) public final List < RegisteredService > loadServices ( ) { logger . info ( "Loading Registered Services from: [ {} ]..." , this . servicesConfigFile ) ; final List < RegisteredService > resolvedServices = new ArrayList < RegisteredService > ( ) ; try { final Map < String , List > m = unmarshalServicesRegistryResourceIntoMap ( ) ; if ( m != null ) { final Iterator < Map > i = m . get ( SERVICES_KEY ) . iterator ( ) ; while ( i . hasNext ( ) ) { final Map < ? , ? > record = i . next ( ) ; final String svcId = ( ( String ) record . get ( SERVICES_ID_KEY ) ) ; final RegisteredService svc = getRegisteredServiceInstance ( svcId ) ; if ( svc != null ) { resolvedServices . add ( this . objectMapper . convertValue ( record , svc . getClass ( ) ) ) ; logger . debug ( "Unmarshaled {}: {}" , svc . getClass ( ) . getSimpleName ( ) , record ) ; } } synchronized ( this . mutexMonitor ) { this . delegateServiceRegistryDao . setRegisteredServices ( resolvedServices ) ; } } } catch ( final Throwable e ) { throw new RuntimeException ( e ) ; } return resolvedServices ; }
This method is used as a Spring bean loadServices - method as well as the reloading method when the change in the services definition resource is detected at runtime