Skip to content

Commit

Permalink
Added waitForComplete in result set
Browse files Browse the repository at this point in the history
  • Loading branch information
Smudgge committed Nov 19, 2023
1 parent 8e44a87 commit 273cf03
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,23 @@ public CompletableResultSet(int size) {
this.containsCancelled = false;
}

/**
* Wait for the results to be completed.
*
* @return This instance with completed result set.
*/
public @NotNull CompletableResultSet<T> waitForComplete() {
while (!this.isComplete()) {
try {
Thread.sleep(LOCK_TIME_MILLS);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}

return this;
}

/**
* Used to wait for the final result.
* This will park the current thread until the
Expand Down

0 comments on commit 273cf03

Please sign in to comment.