public static enum Param.FutureMode extends Enum<Param.FutureMode> implements Param<Param.FutureMode>
CompletableFuture as a return type, it
implies the method called will be called asynchronously and that the
CompletableFuture returned will be completed once the method's
work is complete.
So, calling a method that returns CompletableFuture normally
implies that the method will allocate a thread to do that job. However,
there are situations when the user calls a method that returns
CompletableFuture and immediately calls CompletableFuture.get()
or similar methods to get the result. Calling such methods result in the
caller thread blocking in which case, having such method spawn another
thread is a waste of resources. So, for such situations, the caller can
pass in the COMPLETED param so that the internal logic avoids
creating a separate thread, since the caller thread will block to get
the result immediately.
By default, all methods returning CompletableFuture are
asynchronous, hence using the ASYNC future mode.
Param.FutureMode, Param.PersistenceMode| Modifier and Type | Field and Description |
|---|---|
static int |
ID |
| Modifier and Type | Method and Description |
|---|---|
static Param.FutureMode |
defaultValue()
Provides default future mode.
|
Param.FutureMode |
get()
Parameter's value.
|
int |
id()
A parameter's identifier.
|
static Param.FutureMode |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Param.FutureMode[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Param.FutureMode ASYNC
public static final Param.FutureMode COMPLETED
public static final int ID
public static Param.FutureMode[] values()
for (Param.FutureMode c : Param.FutureMode.values()) System.out.println(c);
public static Param.FutureMode 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 nullpublic int id()
ParamA numeric id makes it flexible enough to be stored in collections that take up low resources, such as arrays.
id in interface Param<Param.FutureMode>public Param.FutureMode get()
Paramget in interface Param<Param.FutureMode>public static Param.FutureMode defaultValue()
Copyright © 2015 JBoss, a division of Red Hat. All rights reserved.