You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by ts...@apache.org on 2020/03/07 16:19:39 UTC
[dubbo] branch master updated: polish code of DubboShutdownHook
(#5835)
This is an automated email from the ASF dual-hosted git repository.
tswstarplanet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 9fb69a5 polish code of DubboShutdownHook (#5835)
9fb69a5 is described below
commit 9fb69a5c078064c76640735afb86148eaabace5c
Author: tswstarplanet <ts...@apache.org>
AuthorDate: Sun Mar 8 00:19:27 2020 +0800
polish code of DubboShutdownHook (#5835)
---
.../src/main/java/org/apache/dubbo/config/DubboShutdownHook.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/DubboShutdownHook.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/DubboShutdownHook.java
index 50f2011..56dab50 100644
--- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/DubboShutdownHook.java
+++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/DubboShutdownHook.java
@@ -89,7 +89,7 @@ public class DubboShutdownHook extends Thread {
* Register the ShutdownHook
*/
public void register() {
- if (!registered.get() && registered.compareAndSet(false, true)) {
+ if (registered.compareAndSet(false, true)) {
DubboShutdownHook dubboShutdownHook = getDubboShutdownHook();
Runtime.getRuntime().addShutdownHook(dubboShutdownHook);
dispatch(new DubboShutdownHookRegisteredEvent(dubboShutdownHook));
@@ -100,7 +100,7 @@ public class DubboShutdownHook extends Thread {
* Unregister the ShutdownHook
*/
public void unregister() {
- if (registered.get() && registered.compareAndSet(true, false)) {
+ if (registered.compareAndSet(true, false)) {
DubboShutdownHook dubboShutdownHook = getDubboShutdownHook();
Runtime.getRuntime().removeShutdownHook(dubboShutdownHook);
dispatch(new DubboShutdownHookUnregisteredEvent(dubboShutdownHook));