public enum TimeoutStrategy extends Enum<TimeoutStrategy>
CompletableFuture.get(long, TimeUnit). The minimum isPREVENT_NEW,
which always applies and is the default. The other strategies indicate whether or not to interrupt any other
threads spawned by that request. As is standard with Java, if and how any user task POJO responds to an
interrupt is completely with the control of that task POJO.| Enum Constant and Description |
|---|
INTERRUPT_AT_NEXT_OPPORTUNITY
Once a timeout occurs, in addition to
PREVENT_NEW, the next time any task is attempted then
interrupt all others. |
INTERRUPT_IMMEDIATELY
Once a timeout occurs, in addition to
PREVENT_NEW, immediately interrupt all tasks. |
PREVENT_NEW
Once a timeout occurs, don't start new tasks but don't interrupt existing tasks.
|
| Modifier and Type | Method and Description |
|---|---|
static TimeoutStrategy |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static TimeoutStrategy[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final TimeoutStrategy PREVENT_NEW
public static final TimeoutStrategy INTERRUPT_AT_NEXT_OPPORTUNITY
PREVENT_NEW, the next time any task is attempted then
interrupt all others.public static final TimeoutStrategy INTERRUPT_IMMEDIATELY
PREVENT_NEW, immediately interrupt all tasks. This is
the strongest reaction, and incurs the expense spawning a dedicated thread to watch for the timeout.public static TimeoutStrategy[] values()
for (TimeoutStrategy c : TimeoutStrategy.values()) System.out.println(c);
public static TimeoutStrategy valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullCopyright © 2021. All rights reserved.