Java Utililty Methods AtomicInteger

List of utility methods to do AtomicInteger

Description

The list of methods to do AtomicInteger are organized into topic(s).

Method

CompletableFuturewaitForAll(List> futures)
Return a future that represents the completion of the futures in the provided list
if (futures.isEmpty()) {
    return CompletableFuture.completedFuture(null);
final CompletableFuture<T> compositeFuture = new CompletableFuture<>();
final AtomicInteger count = new AtomicInteger(futures.size());
final AtomicReference<Throwable> exception = new AtomicReference<>();
for (CompletableFuture<T> future : futures) {
    future.whenComplete((r, ex) -> {
...
voidwaitForEvents(long sleepTime, AtomicBoolean condition, long timeout)
wait For Events
long currentWaitTime = 0;
long startTime = System.currentTimeMillis();
while (!condition.get() && (currentWaitTime <= timeout)) {
    Thread.sleep(sleepTime);
    currentWaitTime = System.currentTimeMillis() - startTime;
voidwaitForEvents(long sleepTime, int expectedCount, AtomicInteger actualCount, long timeout)
wait For Events
long currentWaitTime = 0;
long startTime = System.currentTimeMillis();
while ((actualCount.get() < expectedCount) && (currentWaitTime <= timeout)) {
    Thread.sleep(sleepTime);
    currentWaitTime = System.currentTimeMillis() - startTime;
voidwaitForEvents(long sleepTime, int expectedCount, AtomicInteger actualCount, long timeout)
wait For Events
long currentWaitTime = 0;
long startTime = System.currentTimeMillis();
while ((actualCount.get() < expectedCount) && (currentWaitTime <= timeout)) {
    Thread.sleep(sleepTime);
    currentWaitTime = System.currentTimeMillis() - startTime;