Skip to content

Instantly share code, notes, and snippets.

@sebersole
Created June 27, 2016 15:17
Show Gist options
  • Save sebersole/c0b1f07b8b4f4037478cb120694804f7 to your computer and use it in GitHub Desktop.
Save sebersole/c0b1f07b8b4f4037478cb120694804f7 to your computer and use it in GitHub Desktop.
@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 ( !TransientServiceRegistry.class.isInstance( child ) ) {
autoClose();
}
}
}
protected void autoClose() {
if ( autoCloseRegistry ) {
log.debug(
"Implicitly destroying ServiceRegistry on de-registration " +
"of all child ServiceRegistries"
);
destroy();
}
else {
log.debug(
"Skipping implicitly destroying ServiceRegistry on de-registration " +
"of all child ServiceRegistries"
);
}
}
class MetadataServiceRegistryImpl extends AbstractServiceRegistryImpl, TransientServiceRegistry {
...
}
/**
* Marker interface for ServiceRegistry impls that
* should be excluded from consideration for their
* parent registry's "auto-close" checks.
*/
public interface TransientServiceRegistry {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment