[ISSUES #8635] fix a NPE when call the shutdown method (#8636)

* [ISSUES #8635] fix a NPE when call the shutdown method

Close #8635

* [ISSUES #8635] remove init judgment
This commit is contained in:
onewe 2022-06-28 13:46:34 +08:00 committed by GitHub
parent ccce9da5a6
commit 56ee220a68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -469,10 +469,16 @@ public class RaftCore implements Closeable {
Loggers.RAFT.warn("start to close old raft protocol!!!");
Loggers.RAFT.warn("stop old raft protocol task for notifier");
NotifyCenter.deregisterSubscriber(notifier);
Loggers.RAFT.warn("stop old raft protocol task for master task");
masterTask.cancel(true);
Loggers.RAFT.warn("stop old raft protocol task for heartbeat task");
heartbeatTask.cancel(true);
if (masterTask != null) {
Loggers.RAFT.warn("stop old raft protocol task for master task");
masterTask.cancel(true);
}
if (heartbeatTask != null) {
Loggers.RAFT.warn("stop old raft protocol task for heartbeat task");
heartbeatTask.cancel(true);
}
Loggers.RAFT.warn("clean old cache datum for old raft");
datums.clear();
}