sanpwc commented on code in PR #759:
URL: https://github.com/apache/ignite-3/pull/759#discussion_r857873320
##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java:
##########
@@ -427,14 +430,31 @@ void reset(final Status st) {
this.node.stopReplicator(this.oldPeers, this.newPeers);
this.node.stopReplicator(this.oldLearners, this.newLearners);
}
+
+ // must be copied before clearing
+ final List<PeerId> resultPeers = new ArrayList<>(this.newPeers);
+
clearPeers();
clearLearners();
this.version++;
this.stage = Stage.STAGE_NONE;
this.nchanges = 0;
+
+ Closure oldDoneClosure = done;
+
if (this.done != null) {
-
Utils.runClosureInThread(this.node.getOptions().getCommonExecutor(), this.done,
st != null ? st :
+ this.done = (Status status) -> {
+ if (node.getOptions().getRaftGrpEvtsLsnr() != null) {
Review Comment:
I'd rather consider default no-op implementation in order not to check for
null
##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java:
##########
@@ -427,14 +430,31 @@ void reset(final Status st) {
this.node.stopReplicator(this.oldPeers, this.newPeers);
this.node.stopReplicator(this.oldLearners, this.newLearners);
}
+
+ // must be copied before clearing
+ final List<PeerId> resultPeers = new ArrayList<>(this.newPeers);
+
clearPeers();
clearLearners();
this.version++;
this.stage = Stage.STAGE_NONE;
this.nchanges = 0;
+
+ Closure oldDoneClosure = done;
+
if (this.done != null) {
-
Utils.runClosureInThread(this.node.getOptions().getCommonExecutor(), this.done,
st != null ? st :
+ this.done = (Status status) -> {
+ if (node.getOptions().getRaftGrpEvtsLsnr() != null) {
Review Comment:
I'd rather consider default no-op implementation in order not to check for
null.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]