public enum SpawnMode extends Enum<SpawnMode>
| Enum Constant and Description |
|---|
ALWAYS_SPAWN
Always spawn except for 'light' task methods.
|
DONT_SPAWN_UNLESS_EXPLICIT
Don't spawn unless a
TaskInterface.runSpawned() request is made on a task. |
NEVER_MAIN
Avoid using main (calling thread) to execute task methods, spawning threads instead,
unless the task methods are marked as 'light'.
|
NEVER_SPAWN
Never spawn under any circumstance.
|
WHEN_NEEDED
Spawn whenever more than one task can be started at the same time.
|
WHEN_NEEDED_NO_REUSE
Like
WHEN_NEEDED, but avoids any attempt to reuse main thread for processing. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isMainThreadReusable()
Returns true if this mode allows for the main thread can be picked up while idle and otherwise
waiting for a CompletableFuture to complete, and used to to process spawning task methods.
|
static SpawnMode |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static SpawnMode[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final SpawnMode WHEN_NEEDED
public static final SpawnMode WHEN_NEEDED_NO_REUSE
WHEN_NEEDED, but avoids any attempt to reuse main thread for processing.
That 'reuse' occurs when the main thread is sitting idle with no work to do while
spawned threads need themselves to spawn threads.public static final SpawnMode NEVER_MAIN
public static final SpawnMode ALWAYS_SPAWN
NEVER_MAIN,
as the main thread will similarly not execute any tasks. Every task will run in its own logical thread
(as in a pull from the thread pool, where physical threads may of course be reused).public static final SpawnMode NEVER_SPAWN
public static final SpawnMode DONT_SPAWN_UNLESS_EXPLICIT
TaskInterface.runSpawned() request is made on a task.public static SpawnMode[] values()
for (SpawnMode c : SpawnMode.values()) System.out.println(c);
public static SpawnMode 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 boolean isMainThreadReusable()
Copyright © 2021. All rights reserved.