Merge branch 'jraft-naming' of https://github.com/KomachiSion/nacos into jraft_naming
This commit is contained in:
commit
73a29ebc85
@ -231,10 +231,6 @@ public class PersistentServiceProcessor extends LogProcessor4CP implements Persi
|
|||||||
final ValueChangeEvent event = ValueChangeEvent.builder().key(key).value(value)
|
final ValueChangeEvent event = ValueChangeEvent.builder().key(key).value(value)
|
||||||
.action(Op.Delete.equals(op) ? DataOperation.DELETE : DataOperation.CHANGE).build();
|
.action(Op.Delete.equals(op) ? DataOperation.DELETE : DataOperation.CHANGE).build();
|
||||||
NotifyCenter.publishEvent(event);
|
NotifyCenter.publishEvent(event);
|
||||||
// remove listeners of key to avoid mem leak
|
|
||||||
if (Op.Delete.equals(op)) {
|
|
||||||
notifier.deregisterAllListener(key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.unlistenAll(key);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
raftCore.signalDelete(key);
|
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);
|
||||||
|
@ -228,10 +228,14 @@ public class ServiceManager implements RecordListener<Service> {
|
|||||||
|
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
service.destroy();
|
service.destroy();
|
||||||
consistencyService.remove(KeyBuilder.buildInstanceListKey(namespace, name, true));
|
String ephemeralInstanceListKey = KeyBuilder.buildInstanceListKey(namespace, name, true);
|
||||||
|
String persistInstanceListKey = KeyBuilder.buildInstanceListKey(namespace, name, false);
|
||||||
consistencyService.remove(KeyBuilder.buildInstanceListKey(namespace, name, false));
|
consistencyService.remove(ephemeralInstanceListKey);
|
||||||
|
consistencyService.remove(persistInstanceListKey);
|
||||||
|
|
||||||
|
// remove listeners of key to avoid mem leak
|
||||||
|
consistencyService.unListen(ephemeralInstanceListKey, service);
|
||||||
|
consistencyService.unListen(persistInstanceListKey, service);
|
||||||
consistencyService.unListen(KeyBuilder.buildServiceMetaKey(namespace, name), service);
|
consistencyService.unListen(KeyBuilder.buildServiceMetaKey(namespace, name), service);
|
||||||
Loggers.SRV_LOG.info("[DEAD-SERVICE] {}", service.toJson());
|
Loggers.SRV_LOG.info("[DEAD-SERVICE] {}", service.toJson());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user