Package org.drasyl.util
Class DrasylScheduler
java.lang.Object
org.drasyl.util.DrasylScheduler
It is an intentional behavior that this scheduler ensures that the JVM is not automatically
terminated once all sequential program flows have been processed. A corePoolSize of 0 would
prevent this behavior, but would also have a negative effect on performance. The ThreadPool would
not start to create a new thread to process until the workQueue limit is reached. Assuming that
the workQueue limit is never reached, the schedule would never start processing the already
submitted tasks.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static boolean
protected static boolean
static final long
-
Method Summary
Modifier and TypeMethodDescriptionstatic io.reactivex.rxjava3.core.Scheduler
Use thisScheduler
for slow and heavy task that does do longer computations.static io.reactivex.rxjava3.core.Scheduler
Use thisScheduler
for fast and light task that does not do heavy computations.static CompletableFuture<Void>
shutdown()
Shutdown the two schedulers.
-
Field Details
-
SHUTDOWN_TIMEOUT
public static final long SHUTDOWN_TIMEOUT- See Also:
-
lightSchedulerCreated
protected static volatile boolean lightSchedulerCreated -
heavySchedulerCreated
protected static volatile boolean heavySchedulerCreated
-
-
Method Details
-
getInstanceLight
public static io.reactivex.rxjava3.core.Scheduler getInstanceLight()Use thisScheduler
for fast and light task that does not do heavy computations.- Returns:
- a
Scheduler
for fast and light tasks
-
getInstanceHeavy
public static io.reactivex.rxjava3.core.Scheduler getInstanceHeavy()Use thisScheduler
for slow and heavy task that does do longer computations.- Returns:
- a
Scheduler
for slow and heavy tasks
-
shutdown
Shutdown the two schedulers.This operation cannot be undone. After performing this operation, no new task can be submitted!
-