-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #905 from benjchristensen/scheduler-defaults-plugin
RxJavaSchedulers Plugin
- Loading branch information
Showing
5 changed files
with
189 additions
and
8 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
rxjava-core/src/main/java/rx/plugins/RxJavaDefaultSchedulers.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* Copyright 2014 Netflix, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package rx.plugins; | ||
|
||
import rx.Scheduler; | ||
import rx.functions.Func0; | ||
|
||
/** | ||
* Define alternate Scheduler implementations to be returned by the `Schedulers` factory methods. | ||
* <p> | ||
* See {@link RxJavaPlugins} or the RxJava GitHub Wiki for information on configuring plugins: <a | ||
* href="https://github.com/Netflix/RxJava/wiki/Plugins">https://github.com/Netflix/RxJava/wiki/Plugins</a>. | ||
*/ | ||
public abstract class RxJavaDefaultSchedulers { | ||
|
||
/** | ||
* Factory of Scheduler to return from {@link Schedulers.computation()} or null if default should be used. | ||
*/ | ||
public abstract Func0<Scheduler> getComputationSchedulerFactory(); | ||
|
||
/** | ||
* Factory of Scheduler to return from {@link Schedulers.io()} or null if default should be used. | ||
*/ | ||
public abstract Func0<Scheduler> getIOSchedulerFactory(); | ||
|
||
/** | ||
* Factory of Scheduler to return from {@link Schedulers.newThread()} or null if default should be used. | ||
*/ | ||
public abstract Func0<Scheduler> getNewThreadSchedulerFactory(); | ||
} |
46 changes: 46 additions & 0 deletions
46
rxjava-core/src/main/java/rx/plugins/RxJavaDefaultSchedulersDefault.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* Copyright 2014 Netflix, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package rx.plugins; | ||
|
||
import rx.Scheduler; | ||
import rx.functions.Func0; | ||
|
||
/** | ||
* Default implementation of {@link RxJavaErrorHandler} that does nothing. | ||
* | ||
* @ExcludeFromJavadoc | ||
*/ | ||
public class RxJavaDefaultSchedulersDefault extends RxJavaDefaultSchedulers { | ||
|
||
private static RxJavaDefaultSchedulersDefault INSTANCE = new RxJavaDefaultSchedulersDefault(); | ||
|
||
public Func0<Scheduler> getComputationSchedulerFactory() { | ||
return null; | ||
} | ||
|
||
public Func0<Scheduler> getIOSchedulerFactory() { | ||
return null; | ||
} | ||
|
||
public Func0<Scheduler> getNewThreadSchedulerFactory() { | ||
return null; | ||
} | ||
|
||
public static RxJavaDefaultSchedulers getInstance() { | ||
return INSTANCE; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters