StefanRRichter commented on a change in pull request #7665: [FLINK-11551][rpc]
Allow RpcEndpoint to execute asynchronous stop operations
URL: https://github.com/apache/flink/pull/7665#discussion_r255893471
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcService.java
##########
@@ -315,33 +315,48 @@ public void stopServer(RpcServer selfGateway) {
}
if (rpcEndpoint != null) {
-
akkaClient.getActorRef().tell(PoisonPill.getInstance(), ActorRef.noSender());
+ terminateAkkaRpcActor(akkaClient.getActorRef(),
rpcEndpoint);
} else {
LOG.debug("RPC endpoint {} already stopped or
from different RPC service", selfGateway.getAddress());
}
}
}
+ private CompletableFuture<Void> terminateAkkaRpcActor(ActorRef
akkaRpcActorRef, RpcEndpoint rpcEndpoint) {
+ akkaRpcActorRef.tell(ControlMessages.TERMINATE,
ActorRef.noSender());
+
+ return rpcEndpoint.getTerminationFuture();
+ }
+
@Override
public CompletableFuture<Void> stopService() {
+ LOG.info("Stopping Akka RPC service.");
+
+ final CompletableFuture<Void> akkaRpcActorsTerminationFuture;
+
synchronized (lock) {
if (stopped) {
return terminationFuture;
}
stopped = true;
- }
- LOG.info("Stopping Akka RPC service.");
+ final Collection<CompletableFuture<Void>>
akkaRpcActorTerminationFutures = new ArrayList<>(actors.size());
Review comment:
The section that starts here could go into a private method like
`CompletableFuture<Void> terminateAllActors()`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services