public enum ThreadCount extends Enum<ThreadCount>
Runtime.availableProcessors().| Enum Constant and Description |
|---|
ALL
All possible non-competing threads.
|
HALF
The greater of one and half of
ALL. |
N_MINUS_2
The greater of one and two less than
ALL. |
ONE
A single thread.
|
QUARTER
The greater of one and a quarter of
ALL. |
| Modifier and Type | Method and Description |
|---|---|
abstract int |
value()
The number of threads relative to the number of available processors on a
system.
|
static ThreadCount |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static ThreadCount[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ThreadCount ONE
MoreExecutors.directExecutor() or skip using an
ExecutorService altogether, and all calculations will be run on the
thread from which a program was called. This is useful for debugging.public static final ThreadCount QUARTER
ALL.public static final ThreadCount HALF
ALL.public static final ThreadCount N_MINUS_2
ALL.public static final ThreadCount ALL
public static ThreadCount[] values()
for (ThreadCount c : ThreadCount.values()) System.out.println(c);
public static ThreadCount 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 abstract int value()