Java Code Examples for io.reactivex.schedulers.Schedulers#io()

The following examples show how to use io.reactivex.schedulers.Schedulers#io() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThreadModeCastToSchedulersUtil.java    From RxEventBus with Apache License 2.0 6 votes vote down vote up
public static Scheduler cast(ThreadMode threadMode) {
    Scheduler scheduler = null;
    switch (threadMode) {
        case COMPUTATION:
            scheduler = Schedulers.computation();
            break;
        case NEWTHREAD:
            scheduler = Schedulers.newThread();
            break;
        case MAIN:
            scheduler = AndroidSchedulers.mainThread();
            break;
        case IO:
            scheduler = Schedulers.io();
            break;
        default:
            scheduler = AndroidSchedulers.mainThread();
            break;
    }
    return scheduler;
}
 
Example 2
Source File: CurrenciesActivityModule.java    From exchange-rates-mvvm with Apache License 2.0 5 votes vote down vote up
@Provides
@CurrenciesActivityScope
@Override
public GetCurrenciesUseCase provideGetCurrenciesUseCase(final CurrencyRepository currencyRepository,
                                                        final PreferencesData preferencesData) {
    return new GetCurrenciesUseCase(Schedulers.io(), AndroidSchedulers.mainThread(),
            currencyRepository,
            preferencesData);
}
 
Example 3
Source File: StorageClient.java    From java-unified-sdk with Apache License 2.0 5 votes vote down vote up
private Observable wrapObservableInBackground(Observable observable) {
  if (null == observable) {
    return null;
  }
  Scheduler scheduler = Schedulers.io();
  if (asynchronized) {
    observable = observable.subscribeOn(scheduler);
  }
  if (null != defaultCreator) {
    observable = observable.observeOn(scheduler);
  }
  return observable;
}
 
Example 4
Source File: HeartBeatTask.java    From StompProtocolAndroid with MIT License 5 votes vote down vote up
/**
 * Analise heart-beat sent from server (if any), to adjust the frequency.
 * Startup the heart-beat logic.
 */
private void heartBeatHandshake(final String heartBeatHeader) {
    if (heartBeatHeader != null) {
        // The heart-beat header is OPTIONAL
        final String[] heartbeats = heartBeatHeader.split(",");
        if (clientHeartbeatNew > 0) {
            //there will be heart-beats every MAX(<cx>,<sy>) milliseconds
            clientHeartbeat = Math.max(clientHeartbeatNew, Integer.parseInt(heartbeats[1]));
        }
        if (serverHeartbeatNew > 0) {
            //there will be heart-beats every MAX(<cx>,<sy>) milliseconds
            serverHeartbeat = Math.max(serverHeartbeatNew, Integer.parseInt(heartbeats[0]));
        }
    }
    if (clientHeartbeat > 0 || serverHeartbeat > 0) {
        scheduler = Schedulers.io();
        if (clientHeartbeat > 0) {
            //client MUST/WANT send heart-beat
            Log.d(TAG, "Client will send heart-beat every " + clientHeartbeat + " ms");
            scheduleClientHeartBeat();
        }
        if (serverHeartbeat > 0) {
            Log.d(TAG, "Client will listen to server heart-beat every " + serverHeartbeat + " ms");
            //client WANT to listen to server heart-beat
            scheduleServerHeartBeatCheck();

            // initialize the server heartbeat
            lastServerHeartBeat = System.currentTimeMillis();
        }
    }
}
 
Example 5
Source File: SchedulersFacade.java    From DaggerAndroidMVVM with Apache License 2.0 4 votes vote down vote up
/**
 * IO thread pool scheduler
 */
public Scheduler io() {
    return Schedulers.io();
}
 
Example 6
Source File: BurstKitUtils.java    From burstkit4j with Apache License 2.0 4 votes vote down vote up
public static Scheduler defaultBurstNodeServiceScheduler() {
    return Schedulers.io();
}
 
Example 7
Source File: AppSchedulerProvider.java    From android-mvvm-architecture with Apache License 2.0 4 votes vote down vote up
@Override
public Scheduler io() {
    return Schedulers.io();
}
 
Example 8
Source File: AppSchedulerProvider.java    From android-mvp-interactor-architecture with Apache License 2.0 4 votes vote down vote up
@Override
public Scheduler io() {
    return Schedulers.io();
}
 
Example 9
Source File: Rx.java    From klingar with Apache License 2.0 4 votes vote down vote up
private static Rx production() {
  return new Rx(Schedulers.io(), AndroidSchedulers.mainThread(), Schedulers.newThread());
}
 
Example 10
Source File: AppSchedulerProvider.java    From android-mvp-architecture with Apache License 2.0 4 votes vote down vote up
@Override
public Scheduler io() {
    return Schedulers.io();
}
 
Example 11
Source File: CurrenciesActivityModule.java    From exchange-rates-mvvm with Apache License 2.0 4 votes vote down vote up
@Provides
@CurrenciesActivityScope
@Override
public GetCurrenciesRatesDate provideGetCurrenciesRatesDate(final PreferencesData preferencesData) {
    return new GetCurrenciesRatesDate(Schedulers.io(), AndroidSchedulers.mainThread(), preferencesData);
}
 
Example 12
Source File: SchedulerProvider.java    From Melophile with Apache License 2.0 4 votes vote down vote up
@NonNull
public Scheduler io() {
  return Schedulers.io();
}
 
Example 13
Source File: GeneralModule.java    From adamant-android with GNU General Public License v3.0 4 votes vote down vote up
@Named(Constants.IO_SCHEDULER)
@Singleton
@Provides
public static Scheduler provideIoObserveScheduler() {
    return Schedulers.io();
}
 
Example 14
Source File: SchedulerProvider.java    From News with Apache License 2.0 4 votes vote down vote up
@Override
@NonNull
public Scheduler io() {
    return Schedulers.io();
}
 
Example 15
Source File: RxSchedulerUtils.java    From Collection-Android with MIT License 4 votes vote down vote up
public static Scheduler io(Executor executor) {
    return executor != null ? Schedulers.from(executor) : Schedulers.io();
}
 
Example 16
Source File: SchedulersProviderImpl.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@NonNull
@Override
public Scheduler io() {
    return Schedulers.io();
}
 
Example 17
Source File: BaseTest.java    From storio with Apache License 2.0 4 votes vote down vote up
@NonNull
protected Scheduler defaultRxScheduler() {
    return Schedulers.io();
}
 
Example 18
Source File: SchedulerProviderImpl.java    From NYBus with Apache License 2.0 2 votes vote down vote up
/**
 * Provides the IO thread Scheduler.
 *
 * @return provides the IO thread Scheduler.
 */
@Override
public Scheduler provideIOScheduler() {
    return Schedulers.io();
}
 
Example 19
Source File: RxPaperBook.java    From RxPaper2 with MIT License 2 votes vote down vote up
/**
 * Open a custom {@link Book} with custom storage location path running its operations on
 * {@link Schedulers#io()}.
 * <p/>
 * Requires calling {@link RxPaperBook#init(Context)} at least once beforehand.
 *
 * @param path storage location
 * @param customBook book name
 * @return new RxPaperBook
 */
public static RxPaperBook withPath(String path, String customBook) {
    assertInitialized();
    return new RxPaperBook(path, customBook, Schedulers.io());
}
 
Example 20
Source File: SchedulerProviderImplementation.java    From NYBus with Apache License 2.0 2 votes vote down vote up
/**
 * Provides the IO thread Scheduler.
 *
 * @return provides the IO thread Scheduler.
 */
@Override
public Scheduler provideIOScheduler() {
    return Schedulers.io();
}