amaliujia commented on code in PR #1710:
URL: https://github.com/apache/ratis/pull/1710#discussion_r4708212442
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/TransferLeadership.java:
##########
@@ -317,7 +317,9 @@ private CompletableFuture<RaftClientReply> start(Context
context) {
final Result result = tryTransferLeadership(context);
final Result.Type type = result.getType();
if (type != Result.Type.SUCCESS && type != Result.Type.NOT_UP_TO_DATE) {
- pendingRequest.complete(result);
+ if (pending.compareAndSet(pendingRequest, null)) {
+ pendingRequest.complete(result);
+ }
Review Comment:
I see. The implementation contract is then who set the reference as null
(thus take the reference) will own the lifecycle.
--
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]