cn.wandersnail.common.http.util.SchedulerUtils Maven / Gradle / Ivy
package cn.wandersnail.common.http.util;
import io.reactivex.CompletableTransformer;
import io.reactivex.FlowableTransformer;
import io.reactivex.MaybeTransformer;
import io.reactivex.ObservableTransformer;
import io.reactivex.SingleTransformer;
import io.reactivex.schedulers.Schedulers;
/**
* date: 2019/8/23 16:39
* author: zengfansheng
*/
public class SchedulerUtils {
public static ObservableTransformer applyGeneralObservableSchedulers() {
return upstream -> upstream.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.observeOn(Schedulers.io());
}
public static FlowableTransformer applyGeneralFlowableSchedulers() {
return upstream -> upstream.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.observeOn(Schedulers.io());
}
public static SingleTransformer applyGeneralSingleSchedulers() {
return upstream -> upstream.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.observeOn(Schedulers.io());
}
public static MaybeTransformer applyGeneralMaybeSchedulers() {
return upstream -> upstream.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.observeOn(Schedulers.io());
}
public static CompletableTransformer applyGeneralCompletableSchedulers() {
return upstream -> upstream.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.observeOn(Schedulers.io());
}
}