Top Description Fields Constructors Methods
io.reactivex.rxjava3.internal.schedulers

public Class NewThreadWorker

extends Worker
Class Inheritance
Known Direct Subclasses
io.reactivex.rxjava3.internal.schedulers.ComputationScheduler.PoolWorker, io.reactivex.rxjava3.internal.schedulers.IoScheduler.ThreadWorker
Imports
java.util.concurrent.*, io.reactivex.rxjava3.annotations.*, io.reactivex.rxjava3.core.Scheduler, io.reactivex.rxjava3.disposables.*, io.reactivex.rxjava3.internal.disposables.*, io.reactivex.rxjava3.plugins.RxJavaPlugins

Base class that manages a single-threaded ScheduledExecutorService as a worker but doesn't perform task-tracking operations.

Field Summary

Modifier and TypeField and Description
pack-priv volatile boolean
private final ScheduledExecutorService

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Implements io.reactivex.rxjava3.disposables.Disposable.dispose.

Dispose the resource, the operation should be idempotent.
public boolean
isDisposed()

Implements io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Returns true if this resource has been disposed.
public @NonNull Disposable
public @NonNull Disposable
schedule(final @NonNull Runnable action, long delayTime, @NonNull TimeUnit unit)

public @NonNull ScheduledRunnable

Returns:

the ScheduledRunnable instance
scheduleActual
(final Runnable
the runnable instance
run
,
long
the time to delay the execution
delayTime
,
@NonNull TimeUnit
the time unit
unit
,
@Nullable DisposableContainer
the optional tracker parent to add the created ScheduledRunnable instance to before it gets scheduled
parent
)

Wraps and returns the given runnable into a ScheduledRunnable and schedules it on the underlying ScheduledExecutorService.

public Disposable

Returns:

the ScheduledRunnable instance
scheduleDirect
(final Runnable
the Runnable to execute in a delayed fashion
run
,
long
the delay amount
delayTime
,
TimeUnit
the delay time unit
unit
)

Schedules the given runnable on the underlying executor directly and returns its future wrapped into a Disposable.

public Disposable

Returns:

the ScheduledRunnable instance
schedulePeriodicallyDirect
(Runnable
the Runnable to execute in a periodic fashion
run
,
long
the initial delay amount
initialDelay
,
long
the repeat period amount
period
,
TimeUnit
the time unit for both the initialDelay and period
unit
)

Schedules the given runnable periodically on the underlying executor directly and returns its future wrapped into a Disposable.

public void
shutdown()

Shuts down the underlying executor in a non-interrupting fashion.

Inherited from io.reactivex.rxjava3.core.Scheduler.Worker:
nowschedulescheduleschedulePeriodically

Field Detail

disposedback to summary
pack-priv volatile boolean disposed
executorback to summary
private final ScheduledExecutorService executor

Constructor Detail

NewThreadWorkerback to summary
public NewThreadWorker(ThreadFactory threadFactory)

Method Detail

disposeback to summary
public void dispose()

Implements io.reactivex.rxjava3.disposables.Disposable.dispose.

Doc from io.reactivex.rxjava3.disposables.Disposable.dispose.

Dispose the resource, the operation should be idempotent.

Annotations
@Override
isDisposedback to summary
public boolean isDisposed()

Implements io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Doc from io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Returns true if this resource has been disposed.

Returns:boolean

true if this resource has been disposed

Annotations
@Override
scheduleback to summary
public @NonNull Disposable schedule(final @NonNull Runnable run)
Annotations
@NonNull
@Override
scheduleback to summary
public @NonNull Disposable schedule(final @NonNull Runnable action, long delayTime, @NonNull TimeUnit unit)
Annotations
@NonNull
@Override
scheduleActualback to summary
public @NonNull ScheduledRunnable scheduleActual(final Runnable run, long delayTime, @NonNull TimeUnit unit, @Nullable DisposableContainer parent)

Wraps and returns the given runnable into a ScheduledRunnable and schedules it on the underlying ScheduledExecutorService.

Parameters
run:Runnable

the runnable instance

delayTime:long

the time to delay the execution

unit:@NonNull TimeUnit

the time unit

parent:@Nullable DisposableContainer

the optional tracker parent to add the created ScheduledRunnable instance to before it gets scheduled

Returns:@NonNull ScheduledRunnable

the ScheduledRunnable instance

Annotations
@NonNull
scheduleDirectback to summary
public Disposable scheduleDirect(final Runnable run, long delayTime, TimeUnit unit)

Schedules the given runnable on the underlying executor directly and returns its future wrapped into a Disposable.

Parameters
run:Runnable

the Runnable to execute in a delayed fashion

delayTime:long

the delay amount

unit:TimeUnit

the delay time unit

Returns:Disposable

the ScheduledRunnable instance

schedulePeriodicallyDirectback to summary
public Disposable schedulePeriodicallyDirect(Runnable run, long initialDelay, long period, TimeUnit unit)

Schedules the given runnable periodically on the underlying executor directly and returns its future wrapped into a Disposable.

Parameters
run:Runnable

the Runnable to execute in a periodic fashion

initialDelay:long

the initial delay amount

period:long

the repeat period amount

unit:TimeUnit

the time unit for both the initialDelay and period

Returns:Disposable

the ScheduledRunnable instance

shutdownback to summary
public void shutdown()

Shuts down the underlying executor in a non-interrupting fashion.