Class ExecutorScheduler.ExecutorWorker
java.lang.Object
io.reactivex.rxjava3.core.Scheduler.Worker
io.reactivex.rxjava3.internal.schedulers.ExecutorScheduler.ExecutorWorker
- All Implemented Interfaces:
Disposable, Runnable
- Enclosing class:
ExecutorScheduler
public static final class ExecutorScheduler.ExecutorWorker
extends Scheduler.Worker
implements Runnable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class(package private) static final classWrapper for aRunnablewith additional logic for handling interruption on a shared thread, similar to how Java Executors do it.(package private) final class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) boolean(package private) final Executor(package private) final boolean(package private) final boolean(package private) final MpscLinkedQueue<Runnable> (package private) final CompositeDisposable(package private) final AtomicInteger -
Constructor Summary
ConstructorsConstructorDescriptionExecutorWorker(Executor executor, boolean interruptibleWorker, boolean fair) -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Dispose the resource, the operation should be idempotent.booleanReturns true if this resource has been disposed.voidrun()(package private) voidrunEager()(package private) voidrunFair()Schedules a Runnable for execution without any time delay.Schedules an Runnable for execution at some point in the future specified by a time delay relative to the current time.Methods inherited from class Scheduler.Worker
now, schedulePeriodically
-
Field Details
-
interruptibleWorker
final boolean interruptibleWorker -
fair
final boolean fair -
executor
-
queue
-
disposed
volatile boolean disposed -
wip
-
tasks
-
-
Constructor Details
-
ExecutorWorker
-
-
Method Details
-
schedule
Description copied from class:Scheduler.WorkerSchedules a Runnable for execution without any time delay.The default implementation delegates to
Scheduler.Worker.schedule(Runnable, long, TimeUnit).- Overrides:
schedulein classScheduler.Worker- Parameters:
run- Runnable to schedule- Returns:
- a Disposable to be able to unsubscribe the action (cancel it if not executed)
-
schedule
@NonNull public @NonNull Disposable schedule(@NonNull @NonNull Runnable run, long delay, @NonNull @NonNull TimeUnit unit) Description copied from class:Scheduler.WorkerSchedules an Runnable for execution at some point in the future specified by a time delay relative to the current time.Note to implementors: non-positive
delayTimeshould be regarded as non-delayed schedule, i.e., as if theScheduler.Worker.schedule(Runnable)was called.- Specified by:
schedulein classScheduler.Worker- Parameters:
run- the Runnable to scheduledelay- time to "wait" before executing the action; non-positive values indicate an non-delayed scheduleunit- the time unit ofdelayTime- Returns:
- a Disposable to be able to unsubscribe the action (cancel it if not executed)
-
dispose
public void dispose()Description copied from interface:DisposableDispose the resource, the operation should be idempotent.- Specified by:
disposein interfaceDisposable
-
isDisposed
public boolean isDisposed()Description copied from interface:DisposableReturns true if this resource has been disposed.- Specified by:
isDisposedin interfaceDisposable- Returns:
- true if this resource has been disposed
-
run
-
runFair
void runFair() -
runEager
void runEager()
-