本文整理了Java中reactor.core.publisher.Mono.elapsed()
方法的一些代码示例,展示了Mono.elapsed()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mono.elapsed()
方法的具体详情如下:
包路径:reactor.core.publisher.Mono
类名称:Mono
方法名:elapsed
[英]Map this Mono into reactor.util.function.Tuple2of timemillis and source data. The timemillis corresponds to the elapsed time between the subscribe and the first next signal, as measured by the Schedulers#parallel() scheduler.
[中]把这个单子映射到反应堆里。util。作用timemillis和源数据的Tuple2。timemillis对应于由调度器#parallel()调度器测量的订阅和第一个下一个信号之间经过的时间。
代码示例来源:origin: reactor/reactor-core
/**
* Map this {@link Mono} into {@link reactor.util.function.Tuple2 Tuple2<Long, T>}
* of timemillis and source data. The timemillis corresponds to the elapsed time between
* the subscribe and the first next signal, as measured by the {@link Schedulers#parallel() parallel} scheduler.
*
* <p>
* <img class="marble" src="doc-files/marbles/elapsedForMono.svg" alt="">
*
* @return a new {@link Mono} that emits a tuple of time elapsed in milliseconds and matching data
*/
public final Mono<Tuple2<Long, T>> elapsed() {
return elapsed(Schedulers.parallel());
}
代码示例来源:origin: reactor/reactor-core
Mono<Tuple2<Long, String>> scenario_aFluxCanBeBenchmarked(){
return Mono.just("test")
.elapsed();
}
代码示例来源:origin: reactor/reactor-core
@Test
public void promiseDelays() throws Exception {
Tuple2<Long, String> h = Mono.delay(Duration.ofMillis(3000))
.log("time1")
.map(d -> "Spring wins")
.or(Mono.delay(Duration.ofMillis(2000)).log("time2").map(d -> "Spring Reactive"))
.flatMap(t -> Mono.just(t+ " world"))
.elapsed()
.block();
assertThat("Alternate mono not seen", h.getT2(), is("Spring Reactive world"));
System.out.println(h.getT1());
}
代码示例来源:origin: com.aol.cyclops/cyclops-reactor
/**
* @param scheduler
* @return
* @see reactor.core.publisher.Mono#elapsed(reactor.core.scheduler.TimedScheduler)
*/
public final Mono<Tuple2<Long, T>> elapsed(TimedScheduler scheduler) {
return boxed.elapsed(scheduler);
}
/**
代码示例来源:origin: com.aol.cyclops/cyclops-reactor
/**
* @return
* @see reactor.core.publisher.Mono#elapsed()
*/
public final Mono<Tuple2<Long, T>> elapsed() {
return boxed.elapsed();
}
/**
代码示例来源:origin: io.projectreactor/reactor-core
/**
* Map this {@link Mono} into {@link reactor.util.function.Tuple2 Tuple2<Long, T>}
* of timemillis and source data. The timemillis corresponds to the elapsed time between
* the subscribe and the first next signal, as measured by the {@link Schedulers#parallel() parallel} scheduler.
*
* <p>
* <img class="marble" src="doc-files/marbles/elapsedForMono.svg" alt="">
*
* @return a new {@link Mono} that emits a tuple of time elapsed in milliseconds and matching data
*/
public final Mono<Tuple2<Long, T>> elapsed() {
return elapsed(Schedulers.parallel());
}
内容来源于网络,如有侵权,请联系作者删除!