-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
155 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
naming/src/main/java/com/alibaba/nacos/naming/misc/GracefulShutdownListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.alibaba.nacos.naming.misc; | ||
|
||
import com.alibaba.nacos.api.exception.NacosException; | ||
import com.alibaba.nacos.core.listener.NacosApplicationListener; | ||
import org.springframework.context.ConfigurableApplicationContext; | ||
import org.springframework.core.env.ConfigurableEnvironment; | ||
|
||
/** | ||
* Graceful shutdown. | ||
* | ||
* @author Weizhan▪Yun | ||
* @date 2022/10/27 16:44 | ||
*/ | ||
public class GracefulShutdownListener implements NacosApplicationListener { | ||
|
||
@Override | ||
public void starting() { | ||
|
||
} | ||
|
||
@Override | ||
public void environmentPrepared(ConfigurableEnvironment environment) { | ||
|
||
} | ||
|
||
@Override | ||
public void contextPrepared(ConfigurableApplicationContext context) { | ||
|
||
} | ||
|
||
@Override | ||
public void contextLoaded(ConfigurableApplicationContext context) { | ||
|
||
} | ||
|
||
@Override | ||
public void started(ConfigurableApplicationContext context) { | ||
|
||
} | ||
|
||
@Override | ||
public void running(ConfigurableApplicationContext context) { | ||
|
||
} | ||
|
||
@Override | ||
public void failed(ConfigurableApplicationContext context, Throwable exception) { | ||
try { | ||
NamingExecuteTaskDispatcher.getInstance().getExecuteEngine().shutdown(); | ||
} catch (NacosException ignore) { | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...main/resources/META-INF/services/com.alibaba.nacos.core.listener.NacosApplicationListener
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
com.alibaba.nacos.naming.misc.GracefulShutdownListener |
Oops, something went wrong.