本文整理汇总了Java中reactor.core.publisher.Flux.blockFirst方法的典型用法代码示例。如果您正苦于以下问题:Java Flux.blockFirst方法的具体用法?Java Flux.blockFirst怎么用?Java Flux.blockFirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reactor.core.publisher.Flux
的用法示例。
在下文中一共展示了Flux.blockFirst方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import reactor.core.publisher.Flux; //导入方法依赖的package包/类
public static void main(String[] args) {
Flux<LocalDateTime> flux = Flux.<LocalDateTime>create(e -> {
Schedulers.newSingle("brc", true)
.schedulePeriodically(
() -> {
LOGGER.info("calculating...");
e.next(LocalDateTime.now(ZoneOffset.UTC));
},
0, 100, TimeUnit.MILLISECONDS);
}, OverflowStrategy.LATEST).cache(1);
flux.blockFirst();
while (true) {
LOGGER.info("{}", flux.blockFirst(Duration.ofMillis(0)));
Uninterruptibles.sleepUninterruptibly(50, TimeUnit.MILLISECONDS);
}
}
示例2: decide
import reactor.core.publisher.Flux; //导入方法依赖的package包/类
@Override
public Mono<Boolean> decide(Authentication authentication, ServerWebExchange object, Flux<ConfigAttribute> configAttributes) {
ConfigAttribute attribute = configAttributes.blockFirst();
EvaluationContext context = handler.createEvaluationContext(authentication, object);
Expression expression = handler.getExpressionParser().parseExpression(attribute.getAttribute());
return Mono.just(ExpressionUtils.evaluateAsBoolean(expression, context));
}
开发者ID:guilhebl,项目名称:item-shop-reactive-backend,代码行数:8,代码来源:ExpressionReactiveAccessDecisionManager.java