Move remove listener logic to ServiceManager

This commit is contained in:
KomachiSion 2020-10-12 16:00:50 +08:00
parent b8b111320a
commit b3b6c30ef0
2 changed files with 3 additions and 7 deletions

View File

@ -95,13 +95,10 @@ public class RaftConsistencyServiceImpl implements PersistentConsistencyService
checkIsStopWork(); checkIsStopWork();
try { try {
if (KeyBuilder.matchInstanceListKey(key) && !raftCore.isLeader()) { if (KeyBuilder.matchInstanceListKey(key) && !raftCore.isLeader()) {
Datum datum = new Datum(); raftCore.onDelete(key, peers.getLeader());
datum.key = key; } else {
raftCore.onDelete(datum.key, peers.getLeader()); raftCore.signalDelete(key);
raftCore.unlistenAll(key);
return;
} }
raftCore.signalDelete(key);
raftCore.unlistenAll(key); raftCore.unlistenAll(key);
} catch (Exception e) { } catch (Exception e) {
Loggers.RAFT.error("Raft remove failed.", e); Loggers.RAFT.error("Raft remove failed.", e);

View File

@ -26,7 +26,6 @@ import com.alibaba.nacos.naming.consistency.ConsistencyService;
import com.alibaba.nacos.naming.consistency.Datum; import com.alibaba.nacos.naming.consistency.Datum;
import com.alibaba.nacos.naming.consistency.KeyBuilder; import com.alibaba.nacos.naming.consistency.KeyBuilder;
import com.alibaba.nacos.naming.consistency.RecordListener; import com.alibaba.nacos.naming.consistency.RecordListener;
import com.alibaba.nacos.naming.consistency.persistent.impl.PersistentServiceProcessor;
import com.alibaba.nacos.naming.consistency.persistent.raft.RaftPeer; import com.alibaba.nacos.naming.consistency.persistent.raft.RaftPeer;
import com.alibaba.nacos.naming.consistency.persistent.raft.RaftPeerSet; import com.alibaba.nacos.naming.consistency.persistent.raft.RaftPeerSet;
import com.alibaba.nacos.naming.misc.GlobalExecutor; import com.alibaba.nacos.naming.misc.GlobalExecutor;