runnable.call(call, now); return new DeleteTopicsResult(new HashMap<>(topicFutures));
@Override public DeleteTopicsResult deleteTopics(Collection<String> topicsToDelete, DeleteTopicsOptions options) { Map<String, KafkaFuture<Void>> deleteTopicsResult = new HashMap<>(); if (timeoutNextRequests > 0) { for (final String topicName : topicsToDelete) { KafkaFutureImpl<Void> future = new KafkaFutureImpl<>(); future.completeExceptionally(new TimeoutException()); deleteTopicsResult.put(topicName, future); } --timeoutNextRequests; return new DeleteTopicsResult(deleteTopicsResult); } for (final String topicName : topicsToDelete) { KafkaFutureImpl<Void> future = new KafkaFutureImpl<>(); if (allTopics.remove(topicName) == null) { future.completeExceptionally(new UnknownTopicOrPartitionException(String.format("Topic %s does not exist.", topicName))); } else { future.complete(null); } deleteTopicsResult.put(topicName, future); } return new DeleteTopicsResult(deleteTopicsResult); }