@Internal public interface AvailabilityListener
CompletableFuture
. For usage check out for example AsyncDataInput
.Modifier and Type | Field and Description |
---|---|
static CompletableFuture<?> |
AVAILABLE
Constant that allows to avoid volatile checks
CompletableFuture.isDone() . |
Modifier and Type | Method and Description |
---|---|
CompletableFuture<?> |
isAvailable()
Check if this instance is available for further processing.
|
boolean |
isFinished() |
static final CompletableFuture<?> AVAILABLE
CompletableFuture.isDone()
. Check
isAvailable()
for more explanation.boolean isFinished()
CompletableFuture<?> isAvailable()
When hot looping to avoid volatile access in CompletableFuture.isDone()
user of
this method should do the following check:
AvailabilityListener input = ...;
if (input.isAvailable() == AvailabilityListener.AVAILABLE || input.isAvailable().isDone()) {
// do something;
}
AVAILABLE
should be returned. Previously returned
not completed futures should become completed once there is more input available or if
the input isFinished()
.Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.