Class ExecutorScheduler.ExecutorWorker
- java.lang.Object
-
- io.reactivex.rxjava3.core.Scheduler.Worker
-
- io.reactivex.rxjava3.internal.schedulers.ExecutorScheduler.ExecutorWorker
-
- All Implemented Interfaces:
Disposable
,java.lang.Runnable
- Enclosing class:
- ExecutorScheduler
public static final class ExecutorScheduler.ExecutorWorker extends Scheduler.Worker implements java.lang.Runnable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
ExecutorScheduler.ExecutorWorker.BooleanRunnable
(package private) static class
ExecutorScheduler.ExecutorWorker.InterruptibleRunnable
Wrapper for aRunnable
with additional logic for handling interruption on a shared thread, similar to how Java Executors do it.(package private) class
ExecutorScheduler.ExecutorWorker.SequentialDispose
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean
disposed
(package private) java.util.concurrent.Executor
executor
(package private) boolean
fair
(package private) boolean
interruptibleWorker
(package private) MpscLinkedQueue<java.lang.Runnable>
queue
(package private) CompositeDisposable
tasks
(package private) java.util.concurrent.atomic.AtomicInteger
wip
-
Constructor Summary
Constructors Constructor Description ExecutorWorker(java.util.concurrent.Executor executor, boolean interruptibleWorker, boolean fair)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Dispose the resource, the operation should be idempotent.boolean
isDisposed()
Returns true if this resource has been disposed.void
run()
(package private) void
runEager()
(package private) void
runFair()
@NonNull Disposable
schedule(@NonNull java.lang.Runnable run)
Schedules a Runnable for execution without any time delay.@NonNull Disposable
schedule(@NonNull java.lang.Runnable run, long delay, @NonNull java.util.concurrent.TimeUnit unit)
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 io.reactivex.rxjava3.core.Scheduler.Worker
now, schedulePeriodically
-
-
-
-
Field Detail
-
interruptibleWorker
final boolean interruptibleWorker
-
fair
final boolean fair
-
executor
final java.util.concurrent.Executor executor
-
queue
final MpscLinkedQueue<java.lang.Runnable> queue
-
disposed
volatile boolean disposed
-
wip
final java.util.concurrent.atomic.AtomicInteger wip
-
tasks
final CompositeDisposable tasks
-
-
Method Detail
-
schedule
@NonNull public @NonNull Disposable schedule(@NonNull @NonNull java.lang.Runnable run)
Description copied from class:Scheduler.Worker
Schedules a Runnable for execution without any time delay.The default implementation delegates to
Scheduler.Worker.schedule(Runnable, long, TimeUnit)
.- Overrides:
schedule
in 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 java.lang.Runnable run, long delay, @NonNull @NonNull java.util.concurrent.TimeUnit unit)
Description copied from class:Scheduler.Worker
Schedules 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
delayTime
should be regarded as non-delayed schedule, i.e., as if theScheduler.Worker.schedule(Runnable)
was called.- Specified by:
schedule
in 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:Disposable
Dispose the resource, the operation should be idempotent.- Specified by:
dispose
in interfaceDisposable
-
isDisposed
public boolean isDisposed()
Description copied from interface:Disposable
Returns true if this resource has been disposed.- Specified by:
isDisposed
in interfaceDisposable
- Returns:
- true if this resource has been disposed
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
runFair
void runFair()
-
runEager
void runEager()
-
-