Top Description Fields Constructors Methods
rx.internal.schedulers

public final Class GenericScheduledExecutorService

extends Object
implements SchedulerLifecycle
Class Inheritance
All Implemented Interfaces
rx.internal.schedulers.SchedulerLifecycle
Imports
java.util.concurrent.*, java.util.concurrent.atomic.AtomicReference, rx.Scheduler

A default ScheduledExecutorService that can be used for scheduling actions when a Scheduler implementation doesn't have that ability.

For example if a Scheduler is given an Executor or {ExecutorService instead of ScheduledExecutorService.

Note

No actual work should be done on tasks submitted to this executor. Submit a task with the appropriate delay which then in turn invokes the work asynchronously on the appropriate Scheduler implementation. This means for example that you would not use this approach along with TrampolineScheduler or ImmediateScheduler.

Field Summary

Modifier and TypeField and Description
private final AtomicReference<ScheduledExecutorService[]>
public static final GenericScheduledExecutorService
private static final ScheduledExecutorService[]
private static int
roundRobin

We don't use atomics with this because thread-assignment is random anyway.

private static final ScheduledExecutorService

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static ScheduledExecutorService

Returns:

ScheduledExecutorService for generic use.
getInstance
()

Returns one of the single-threaded ScheduledExecutorService helper executors.

public void
shutdown()

Implements rx.internal.schedulers.SchedulerLifecycle.shutdown.

Instructs the Scheduler instance to stop threads and stop accepting tasks on any outstanding Workers.
public void
start()

Implements rx.internal.schedulers.SchedulerLifecycle.start.

Allows the Scheduler instance to start threads and accept tasks on them.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

executorback to summary
private final AtomicReference<ScheduledExecutorService[]> executor
INSTANCEback to summary
public static final GenericScheduledExecutorService INSTANCE
NONEback to summary
private static final ScheduledExecutorService[] NONE
roundRobinback to summary
private static int roundRobin

We don't use atomics with this because thread-assignment is random anyway.

SHUTDOWNback to summary
private static final ScheduledExecutorService SHUTDOWN

Constructor Detail

GenericScheduledExecutorServiceback to summary
private GenericScheduledExecutorService()

Method Detail

getInstanceback to summary
public static ScheduledExecutorService getInstance()

Returns one of the single-threaded ScheduledExecutorService helper executors.

Returns:ScheduledExecutorService

ScheduledExecutorService for generic use.

shutdownback to summary
public void shutdown()

Implements rx.internal.schedulers.SchedulerLifecycle.shutdown.

Doc from rx.internal.schedulers.SchedulerLifecycle.shutdown.

Instructs the Scheduler instance to stop threads and stop accepting tasks on any outstanding Workers.

Implementations should make sure the call is idempotent and thread-safe.

Annotations
@Override
startback to summary
public void start()

Implements rx.internal.schedulers.SchedulerLifecycle.start.

Doc from rx.internal.schedulers.SchedulerLifecycle.start.

Allows the Scheduler instance to start threads and accept tasks on them.

Implementations should make sure the call is idempotent and thread-safe.

Annotations
@Override