Skip to content

Commit

Permalink
[hotfix][task] Optimize and simplify Task#isBackPressured
Browse files Browse the repository at this point in the history
  • Loading branch information
pnowojski committed Jan 6, 2021
1 parent a8ec54c commit 8d4be69
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -511,12 +511,12 @@ public boolean isBackPressured() {
if (invokable == null || consumableNotifyingPartitionWriters.length == 0 || !isRunning()) {
return false;
}
final CompletableFuture<?>[] outputFutures =
new CompletableFuture[consumableNotifyingPartitionWriters.length];
for (int i = 0; i < outputFutures.length; ++i) {
outputFutures[i] = consumableNotifyingPartitionWriters[i].getAvailableFuture();
for (int i = 0; i < consumableNotifyingPartitionWriters.length; ++i) {
if (!consumableNotifyingPartitionWriters[i].isAvailable()) {
return true;
}
}
return !CompletableFuture.allOf(outputFutures).isDone();
return false;
}

// ------------------------------------------------------------------------
Expand Down

0 comments on commit 8d4be69

Please sign in to comment.