#Javaの#リアクター#フラックス#parallet#
マルチスレッド
ビデオ解説: https://www.bilibili.com/video/av81386202/
FluxMonoTestCase.java
パッケージcom.example.reactor。 輸入lombok.extern.slf4j.Slf4j; 輸入org.junit.jupiter.api.Test; 輸入reactor.core.publisher.Flux; 輸入reactor.core.scheduler.Schedulers。 SLF4J @ パブリック クラス FluxMonoTestCaseは延びBaseTestCase { @Test 公共 ボイド parllel()スローInterruptedExceptionある{ Flux.range( 1,10 ) .PARALLEL() .runOn(Schedulers.parallel()) .subscribe(X > log.info(」 -を- > {}」、X)); } }
結果:
11:03:33.472 [メイン] DEBUG reactor.util.Loggers $ LoggerFactory - SLF4Jロギング・フレームワークの使用
11:03:33.509を[パラレル8] INFO com.example.reactor.FluxMonoTestCase - - > 8
11:03:33.509 [パラレル-6] INFO com.example.reactor.FluxMonoTestCase - - > 6
11:03:33.509 [パラレル-4] INFO com.example.reactor.FluxMonoTestCase - - > 4
11:03:33.508 [パラレル-1] INFOコム。 example.reactor.FluxMonoTestCase - - > 1
11:03:33.508 [パラレル-3] INFO com.example.reactor.FluxMonoTestCase - - > 3
11:03:33.508 [パラレル-2] INFO com.example.reactor.FluxMonoTestCase - - > 2
11:03:33.514 [パラレル-1] INFO com.example.reactor.FluxMonoTestCase - - > 9
11:03:33.509 [パラレル-5] INFO com.example.reactor.FluxMonoTestCase - - > 5
11:03:33.514 [パラレル-2] INFO com.example.reactor.FluxMonoTestCase - - > 10
11:03:33.509 [パラレル-7] INFO com.example.reactor.FluxMonoTestCase - - > 7
いいえ国民は、3分の一日学習ビデオに準拠していません