-
Notifications
You must be signed in to change notification settings - Fork 0
Scheduler
Content TBD
You obtain a Scheduler from the factory methods described in the Schedulers class. The following table shows the varieties of Scheduler that are available to you by means of these methods:
Scheduler |
purpose |
|---|---|
Schedulers.computation( ) |
meant for computational work such as event-loops and callback processing; do not use this scheduler for I/O (use Schedulers.io( ) instead) |
Schedulers.currentThread( ) |
queues work to begin on the current thread after any already-queued work |
Schedulers.executor( ) |
queues work to be done on either an Executor or ScheduledExecutorService (Note that if you use an Executor instead of a ScheduledExecutorService then the Scheduler will use a system-wide Timer to handle delayed events.) |
Schedulers.immediate( ) |
schedules work to begin immediately in the current thread |
Schedulers.io( ) |
meant for I/O-bound work such as asynchronous performance of blocking I/O, this scheduler is backed by an Executor thread-pool that will grow as needed; for ordinary computational work, switch to Schedulers.computation( )
|
Schedulers.newThread( ) |
creates a new thread for each unit of work |
Some Observable operators in RxJava have alternate forms that allow you to set which Scheduler the operator will use for (at least some part of) its operation. For these operators, if you do not set the Scheduler, the operator will use the default computation Scheduler.
Other operators do not have a form that permits you to set their Schedulers. Some of these, like startWith, empty, error, from, just, merge, and range do not use a Scheduler. A few others use particular schedulers, as in the following table:
| operator | Scheduler |
|---|---|
parallelMerge |
currentThread |
repeat |
currentThread |
timeInterval |
immediate |
timestamp |
immediate |
A Netflix Original Production
Tech Blog | Twitter @NetflixOSS | Twitter @RxJava | Jobs
- Introduction
- Getting Started
- JavaDoc
- How to Use RxJava
- Additional Reading
- The Observable
- Operators (Alphabetical List)
- Async
- Blocking Observable
- Combining
- Conditional & Boolean
- Connectable Observable
- Error Handling
- Filtering
- Mathematical and Aggregate
- Observable Creation
- String
- Transformational
- Utility Operators
- Implementing Custom Operators, previous
- Backpressure
- Error Handling
- Plugins
- Schedulers
- Subjects
- The RxJava Android Module
- RxJava 2.0
- How to Contribute