Merge branch 'master' into 2.7.6-release
This commit is contained in:
commit
40e8bdd4e8
|
|
@ -52,7 +52,7 @@ public class DubboShutdownHook extends Thread {
|
|||
/**
|
||||
* Has it already been destroyed or not?
|
||||
*/
|
||||
private final AtomicBoolean destroyed = new AtomicBoolean(false);
|
||||
private static final AtomicBoolean destroyed = new AtomicBoolean(false);
|
||||
|
||||
private final EventDispatcher eventDispatcher = EventDispatcher.getDefaultExtension();
|
||||
|
||||
|
|
@ -111,17 +111,15 @@ public class DubboShutdownHook extends Thread {
|
|||
* Destroy all the resources, including registries and protocols.
|
||||
*/
|
||||
public void doDestroy() {
|
||||
if (!destroyed.compareAndSet(false, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// dispatch the DubboDestroyedEvent @since 2.7.5
|
||||
dispatch(new DubboServiceDestroyedEvent(this));
|
||||
}
|
||||
|
||||
public static void destroyAll() {
|
||||
AbstractRegistryFactory.destroyAll();
|
||||
destroyProtocols();
|
||||
if (destroyed.compareAndSet(false, true)) {
|
||||
AbstractRegistryFactory.destroyAll();
|
||||
destroyProtocols();
|
||||
}
|
||||
}
|
||||
|
||||
private void dispatch(Event event) {
|
||||
|
|
|
|||
|
|
@ -1033,11 +1033,11 @@ public class DubboBootstrap extends GenericEventListener {
|
|||
}
|
||||
|
||||
public void destroy() {
|
||||
// for compatibility purpose
|
||||
DubboShutdownHook.destroyAll();
|
||||
|
||||
if (started.compareAndSet(true, false)
|
||||
&& destroyed.compareAndSet(false, true)) {
|
||||
// for compatibility purpose
|
||||
DubboShutdownHook.destroyAll();
|
||||
|
||||
unregisterServiceInstance();
|
||||
unexportMetadataService();
|
||||
|
|
|
|||
Loading…
Reference in New Issue