Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -165,21 +165,6 @@ protected CompletableFuture<Void> tryCreatePartitionsAsync(int numPartitions) {
return FutureUtil.waitForAll(futures);
}

protected CompletableFuture<Void> tryCreateExtendedPartitionsAsync(int oldNumPartitions, int numPartitions) {
if (!topicName.isPersistent()) {
return CompletableFuture.completedFuture(null);
}
if (numPartitions <= oldNumPartitions) {
return CompletableFuture.failedFuture(new RestException(Status.NOT_ACCEPTABLE,
"Number of new partitions must be greater than existing number of partitions"));
}
List<CompletableFuture<Void>> futures = new ArrayList<>(numPartitions - oldNumPartitions);
for (int i = oldNumPartitions; i < numPartitions; i++) {
futures.add(tryCreatePartitionAsync(i));
}
return FutureUtil.waitForAll(futures);
}

private CompletableFuture<Void> tryCreatePartitionAsync(final int partition) {
CompletableFuture<Void> result = new CompletableFuture<>();
getPulsarResources().getTopicResources().createPersistentTopicAsync(topicName.getPartition(partition))
Expand Down
Loading