You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "Technoboy- (via GitHub)" <gi...@apache.org> on 2023/04/10 01:55:25 UTC
[GitHub] [pulsar] Technoboy- commented on a diff in pull request #19972: [fix][broker] Ignore and remove the replicator cursor when the remote cluster is absent
Technoboy- commented on code in PR #19972:
URL: https://github.com/apache/pulsar/pull/19972#discussion_r1161379180
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -1727,8 +1745,8 @@ CompletableFuture<Void> removeReplicator(String remoteCluster) {
String name = PersistentReplicator.getReplicatorName(replicatorPrefix, remoteCluster);
- replicators.get(remoteCluster).disconnect().thenRun(() -> {
-
+ Optional.ofNullable(replicators.get(remoteCluster)).map(Replicator::disconnect)
+ .orElse(CompletableFuture.completedFuture(null)).thenRun(() -> {
Review Comment:
`orElseGet` is better
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org