本文整理了Java中io.reactivex.Single.toCompletable()
方法的一些代码示例,展示了Single.toCompletable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Single.toCompletable()
方法的具体详情如下:
包路径:io.reactivex.Single
类名称:Single
方法名:toCompletable
[英]Returns a Completable that discards result of the Singleand calls onComplete when this source Single calls onSuccess. Error terminal event is propagated.
Scheduler: toCompletable does not operate by default on a particular Scheduler.
[中]返回一个Completable,当该源Single调用onSuccess时,它将丢弃Single的结果并调用onComplete。传播错误终端事件。
Scheduler:toCompletable默认情况下不会在特定的计划程序上运行。
代码示例来源:origin: spring-projects/spring-framework
@PostMapping("/rxjava2-single")
@SuppressWarnings("deprecation")
public io.reactivex.Completable createWithRxJava2Single(@RequestBody io.reactivex.Single<Person> single) {
return single.map(persons::add).toCompletable();
}
代码示例来源:origin: spring-projects/spring-framework
@PostMapping("/rxjava2-observable")
@SuppressWarnings("deprecation")
public io.reactivex.Completable createWithRxJava2Observable(
@RequestBody io.reactivex.Observable<Person> observable) {
return observable.toList().doOnSuccess(persons::addAll).toCompletable();
}
代码示例来源:origin: spring-projects/spring-framework
@PostMapping("/flowable")
@SuppressWarnings("deprecation")
public io.reactivex.Completable createWithFlowable(@RequestBody Flowable<Person> flowable) {
return flowable.toList().doOnSuccess(persons::addAll).toCompletable();
}
}
代码示例来源:origin: Polidea/RxAndroidBle
@Override
public Completable writeDescriptor(@NonNull final UUID serviceUuid, @NonNull final UUID characteristicUuid,
@NonNull final UUID descriptorUuid, @NonNull final byte[] data) {
return discoverServices()
.flatMap(new Function<RxBleDeviceServices, SingleSource<BluetoothGattDescriptor>>() {
@Override
public SingleSource<BluetoothGattDescriptor> apply(RxBleDeviceServices rxBleDeviceServices) {
return rxBleDeviceServices.getDescriptor(serviceUuid, characteristicUuid, descriptorUuid);
}
})
.doOnSuccess(new Consumer<BluetoothGattDescriptor>() {
@Override
public void accept(BluetoothGattDescriptor bluetoothGattDescriptor) throws Exception {
bluetoothGattDescriptor.setValue(data);
}
})
.toCompletable();
}
代码示例来源:origin: ReactiveX/RxJava
@Test
@SuppressWarnings("deprecation")
public void toCompletable() {
Single.just(1)
.toCompletable()
.test()
.assertResult();
Single.error(new TestException())
.toCompletable()
.test()
.assertFailure(TestException.class);
}
代码示例来源:origin: com.microsoft.azure/azure-storage-blob
/**
* Returns the sku name and account kind.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Single which performs the network request upon subscription.
*/
public Completable getAccountInfoAsync(Context context) {
return getAccountInfoWithRestResponseAsync(context)
.toCompletable();
}
}
代码示例来源:origin: Azure/azure-storage-java
/**
* Returns the sku name and account kind.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Single which performs the network request upon subscription.
*/
public Completable getAccountInfoAsync(Context context) {
return getAccountInfoWithRestResponseAsync(context)
.toCompletable();
}
}
代码示例来源:origin: Azure/azure-storage-java
/**
* Returns the sku name and account kind.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Single which performs the network request upon subscription.
*/
public Completable getAccountInfoAsync(Context context) {
return getAccountInfoWithRestResponseAsync(context)
.toCompletable();
}
}
代码示例来源:origin: Azure/azure-storage-java
/**
* Returns the sku name and account kind.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Single which performs the network request upon subscription.
*/
public Completable getAccountInfoAsync(Context context) {
return getAccountInfoWithRestResponseAsync(context)
.toCompletable();
}
}
代码示例来源:origin: com.microsoft.azure/azure-storage-blob
/**
* Returns the sku name and account kind.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Single which performs the network request upon subscription.
*/
public Completable getAccountInfoAsync(Context context) {
return getAccountInfoWithRestResponseAsync(context)
.toCompletable();
}
}
代码示例来源:origin: com.microsoft.azure/azure-storage-blob
/**
* Returns the sku name and account kind.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Single which performs the network request upon subscription.
*/
public Completable getAccountInfoAsync(Context context) {
return getAccountInfoWithRestResponseAsync(context)
.toCompletable();
}
}
代码示例来源:origin: sczyh30/vertx-blueprint-todo-backend
@Override
public Completable delete(String todoId) {
return client.rxUpdateWithParams(SQL_DELETE, new JsonArray().add(todoId))
.toCompletable();
}
代码示例来源:origin: intendia-oss/autorest
@SuppressWarnings("unchecked")
@Override public <T> T fromJson(Single<Reader> req, Class<? super T> container, Class<?> type) {
if (Completable.class.equals(container)) return (T) req.doOnSuccess(this::consume).toCompletable();
if (Single.class.equals(container)) return (T) req.map(reader -> {
if (Reader.class.equals(type)) return reader;
if (String.class.equals(type)) return readAsString(reader);
return gson.fromJson(reader, type);
});
if (Observable.class.equals(container)) return (T) req.toObservable()
.flatMapIterable(n -> () -> new ParseArrayIterator<>(n, type));
throw new IllegalArgumentException("unsupported type " + container);
}
代码示例来源:origin: gentics/mesh
@Override
public WriteStream<Buffer> drainHandler(Handler<Void> handler) {
if (this.buffer.length() < writeQueueMaxSize) {
handler.handle(null);
} else {
this.bufferChanged$.filter(len -> len < writeQueueMaxSize).firstOrError().toCompletable().subscribe(() -> handler.handle(null));
}
return this;
}
代码示例来源:origin: gentics/mesh
@Override
public Completable toCompletable() {
return Completable.defer(() -> invoke().rxSetHandler()
.toCompletable());
}
代码示例来源:origin: com.github.davidmoten/rxjava2-jdbc
public <T> Completable apply(Consumer<? super Connection> consumer) {
return member().doOnSuccess(member -> {
try {
consumer.accept(member.value());
} finally {
member.checkin();
}
}).toCompletable();
}
代码示例来源:origin: davidmoten/rxjava2-jdbc
public <T> Completable apply(Consumer<? super Connection> consumer) {
return member().doOnSuccess(member -> {
try {
consumer.accept(member.value());
} finally {
member.checkin();
}
}).toCompletable();
}
代码示例来源:origin: Microsoft/azure-spring-boot
public static void deleteBlob(BlockBlobURL blockBlobURL) {
logInfo("Start deleting file %s...", blockBlobURL.toURL());
blockBlobURL.delete(null, null, null)
.toCompletable()
.doOnComplete(() -> logInfo("Blob %s is deleted.", blockBlobURL.toURL()))
.doOnError(error -> logError("Failed to delete blob %s with error %s.",
blockBlobURL.toURL(), error.getMessage()))
.blockingAwait();
}
代码示例来源:origin: gentics/mesh
@Override
public Completable deregisterPipeline(String name) {
String fullname = installationPrefix() + name;
return client.deregisterPlugin(fullname).async()
.doOnSuccess(response -> {
if (log.isDebugEnabled()) {
log.debug("Deregistered pipeline {" + fullname + "} response: {" + response.toString() + "}");
}
}).toCompletable()
.onErrorResumeNext(ignore404)
.compose(withTimeoutAndLog("Removed pipeline {" + fullname + "}", true));
}
代码示例来源:origin: VictorAlbertos/ReactiveCache
Completable updateUserName(String name) {
return cacheProvider.read()
.map(user -> {
user.setName(name);
return user;
})
.compose(cacheProvider.replace())
.toCompletable();
}
内容来源于网络,如有侵权,请联系作者删除!