use of org.opendaylight.controller.cluster.sharding.messages.NotifyProducerRemoved in project controller by opendaylight.
the class ShardedDataTreeActor method onProducerRemoved.
private void onProducerRemoved(final ProducerRemoved message) {
LOG.debug("Received ProducerRemoved: {}", message);
final List<CompletableFuture<Object>> futures = new ArrayList<>();
for (final String address : resolver.getShardingServicePeerActorAddresses()) {
final ActorSelection selection = actorSystem.actorSelection(address);
futures.add(FutureConverters.toJava(actorContext.executeOperationAsync(selection, new NotifyProducerRemoved(message.getSubtrees()))).toCompletableFuture());
}
final CompletableFuture<Void> combinedFuture = CompletableFuture.allOf(futures.toArray(new CompletableFuture[futures.size()]));
final ActorRef respondTo = getSender();
combinedFuture.thenRun(() -> respondTo.tell(new Status.Success(null), self())).exceptionally(e -> {
respondTo.tell(new Status.Failure(null), self());
return null;
});
}
Aggregations