本文整理了Java中reactor.core.publisher.Mono.fromCallable()
方法的一些代码示例,展示了Mono.fromCallable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mono.fromCallable()
方法的具体详情如下:
包路径:reactor.core.publisher.Mono
类名称:Mono
方法名:fromCallable
[英]Create a Mono producing its value using the provided Callable. If the Callable resolves to null, the resulting Mono completes empty.
[中]创建一个Mono,使用提供的Callable生成其值。如果可调用的解析为null,则生成的Mono将为空。
代码示例来源:origin: requery/requery
@Override
public <E extends T> Mono<E> insert(final E entity) {
return Mono.fromCallable(new Callable<E>() {
@Override
public E call() throws Exception {
return delegate.insert(entity);
}
});
}
代码示例来源:origin: requery/requery
@Override
public <K, E extends T> Mono<K> insert(final E entity, final Class<K> keyClass) {
return Mono.fromCallable(new Callable<K>() {
@Override
public K call() throws Exception {
return delegate.insert(entity, keyClass);
}
});
}
代码示例来源:origin: requery/requery
@Override
public <E extends T> Mono<E> refresh(final E entity) {
return Mono.fromCallable(new Callable<E>() {
@Override
public E call() throws Exception {
return delegate.refresh(entity);
}
});
}
代码示例来源:origin: requery/requery
@Override
public <E extends T, K> Mono<E> findByKey(final Class<E> type, final K key) {
return Mono.fromCallable(new Callable<E>() {
@Override
public E call() throws Exception {
return delegate.findByKey(type, key);
}
});
}
代码示例来源:origin: requery/requery
@Override
public <E extends T> Mono<E> upsert(final E entity) {
return Mono.fromCallable(new Callable<E>() {
@Override
public E call() throws Exception {
return delegate.upsert(entity);
}
});
}
代码示例来源:origin: requery/requery
@Override
public <E extends T> Mono<E> refresh(final E entity, final Attribute<?, ?>... attributes) {
return Mono.fromCallable(new Callable<E>() {
@Override
public E call() throws Exception {
return delegate.refresh(entity, attributes);
}
});
}
代码示例来源:origin: requery/requery
@Override
public <E extends T> Mono<E> update(final E entity) {
return Mono.fromCallable(new Callable<E>() {
@Override
public E call() throws Exception {
return delegate.update(entity);
}
});
}
代码示例来源:origin: requery/requery
@Override
public <E extends T> Mono<E> update(final E entity, final Attribute<?, ?>... attributes) {
return Mono.fromCallable(new Callable<E>() {
@Override
public E call() throws Exception {
return delegate.update(entity, attributes);
}
});
}
代码示例来源:origin: requery/requery
@Override
public <E extends T> Mono<Iterable<E>> upsert(final Iterable<E> entities) {
return Mono.fromCallable(new Callable<Iterable<E>>() {
@Override
public Iterable<E> call() throws Exception {
return delegate.upsert(entities);
}
});
}
代码示例来源:origin: requery/requery
@Override
public <E extends T> Mono<Iterable<E>> refresh(final Iterable<E> entities, final Attribute<?, ?>... attributes) {
return Mono.fromCallable(new Callable<Iterable<E>>() {
@Override
public Iterable<E> call() throws Exception {
return delegate.refresh(entities, attributes);
}
});
}
代码示例来源:origin: requery/requery
@Override
public <E extends T> Mono<Iterable<E>> insert(final Iterable<E> entities) {
return Mono.fromCallable(new Callable<Iterable<E>>() {
@Override
public Iterable<E> call() throws Exception {
return delegate.insert(entities);
}
});
}
代码示例来源:origin: requery/requery
@Override
public <K, E extends T> Mono<Iterable<K>> insert(final Iterable<E> entities, final Class<K> keyClass) {
return Mono.fromCallable(new Callable<Iterable<K>>() {
@Override
public Iterable<K> call() throws Exception {
return delegate.insert(entities, keyClass);
}
});
}
代码示例来源:origin: requery/requery
@Override
public <E extends T> Mono<Iterable<E>> update(final Iterable<E> entities) {
return Mono.fromCallable(new Callable<Iterable<E>>() {
@Override
public Iterable<E> call() throws Exception {
return delegate.update(entities);
}
});
}
代码示例来源:origin: requery/requery
@Override
public <E extends T> Mono<E> refreshAll(final E entity) {
return Mono.fromCallable(new Callable<E>() {
@Override
public E call() throws Exception {
return delegate.refreshAll(entity);
}
});
}
代码示例来源:origin: requery/requery
/**
* Converts this Scalar computation to a {@link Mono}.
*
* @return {@link Mono} for the result of this query.
*/
@CheckReturnValue
public Mono<E> mono() {
return Mono.fromCallable(this);
}
}
代码示例来源:origin: spring-projects/spring-security
@Override
public Mono<List<JWK>> get(JWKSelector jwkSelector) {
return Mono.fromCallable(() -> this.source.get(jwkSelector, null));
}
}
代码示例来源:origin: spring-projects/spring-framework
private Mono<Void> executeInternal(URI url, HttpHeaders headers, WebSocketHandler handler) {
MonoProcessor<Void> completionMono = MonoProcessor.create();
return Mono.fromCallable(
() -> {
if (logger.isDebugEnabled()) {
logger.debug("Connecting to " + url);
}
Object jettyHandler = createHandler(url, handler, completionMono);
ClientUpgradeRequest request = new ClientUpgradeRequest();
request.setSubProtocols(handler.getSubProtocols());
UpgradeListener upgradeListener = new DefaultUpgradeListener(headers);
return this.jettyClient.connect(jettyHandler, url, request, upgradeListener);
})
.then(completionMono);
}
代码示例来源:origin: spring-projects/spring-framework
private Mono<Void> executeInternal(URI url, HttpHeaders requestHeaders, WebSocketHandler handler) {
MonoProcessor<Void> completionMono = MonoProcessor.create();
return Mono.fromCallable(
() -> {
if (logger.isDebugEnabled()) {
logger.debug("Connecting to " + url);
}
List<String> protocols = handler.getSubProtocols();
DefaultConfigurator configurator = new DefaultConfigurator(requestHeaders);
Endpoint endpoint = createEndpoint(url, handler, completionMono, configurator);
ClientEndpointConfig config = createEndpointConfig(configurator, protocols);
return this.webSocketContainer.connectToServer(endpoint, config, url);
})
.subscribeOn(Schedulers.elastic()) // connectToServer is blocking
.then(completionMono);
}
代码示例来源:origin: spring-projects/spring-framework
private Mono<Void> executeInternal(URI url, HttpHeaders headers, WebSocketHandler handler) {
MonoProcessor<Void> completion = MonoProcessor.create();
return Mono.fromCallable(
() -> {
if (logger.isDebugEnabled()) {
logger.debug("Connecting to " + url);
}
List<String> protocols = handler.getSubProtocols();
ConnectionBuilder builder = createConnectionBuilder(url);
DefaultNegotiation negotiation = new DefaultNegotiation(protocols, headers, builder);
builder.setClientNegotiation(negotiation);
return builder.connect().addNotifier(
new IoFuture.HandlingNotifier<WebSocketChannel, Object>() {
@Override
public void handleDone(WebSocketChannel channel, Object attachment) {
handleChannel(url, handler, completion, negotiation, channel);
}
@Override
public void handleFailed(IOException ex, Object attachment) {
completion.onError(new IllegalStateException("Failed to connect to " + url, ex));
}
}, null);
})
.then(completion);
}
代码示例来源:origin: spring-projects/spring-framework
bindingResultMono.onNext(errors);
})
.then(Mono.fromCallable(() -> {
BindingResult errors = binder.getBindingResult();
if (adapter != null) {
内容来源于网络,如有侵权,请联系作者删除!