Skip to content

Commit

Permalink
Merge pull request #725 from benjchristensen/schedulers-naming
Browse files Browse the repository at this point in the history
Simpler computation/io naming for Schedulers
  • Loading branch information
benjchristensen committed Jan 6, 2014
2 parents 1363f61 + e2c31c2 commit 22b6b3d
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions rxjava-core/src/main/java/rx/schedulers/Schedulers.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,28 @@ public static Scheduler executor(ScheduledExecutorService executor) {
* <p>
* This can be used for event-loops, processing callbacks and other computational work.
* <p>
* Do not perform IO-bound work on this scheduler. Use {@link #threadPoolForComputation()} instead.
* Do not perform IO-bound work on this scheduler. Use {@link #io()} instead.
*
* @return {@link ExecutorScheduler} for computation-bound work.
* @Deprecated Use {@link #computation()}
*/
@Deprecated
public static Scheduler threadPoolForComputation() {
return executor(COMPUTATION_EXECUTOR);
}

/**
* {@link Scheduler} intended for computational work.
* <p>
* This can be used for event-loops, processing callbacks and other computational work.
* <p>
* Do not perform IO-bound work on this scheduler. Use {@link #io()} instead.
*
* @return {@link Scheduler} for computation-bound work.
*/
public static Scheduler computation() {
return executor(COMPUTATION_EXECUTOR);
}

/**
* {@link Scheduler} intended for IO-bound work.
Expand All @@ -104,13 +119,30 @@ public static Scheduler threadPoolForComputation() {
* <p>
* This can be used for asynchronously performing blocking IO.
* <p>
* Do not perform computational work on this scheduler. Use {@link #threadPoolForComputation()} instead.
* Do not perform computational work on this scheduler. Use {@link #computation()} instead.
*
* @return {@link ExecutorScheduler} for IO-bound work.
* @deprecated Use {@link #io()} instead.
*/
@Deprecated
public static Scheduler threadPoolForIO() {
return executor(IO_EXECUTOR);
}

/**
* {@link Scheduler} intended for IO-bound work.
* <p>
* The implementation is backed by an {@link Executor} thread-pool that will grow as needed.
* <p>
* This can be used for asynchronously performing blocking IO.
* <p>
* Do not perform computational work on this scheduler. Use {@link #computation()} instead.
*
* @return {@link ExecutorScheduler} for IO-bound work.
*/
public static Scheduler io() {
return executor(IO_EXECUTOR);
}

private static ScheduledExecutorService createComputationExecutor() {
int cores = Runtime.getRuntime().availableProcessors();
Expand Down

0 comments on commit 22b6b3d

Please sign in to comment.