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 class
Nested classes/interfaces inherited from class rx.Scheduler
Scheduler.Worker
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
private 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.Worker
that represents serial execution of actions.void
shutdown()
Instructs the Scheduler instance to stop threads and stop accepting tasks on any outstanding Workers.void
start()
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:SchedulerLifecycle
Allows the Scheduler instance to start threads and accept tasks on them.Implementations should make sure the call is idempotent and threadsafe.
- Specified by:
start
in interfaceSchedulerLifecycle
-
shutdown
public void shutdown()Description copied from interface:SchedulerLifecycle
Instructs 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:
shutdown
in interfaceSchedulerLifecycle
-
createWorker
Description copied from class:Scheduler
Retrieves or creates a newScheduler.Worker
that represents serial execution of actions.When work is completed it should be unsubscribed using
Subscription.unsubscribe()
.Work on a
Scheduler.Worker
is guaranteed to be sequential.- Specified by:
createWorker
in classScheduler
- Returns:
- a Worker representing a serial queue of actions to be executed
-