为启动线程添加了 morny-init 节点,修改线程名,添加事件监听启动的log

- 为事件监听器的注册和开启添加一条 log 记录
- 在 ServerMain 交接启动给 MornyCoeur 时将启动线程名切换为 <morny-init>
- 将 exit-cleaning 线程名改为小写
This commit is contained in:
A.C.Sukazyo Eyre 2022-06-05 20:06:13 +08:00
parent 8b41111a49
commit c63217f0c6
Signed by: Eyre_S
GPG Key ID: EFB47D98FE082FAD
4 changed files with 8 additions and 4 deletions

View File

@ -1,6 +1,6 @@
## Core ## Core
VERSION = 0.7.1.0 VERSION = 0.7.1.1
CODENAME = fuzhou CODENAME = fuzhou

View File

@ -4,7 +4,7 @@ package cc.sukazyo.cono.morny;
* the final field that will be updated by gradle automatically. * the final field that will be updated by gradle automatically.
*/ */
public class GradleProjectConfigures { public class GradleProjectConfigures {
public static final String VERSION = "0.7.1.0"; public static final String VERSION = "0.7.1.1";
public static final String CODENAME = "fuzhou"; public static final String CODENAME = "fuzhou";
public static final long COMPILE_TIMESTAMP = 1654235503515L; public static final long COMPILE_TIMESTAMP = 1654430498871L;
} }

View File

@ -152,6 +152,7 @@ public class MornyCoeur {
isRemoveCommandListWhenExit isRemoveCommandListWhenExit
); );
MornyDaemons.start(); MornyDaemons.start();
logger.info("start telegram events listening");
EventListeners.registerAllListeners(); EventListeners.registerAllListeners();
INSTANCE.account.setUpdatesListener(OnUpdate::onNormalUpdate); INSTANCE.account.setUpdatesListener(OnUpdate::onNormalUpdate);
if (isAutomaticResetCommandList) { if (isAutomaticResetCommandList) {
@ -187,7 +188,7 @@ public class MornyCoeur {
* 为程序在虚拟机上添加退出钩子 * 为程序在虚拟机上添加退出钩子
*/ */
private void configureSafeExit () { private void configureSafeExit () {
Runtime.getRuntime().addShutdownHook(new Thread(this::exitCleanup, "Exit-Cleaning")); Runtime.getRuntime().addShutdownHook(new Thread(this::exitCleanup, "exit-cleaning"));
} }
/** /**

View File

@ -21,6 +21,8 @@ public class ServerMain {
public static final String PROP_TOKEN_KEY = "TELEGRAM_BOT_API_TOKEN"; public static final String PROP_TOKEN_KEY = "TELEGRAM_BOT_API_TOKEN";
public static final String PROP_TOKEN_MORNY_KEY = "MORNY_TG_TOKEN"; public static final String PROP_TOKEN_MORNY_KEY = "MORNY_TG_TOKEN";
private static final String THREAD_MORNY_INIT = "morny-init";
/** /**
* 程序入口也是参数处理器<br> * 程序入口也是参数处理器<br>
* <br> * <br>
@ -233,6 +235,7 @@ public class ServerMain {
logger.info("Parameter required has no value:\n --token."); logger.info("Parameter required has no value:\n --token.");
return; return;
} }
Thread.currentThread().setName(THREAD_MORNY_INIT);
MornyCoeur.main( MornyCoeur.main(
api, api4File, api, api4File,
key, username, key, username,