/** * Destroy a service registry. Applications should only destroy registries they have explicitly created. * * @param serviceRegistry The registry to be closed. */ public static void destroy(ServiceRegistry serviceRegistry) { if ( serviceRegistry == null ) { return; } ( (BootstrapServiceRegistryImpl) serviceRegistry ).destroy(); } }
@Override public <R extends Service> R getService(Class<R> serviceRole) { final ServiceBinding<R> binding = locateServiceBinding( serviceRole ); return binding == null ? null : binding.getService(); }
); return new BootstrapServiceRegistryImpl( autoCloseRegistry, classLoaderService,
); return new BootstrapServiceRegistryImpl( autoCloseRegistry, classLoaderService,
@Override public synchronized void destroy() { if ( !active ) { return; } active = false; destroy( classLoaderServiceBinding ); destroy( strategySelectorBinding ); destroy( integratorServiceBinding ); if ( childRegistries != null ) { for(ServiceRegistry serviceRegistry : childRegistries) { if(serviceRegistry instanceof ServiceRegistryImplementor) { ServiceRegistryImplementor serviceRegistryImplementor = (ServiceRegistryImplementor) serviceRegistry; serviceRegistryImplementor.destroy(); } } } }
@Override public <R extends Service> R getService(Class<R> serviceRole) { final ServiceBinding<R> binding = locateServiceBinding( serviceRole ); return binding == null ? null : binding.getService(); }
@Override public synchronized void deRegisterChild(ServiceRegistryImplementor child) { if ( childRegistries == null ) { throw new IllegalStateException( "No child ServiceRegistry registrations found" ); } childRegistries.remove( child ); if ( childRegistries.isEmpty() ) { if ( autoCloseRegistry ) { LOG.debug( "Implicitly destroying Boot-strap registry on de-registration " + "of all child ServiceRegistries" ); destroy(); } else { LOG.debug( "Skipping implicitly destroying Boot-strap registry on de-registration " + "of all child ServiceRegistries" ); } } } }
@After public void after() { if ( bsr != null ) { bsr.destroy(); } }
/** * Destroy a service registry. Applications should only destroy registries they have explicitly created. * * @param serviceRegistry The registry to be closed. */ public static void destroy(ServiceRegistry serviceRegistry) { if ( serviceRegistry == null ) { return; } ( (BootstrapServiceRegistryImpl) serviceRegistry ).destroy(); } }
@Override public void destroy() { if ( !active ) { return; } active = false; destroy( classLoaderServiceBinding ); destroy( strategySelectorBinding ); destroy( integratorServiceBinding ); if ( childRegistries != null ) { for(ServiceRegistry serviceRegistry : childRegistries) { if(serviceRegistry instanceof ServiceRegistryImplementor) { ServiceRegistryImplementor serviceRegistryImplementor = (ServiceRegistryImplementor) serviceRegistry; serviceRegistryImplementor.destroy(); } } } }
@Override public void deRegisterChild(ServiceRegistryImplementor child) { if ( childRegistries == null ) { throw new IllegalStateException( "No child ServiceRegistry registrations found" ); } childRegistries.remove( child ); if ( childRegistries.isEmpty() ) { if ( autoCloseRegistry ) { LOG.debug( "Implicitly destroying Boot-strap registry on de-registration " + "of all child ServiceRegistries" ); destroy(); } else { LOG.debug( "Skipping implicitly destroying Boot-strap registry on de-registration " + "of all child ServiceRegistries" ); } } } }