Closed JoeCqupt closed 1 year ago
discussion: make method Destroyable#destroy(DestroyHook hook) be a default method ???
public interface Destroyable {
public void destroy();
default void destroy(DestroyHook hook){
if (hook != null) {
hook.preDestroy();
}
destroy();
if (hook != null) {
hook.postDestroy();
}
}
interface DestroyHook {
public void preDestroy();
public void postDestroy();
}
}
Motivation:
code cleanup
base class
Registry
already implemented methoddestroy(DestroyHook hook)
Modification:
remove override method
destroy(DestroyHook hook)
for ConsulRegistry & ZookeeperRegistryResult: