Package rx.internal.schedulers
Class CachedThreadScheduler
java.lang.Object
rx.Scheduler
rx.internal.schedulers.CachedThreadScheduler
- All Implemented Interfaces:
SchedulerLifecycle
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class(package private) static final class(package private) static final classNested classes/interfaces inherited from class rx.Scheduler
Scheduler.Worker -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longprivate static final TimeUnit(package private) static final CachedThreadScheduler.CachedWorkerPool(package private) final AtomicReference<CachedThreadScheduler.CachedWorkerPool> (package private) static final CachedThreadScheduler.ThreadWorker(package private) final ThreadFactory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves or creates a newScheduler.Workerthat represents serial execution of actions.voidshutdown()Instructs the Scheduler instance to stop threads and stop accepting tasks on any outstanding Workers.voidstart()Allows the Scheduler instance to start threads and accept tasks on them.
-
Field Details
-
KEEP_ALIVE_TIME
private static final long KEEP_ALIVE_TIME- See Also:
-
KEEP_ALIVE_UNIT
-
SHUTDOWN_THREADWORKER
-
NONE
-
threadFactory
-
pool
-
-
Constructor Details
-
CachedThreadScheduler
-
-
Method Details
-
start
public void start()Description copied from interface:SchedulerLifecycleAllows the Scheduler instance to start threads and accept tasks on them.Implementations should make sure the call is idempotent and threadsafe.
- Specified by:
startin interfaceSchedulerLifecycle
-
shutdown
public void shutdown()Description copied from interface:SchedulerLifecycleInstructs the Scheduler instance to stop threads and stop accepting tasks on any outstanding Workers.Implementations should make sure the call is idempotent and threadsafe.
- Specified by:
shutdownin interfaceSchedulerLifecycle
-
createWorker
Description copied from class:SchedulerRetrieves or creates a newScheduler.Workerthat represents serial execution of actions.When work is completed it should be unsubscribed using
Subscription.unsubscribe().Work on a
Scheduler.Workeris guaranteed to be sequential.- Specified by:
createWorkerin classScheduler- Returns:
- a Worker representing a serial queue of actions to be executed
-