當前位置: 首頁>>代碼示例>>Java>>正文


Java BackpressureStrategy.BUFFER屬性代碼示例

本文整理匯總了Java中io.reactivex.BackpressureStrategy.BUFFER屬性的典型用法代碼示例。如果您正苦於以下問題:Java BackpressureStrategy.BUFFER屬性的具體用法?Java BackpressureStrategy.BUFFER怎麽用?Java BackpressureStrategy.BUFFER使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在io.reactivex.BackpressureStrategy的用法示例。


在下文中一共展示了BackpressureStrategy.BUFFER屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

private static void run(BackpressureStrategy backpressureStrategy) {
    System.out.println("-- RUNNING WITH [" + backpressureStrategy + "] --");
    Flowable<Long> fastProducer = FastProducerSlowConsumer.createFastProducer(backpressureStrategy, 1000);

    Consumer<Long> onNextSlowConsumer = FastProducerSlowConsumer.createOnNextSlowConsumer(5);
    fastProducer.observeOn(Schedulers.io()).subscribe(onNextSlowConsumer::accept,
            e -> System.out.println(backpressureStrategy + " " + e),
            () -> System.out.println(backpressureStrategy + " complete")
    );
    if(backpressureStrategy== BackpressureStrategy.BUFFER)DSUtil.sleep(5000);
    DSUtil.sleep(1000);
}
 
開發者ID:danielshaya,項目名稱:reactivejournal,代碼行數:12,代碼來源:RxJavaBackPressure.java

示例2: getBackpressureStrategy

@Override
public BackpressureStrategy getBackpressureStrategy(SensorType sensorType) {
    return BackpressureStrategy.BUFFER;
}
 
開發者ID:ubikgs,項目名稱:AndroidSensors,代碼行數:4,代碼來源:BasicSensorConfig.java

示例3: getBackpressureStrategy

@Override
public BackpressureStrategy getBackpressureStrategy(SensorType sensorType) {
    sensorConfigCalled = true;
    return BackpressureStrategy.BUFFER;
}
 
開發者ID:ubikgs,項目名稱:AndroidSensors,代碼行數:5,代碼來源:AndroidSensorsIntegrationTest.java

示例4: RxEventBus

private RxEventBus() {
    rxBus = PublishSubject.create();
    backpressureStrategy = BackpressureStrategy.BUFFER;
}
 
開發者ID:Zeyad-37,項目名稱:RxRedux,代碼行數:4,代碼來源:RxEventBus.java

示例5: createResourceSubscriptionObserver

/**
 * Creates an observer for resource subscriptions.
 * <p>
 * Note: for more information about observers @see <a href="http://reactivex.io/">Reactive X</a> or
 * <a href="https://github.com/ReactiveX/RxJava">RxJava</a> *
 * <p>
 * Example:
 * 
 * <pre>
 * {
 * {@code String resourcePath = "/3200/0/5501";
 *     String deviceId = "015f4ac587f500000000000100100249";
 *     Resource resource = new Resource(deviceId, path);
 *     connectApi.createResourceSubscriptionObserver(resource, BackpressureStrategy.BUFFER)
 *                   .subscribe(System.out::println);
 *     connectApi.addResourceSubscription(resource);
 * }
 * </pre>
 * 
 * @param resource
 *            resource to subscribe to.
 * @param strategy
 *            backpressure strategy to apply @see {@link BackpressureStrategy}
 * @return Observable which can be subscribed to. @see {@link Flowable}
 * @throws MbedCloudException
 *             if an error occurred in the process.
 */
@API
public @Nullable Flowable<Object> createResourceSubscriptionObserver(@NonNull Resource resource,
        @Nullable @DefaultValue("BUFFER") BackpressureStrategy strategy) throws MbedCloudException {
    checkNotNull(resource, TAG_RESOURCE);
    checkModelValidity(resource, TAG_RESOURCE);
    final BackpressureStrategy finalStrategy = (strategy == null) ? BackpressureStrategy.BUFFER : strategy;
    return cache.createResourceSubscriptionObserver(resource, finalStrategy);
}
 
開發者ID:ARMmbed,項目名稱:mbed-cloud-sdk-java,代碼行數:35,代碼來源:Connect.java


注:本文中的io.reactivex.BackpressureStrategy.BUFFER屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。