├── .github ├── CODEOWNERS ├── dco.yml ├── dependabot.yml ├── pull_request_template.md ├── release.yml ├── setup.sh └── workflows │ ├── ci.yml │ ├── codeql-analysis.yml │ ├── full.yml │ ├── gradle-wrapper-validation.yml │ ├── publish.yml │ └── snapshots.yml ├── .gitignore ├── .sdkmanrc ├── LICENSE ├── README.md ├── benchmarks ├── README.md ├── build.gradle └── src │ └── main │ ├── java │ └── reactor │ │ ├── AssemblyTraceBenchmark.java │ │ ├── CheckpointBenchmark.java │ │ ├── TailCallBenchmark.java │ │ └── core │ │ ├── CompositeDisposableHashcodeBenchmark.java │ │ ├── observability │ │ └── micrometer │ │ │ └── MicrometerMeterListenerConfigurationResolveTagsBenchmark.java │ │ ├── publisher │ │ ├── FluxBufferTimeoutBenchmark.java │ │ ├── FluxPublishBenchmark.java │ │ ├── MonoAllBenchmark.java │ │ ├── MonoCallableBenchmark.java │ │ └── TracesBenchmark.java │ │ ├── scheduler │ │ ├── BoundedElasticBusyStructureBenchmark.java │ │ └── OldBoundedElasticScheduler.java │ │ └── scrabble │ │ ├── FluxCharSequence.java │ │ ├── ShakespearePlaysScrabble.java │ │ ├── ShakespearePlaysScrabbleOpt.java │ │ ├── ShakespearePlaysScrabbleParallelOpt.java │ │ └── ShakespearePlaysScrabbleRegular.java │ └── resources │ ├── ospd.txt.gz │ └── words.shakespeare.txt.gz ├── build.gradle ├── buildSrc ├── build.gradle ├── settings.gradle └── src │ ├── main │ └── java │ │ └── io │ │ └── reactor │ │ └── gradle │ │ ├── DetectCiPlugin.java │ │ ├── JavaConventions.java │ │ └── JmhExecTask.java │ └── test │ └── java │ └── io │ └── reactor │ └── gradle │ └── DetectCiPluginTest.java ├── codequality ├── eclipse │ ├── reactor.importorder │ └── reactor.style.xml ├── idea │ ├── code_style.xml │ └── inspection_profile.xml ├── nohttp │ ├── allowlist.lines │ └── checkstyle.xml └── spotless │ └── licenseSlashstarStyle.txt ├── docs ├── antora-assembler.yml ├── antora-playbook.yml ├── antora.yml ├── api │ ├── overview.html │ └── stylesheet.css ├── build.gradle ├── modules │ └── ROOT │ │ ├── assets │ │ ├── highlight │ │ │ ├── CHANGES.md │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── README.ru.md │ │ │ ├── highlight.min.js │ │ │ └── styles │ │ │ │ └── railscasts.min.css │ │ └── images │ │ │ ├── flux.svg │ │ │ ├── gs-cold.png │ │ │ ├── gs-compose.png │ │ │ ├── gs-hot.png │ │ │ ├── gs-operators.png │ │ │ ├── gs-reftail.png │ │ │ ├── gs-transform.png │ │ │ ├── legend-events.svg │ │ │ ├── legend-operator-companion.svg │ │ │ ├── legend-operator-double-source.svg │ │ │ ├── legend-operator-method.svg │ │ │ ├── legend-operator-parallel.svg │ │ │ ├── legend-operator-static.svg │ │ │ ├── legend-operator-windowing.svg │ │ │ ├── legend-sideEffects1.svg │ │ │ ├── legend-sideEffects2.svg │ │ │ ├── logo-2x.png │ │ │ ├── logo.png │ │ │ └── mono.svg │ │ ├── nav.adoc │ │ └── pages │ │ ├── aboutDoc.adoc │ │ ├── advanced-contextPropagation.adoc │ │ ├── advancedFeatures.adoc │ │ ├── advancedFeatures │ │ ├── advanced-broadcast-multiple-subscribers-connectableflux.adoc │ │ ├── advanced-mutualizing-operator-usage.adoc │ │ ├── advanced-parallelizing-parralelflux.adoc │ │ ├── advanced-three-sorts-batching.adoc │ │ ├── cleanup.adoc │ │ ├── context.adoc │ │ ├── hooks.adoc │ │ ├── null-safety.adoc │ │ ├── reactor-hotCold.adoc │ │ └── scheduler-factory.adoc │ │ ├── apdx-howtoReadMarbles.adoc │ │ ├── apdx-implem.adoc │ │ ├── apdx-migrating.adoc │ │ ├── apdx-operatorChoice.adoc │ │ ├── apdx-optimizations.adoc │ │ ├── apdx-reactorExtra.adoc │ │ ├── apdx-writingOperator.adoc │ │ ├── coreFeatures.adoc │ │ ├── coreFeatures │ │ ├── error-handling.adoc │ │ ├── flux.adoc │ │ ├── mono.adoc │ │ ├── programmatically-creating-sequence.adoc │ │ ├── schedulers.adoc │ │ ├── simple-ways-to-create-a-flux-or-mono-and-subscribe-to-it.adoc │ │ └── sinks.adoc │ │ ├── debugging.adoc │ │ ├── faq.adoc │ │ ├── gettingStarted.adoc │ │ ├── kotlin.adoc │ │ ├── metrics-details.adoc │ │ ├── metrics.adoc │ │ ├── processors.adoc │ │ ├── producing.adoc │ │ ├── reactiveProgramming.adoc │ │ ├── snippetRetryWhenRetry.adoc │ │ ├── subscribe-backpressure.adoc │ │ ├── subscribe-details.adoc │ │ └── testing.adoc ├── pdf-theme.yml └── svg │ ├── README.md │ └── conventions.svg ├── gradle.properties ├── gradle ├── javadoc.gradle ├── libs.versions.toml ├── releaser.gradle ├── setup.gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── reactor-core-micrometer ├── build.gradle └── src │ ├── main │ └── java │ │ └── reactor │ │ └── core │ │ └── observability │ │ └── micrometer │ │ ├── Micrometer.java │ │ ├── MicrometerMeterListener.java │ │ ├── MicrometerMeterListenerConfiguration.java │ │ ├── MicrometerMeterListenerDocumentation.java │ │ ├── MicrometerMeterListenerFactory.java │ │ ├── MicrometerObservationListener.java │ │ ├── MicrometerObservationListenerConfiguration.java │ │ ├── MicrometerObservationListenerDocumentation.java │ │ ├── MicrometerObservationListenerFactory.java │ │ ├── TimedScheduler.java │ │ ├── TimedSchedulerMeterDocumentation.java │ │ └── package-info.java │ └── test │ ├── java │ └── reactor │ │ └── core │ │ └── observability │ │ └── micrometer │ │ ├── MicrometerMeterListenerConfigurationTest.java │ │ ├── MicrometerMeterListenerFactoryTest.java │ │ ├── MicrometerMeterListenerTest.java │ │ ├── MicrometerObservationIntegrationTest.java │ │ ├── MicrometerObservationListenerConfigurationTest.java │ │ ├── MicrometerObservationListenerFactoryTest.java │ │ ├── MicrometerObservationListenerTest.java │ │ ├── MicrometerTest.java │ │ └── TimedSchedulerTest.java │ └── resources │ └── logback.xml ├── reactor-core ├── build.gradle └── src │ ├── blockHoundTest │ ├── java │ │ └── reactor │ │ │ └── core │ │ │ └── scheduler │ │ │ ├── BoundedElasticSchedulerBlockhoundTest.java │ │ │ ├── ReactorBlockHoundIntegrationSPITest.java │ │ │ ├── ReactorBlockHoundIntegrationTest.java │ │ │ └── ReactorTestBlockHoundIntegration.java │ └── resources │ │ └── META-INF │ │ └── services │ │ └── reactor.blockhound.integration.BlockHoundIntegration │ ├── jcstress │ ├── java │ │ └── reactor │ │ │ ├── core │ │ │ ├── publisher │ │ │ │ ├── ConditionalStressSubscriber.java │ │ │ │ ├── FluxBufferTimeoutStressTest.java │ │ │ │ ├── FluxConcatMapNoPrefetchStressTest.java │ │ │ │ ├── FluxCreateStressTest.java │ │ │ │ ├── FluxGenerateStressTest.java │ │ │ │ ├── FluxMergeSequentialStressTest.java │ │ │ │ ├── FluxMergeStressTest.java │ │ │ │ ├── FluxOnErrorReturnStressTest.java │ │ │ │ ├── FluxPublishOnStressTest.java │ │ │ │ ├── FluxPublishStressTest.java │ │ │ │ ├── FluxReplayStressTest.java │ │ │ │ ├── FluxSwitchMapStressTest.java │ │ │ │ ├── FluxSwitchOnFirstConditionalStressTest.java │ │ │ │ ├── FluxSwitchOnFirstStressTest.java │ │ │ │ ├── FluxWindowTimeoutStressTest.java │ │ │ │ ├── InnerStressSubscriber.java │ │ │ │ ├── MonoDelayElementStressTest.java │ │ │ │ ├── MonoDelayStressTest.java │ │ │ │ ├── MonoDelayUntilStressTest.java │ │ │ │ ├── MonoInnerProducerBaseStressTest.java │ │ │ │ ├── MonoUsingWhenStressTest.java │ │ │ │ ├── SinkEmptySerializedStressTest.java │ │ │ │ ├── SinkManyBestEffortStressTest.java │ │ │ │ ├── SinkManySerializedStressTest.java │ │ │ │ ├── SinkManyUnicastStressTest.java │ │ │ │ ├── SinkOneSerializedStressTest.java │ │ │ │ ├── SinkOneStressTest.java │ │ │ │ ├── StressSubscriber.java │ │ │ │ └── StressSubscription.java │ │ │ ├── scheduler │ │ │ │ └── BasicSchedulersStressTest.java │ │ │ └── util │ │ │ │ └── FastLogger.java │ │ │ └── util │ │ │ └── concurrent │ │ │ ├── MpscLinkedQueueStressTest.java │ │ │ ├── SpscArrayQueueStressTest.java │ │ │ └── SpscLinkedArrayQueueStressTest.java │ └── resources │ │ └── logback.xml │ ├── main │ ├── java │ │ └── reactor │ │ │ ├── adapter │ │ │ ├── JdkFlowAdapter.java │ │ │ └── package-info.java │ │ │ ├── core │ │ │ ├── CorePublisher.java │ │ │ ├── CoreSubscriber.java │ │ │ ├── Disposable.java │ │ │ ├── Disposables.java │ │ │ ├── Exceptions.java │ │ │ ├── Fuseable.java │ │ │ ├── Scannable.java │ │ │ ├── observability │ │ │ │ ├── DefaultSignalListener.java │ │ │ │ ├── SignalListener.java │ │ │ │ └── SignalListenerFactory.java │ │ │ ├── package-info.java │ │ │ ├── publisher │ │ │ │ ├── BaseSubscriber.java │ │ │ │ ├── BlockingFirstSubscriber.java │ │ │ │ ├── BlockingIterable.java │ │ │ │ ├── BlockingLastSubscriber.java │ │ │ │ ├── BlockingMonoSubscriber.java │ │ │ │ ├── BlockingOptionalMonoSubscriber.java │ │ │ │ ├── BlockingSingleSubscriber.java │ │ │ │ ├── BufferOverflowStrategy.java │ │ │ │ ├── CallSiteSupplierFactory.java │ │ │ │ ├── ConnectableFlux.java │ │ │ │ ├── ConnectableFluxHide.java │ │ │ │ ├── ConnectableFluxOnAssembly.java │ │ │ │ ├── ConnectableFluxRestoringThreadLocals.java │ │ │ │ ├── ConnectableLift.java │ │ │ │ ├── ConnectableLiftFuseable.java │ │ │ │ ├── ContextHolder.java │ │ │ │ ├── ContextPropagation.java │ │ │ │ ├── ContextPropagationSupport.java │ │ │ │ ├── ContextTrackingFunctionWrapper.java │ │ │ │ ├── DelegateProcessor.java │ │ │ │ ├── DirectInnerContainer.java │ │ │ │ ├── DirectProcessor.java │ │ │ │ ├── DrainUtils.java │ │ │ │ ├── EmitterProcessor.java │ │ │ │ ├── Flux.java │ │ │ │ ├── FluxArray.java │ │ │ │ ├── FluxAutoConnect.java │ │ │ │ ├── FluxAutoConnectFuseable.java │ │ │ │ ├── FluxBuffer.java │ │ │ │ ├── FluxBufferBoundary.java │ │ │ │ ├── FluxBufferPredicate.java │ │ │ │ ├── FluxBufferTimeout.java │ │ │ │ ├── FluxBufferWhen.java │ │ │ │ ├── FluxCallable.java │ │ │ │ ├── FluxCallableOnAssembly.java │ │ │ │ ├── FluxCancelOn.java │ │ │ │ ├── FluxCombineLatest.java │ │ │ │ ├── FluxConcatArray.java │ │ │ │ ├── FluxConcatIterable.java │ │ │ │ ├── FluxConcatMap.java │ │ │ │ ├── FluxConcatMapNoPrefetch.java │ │ │ │ ├── FluxContextWrite.java │ │ │ │ ├── FluxContextWriteRestoringThreadLocals.java │ │ │ │ ├── FluxContextWriteRestoringThreadLocalsFuseable.java │ │ │ │ ├── FluxCreate.java │ │ │ │ ├── FluxDefaultIfEmpty.java │ │ │ │ ├── FluxDefer.java │ │ │ │ ├── FluxDeferContextual.java │ │ │ │ ├── FluxDelaySequence.java │ │ │ │ ├── FluxDelaySubscription.java │ │ │ │ ├── FluxDematerialize.java │ │ │ │ ├── FluxDetach.java │ │ │ │ ├── FluxDistinct.java │ │ │ │ ├── FluxDistinctFuseable.java │ │ │ │ ├── FluxDistinctUntilChanged.java │ │ │ │ ├── FluxDoFinally.java │ │ │ │ ├── FluxDoFirst.java │ │ │ │ ├── FluxDoFirstFuseable.java │ │ │ │ ├── FluxDoOnEach.java │ │ │ │ ├── FluxDoOnEachFuseable.java │ │ │ │ ├── FluxElapsed.java │ │ │ │ ├── FluxEmpty.java │ │ │ │ ├── FluxError.java │ │ │ │ ├── FluxErrorOnRequest.java │ │ │ │ ├── FluxErrorSupplied.java │ │ │ │ ├── FluxExpand.java │ │ │ │ ├── FluxFilter.java │ │ │ │ ├── FluxFilterFuseable.java │ │ │ │ ├── FluxFilterWhen.java │ │ │ │ ├── FluxFirstWithSignal.java │ │ │ │ ├── FluxFirstWithValue.java │ │ │ │ ├── FluxFlatMap.java │ │ │ │ ├── FluxFlattenIterable.java │ │ │ │ ├── FluxFromMonoOperator.java │ │ │ │ ├── FluxGenerate.java │ │ │ │ ├── FluxGroupBy.java │ │ │ │ ├── FluxGroupJoin.java │ │ │ │ ├── FluxHandle.java │ │ │ │ ├── FluxHandleFuseable.java │ │ │ │ ├── FluxHide.java │ │ │ │ ├── FluxIndex.java │ │ │ │ ├── FluxIndexFuseable.java │ │ │ │ ├── FluxInterval.java │ │ │ │ ├── FluxIterable.java │ │ │ │ ├── FluxJoin.java │ │ │ │ ├── FluxJust.java │ │ │ │ ├── FluxLift.java │ │ │ │ ├── FluxLiftFuseable.java │ │ │ │ ├── FluxLimitRequest.java │ │ │ │ ├── FluxLog.java │ │ │ │ ├── FluxLogFuseable.java │ │ │ │ ├── FluxMap.java │ │ │ │ ├── FluxMapFuseable.java │ │ │ │ ├── FluxMapSignal.java │ │ │ │ ├── FluxMaterialize.java │ │ │ │ ├── FluxMerge.java │ │ │ │ ├── FluxMergeComparing.java │ │ │ │ ├── FluxMergeSequential.java │ │ │ │ ├── FluxMetrics.java │ │ │ │ ├── FluxMetricsFuseable.java │ │ │ │ ├── FluxName.java │ │ │ │ ├── FluxNameFuseable.java │ │ │ │ ├── FluxNever.java │ │ │ │ ├── FluxOnAssembly.java │ │ │ │ ├── FluxOnBackpressureBuffer.java │ │ │ │ ├── FluxOnBackpressureBufferStrategy.java │ │ │ │ ├── FluxOnBackpressureBufferTimeout.java │ │ │ │ ├── FluxOnBackpressureDrop.java │ │ │ │ ├── FluxOnBackpressureLatest.java │ │ │ │ ├── FluxOnErrorResume.java │ │ │ │ ├── FluxOnErrorReturn.java │ │ │ │ ├── FluxOperator.java │ │ │ │ ├── FluxPeek.java │ │ │ │ ├── FluxPeekFuseable.java │ │ │ │ ├── FluxProcessor.java │ │ │ │ ├── FluxPublish.java │ │ │ │ ├── FluxPublishMulticast.java │ │ │ │ ├── FluxPublishOn.java │ │ │ │ ├── FluxRange.java │ │ │ │ ├── FluxRefCount.java │ │ │ │ ├── FluxRefCountGrace.java │ │ │ │ ├── FluxRepeat.java │ │ │ │ ├── FluxRepeatPredicate.java │ │ │ │ ├── FluxRepeatWhen.java │ │ │ │ ├── FluxReplay.java │ │ │ │ ├── FluxRetry.java │ │ │ │ ├── FluxRetryWhen.java │ │ │ │ ├── FluxSample.java │ │ │ │ ├── FluxSampleFirst.java │ │ │ │ ├── FluxSampleTimeout.java │ │ │ │ ├── FluxScan.java │ │ │ │ ├── FluxScanSeed.java │ │ │ │ ├── FluxSink.java │ │ │ │ ├── FluxSkip.java │ │ │ │ ├── FluxSkipLast.java │ │ │ │ ├── FluxSkipUntil.java │ │ │ │ ├── FluxSkipUntilOther.java │ │ │ │ ├── FluxSkipWhile.java │ │ │ │ ├── FluxSource.java │ │ │ │ ├── FluxSourceFuseable.java │ │ │ │ ├── FluxSourceMono.java │ │ │ │ ├── FluxSourceMonoFuseable.java │ │ │ │ ├── FluxStream.java │ │ │ │ ├── FluxSubscribeOn.java │ │ │ │ ├── FluxSubscribeOnCallable.java │ │ │ │ ├── FluxSubscribeOnValue.java │ │ │ │ ├── FluxSwitchIfEmpty.java │ │ │ │ ├── FluxSwitchMap.java │ │ │ │ ├── FluxSwitchMapNoPrefetch.java │ │ │ │ ├── FluxSwitchOnFirst.java │ │ │ │ ├── FluxTake.java │ │ │ │ ├── FluxTakeFuseable.java │ │ │ │ ├── FluxTakeLast.java │ │ │ │ ├── FluxTakeLastOne.java │ │ │ │ ├── FluxTakeUntil.java │ │ │ │ ├── FluxTakeUntilOther.java │ │ │ │ ├── FluxTakeWhile.java │ │ │ │ ├── FluxTap.java │ │ │ │ ├── FluxTapFuseable.java │ │ │ │ ├── FluxTapRestoringThreadLocals.java │ │ │ │ ├── FluxTimed.java │ │ │ │ ├── FluxTimeout.java │ │ │ │ ├── FluxUsing.java │ │ │ │ ├── FluxUsingWhen.java │ │ │ │ ├── FluxWindow.java │ │ │ │ ├── FluxWindowBoundary.java │ │ │ │ ├── FluxWindowPredicate.java │ │ │ │ ├── FluxWindowTimeout.java │ │ │ │ ├── FluxWindowWhen.java │ │ │ │ ├── FluxWithLatestFrom.java │ │ │ │ ├── FluxZip.java │ │ │ │ ├── FluxZipIterable.java │ │ │ │ ├── GroupedFlux.java │ │ │ │ ├── GroupedLift.java │ │ │ │ ├── GroupedLiftFuseable.java │ │ │ │ ├── Hooks.java │ │ │ │ ├── ImmutableSignal.java │ │ │ │ ├── InnerConsumer.java │ │ │ │ ├── InnerOperator.java │ │ │ │ ├── InnerProducer.java │ │ │ │ ├── InternalConnectableFluxOperator.java │ │ │ │ ├── InternalEmptySink.java │ │ │ │ ├── InternalFluxOperator.java │ │ │ │ ├── InternalManySink.java │ │ │ │ ├── InternalMonoOperator.java │ │ │ │ ├── InternalOneSink.java │ │ │ │ ├── InternalProducerAttr.java │ │ │ │ ├── LambdaMonoSubscriber.java │ │ │ │ ├── LambdaSubscriber.java │ │ │ │ ├── Mono.java │ │ │ │ ├── MonoAll.java │ │ │ │ ├── MonoAny.java │ │ │ │ ├── MonoBridges.java │ │ │ │ ├── MonoCacheInvalidateIf.java │ │ │ │ ├── MonoCacheInvalidateWhen.java │ │ │ │ ├── MonoCacheTime.java │ │ │ │ ├── MonoCallable.java │ │ │ │ ├── MonoCallableOnAssembly.java │ │ │ │ ├── MonoCancelOn.java │ │ │ │ ├── MonoCollect.java │ │ │ │ ├── MonoCollectList.java │ │ │ │ ├── MonoCompletionStage.java │ │ │ │ ├── MonoContextWrite.java │ │ │ │ ├── MonoContextWriteRestoringThreadLocals.java │ │ │ │ ├── MonoCount.java │ │ │ │ ├── MonoCreate.java │ │ │ │ ├── MonoCurrentContext.java │ │ │ │ ├── MonoDefaultIfEmpty.java │ │ │ │ ├── MonoDefer.java │ │ │ │ ├── MonoDeferContextual.java │ │ │ │ ├── MonoDelay.java │ │ │ │ ├── MonoDelayElement.java │ │ │ │ ├── MonoDelaySubscription.java │ │ │ │ ├── MonoDelayUntil.java │ │ │ │ ├── MonoDematerialize.java │ │ │ │ ├── MonoDetach.java │ │ │ │ ├── MonoDoFinally.java │ │ │ │ ├── MonoDoFirst.java │ │ │ │ ├── MonoDoFirstFuseable.java │ │ │ │ ├── MonoDoOnEach.java │ │ │ │ ├── MonoDoOnEachFuseable.java │ │ │ │ ├── MonoElapsed.java │ │ │ │ ├── MonoElementAt.java │ │ │ │ ├── MonoEmpty.java │ │ │ │ ├── MonoError.java │ │ │ │ ├── MonoErrorSupplied.java │ │ │ │ ├── MonoExpand.java │ │ │ │ ├── MonoFilter.java │ │ │ │ ├── MonoFilterFuseable.java │ │ │ │ ├── MonoFilterWhen.java │ │ │ │ ├── MonoFirstWithSignal.java │ │ │ │ ├── MonoFirstWithValue.java │ │ │ │ ├── MonoFlatMap.java │ │ │ │ ├── MonoFlatMapMany.java │ │ │ │ ├── MonoFlattenIterable.java │ │ │ │ ├── MonoFromFluxOperator.java │ │ │ │ ├── MonoFromPublisher.java │ │ │ │ ├── MonoHandle.java │ │ │ │ ├── MonoHandleFuseable.java │ │ │ │ ├── MonoHasElement.java │ │ │ │ ├── MonoHasElements.java │ │ │ │ ├── MonoHide.java │ │ │ │ ├── MonoIgnoreElement.java │ │ │ │ ├── MonoIgnoreElements.java │ │ │ │ ├── MonoIgnorePublisher.java │ │ │ │ ├── MonoIgnoreThen.java │ │ │ │ ├── MonoJust.java │ │ │ │ ├── MonoLift.java │ │ │ │ ├── MonoLiftFuseable.java │ │ │ │ ├── MonoLog.java │ │ │ │ ├── MonoLogFuseable.java │ │ │ │ ├── MonoMap.java │ │ │ │ ├── MonoMapFuseable.java │ │ │ │ ├── MonoMaterialize.java │ │ │ │ ├── MonoMetrics.java │ │ │ │ ├── MonoMetricsFuseable.java │ │ │ │ ├── MonoName.java │ │ │ │ ├── MonoNameFuseable.java │ │ │ │ ├── MonoNever.java │ │ │ │ ├── MonoNext.java │ │ │ │ ├── MonoOnAssembly.java │ │ │ │ ├── MonoOnErrorResume.java │ │ │ │ ├── MonoOnErrorReturn.java │ │ │ │ ├── MonoOperator.java │ │ │ │ ├── MonoPeek.java │ │ │ │ ├── MonoPeekFuseable.java │ │ │ │ ├── MonoPeekTerminal.java │ │ │ │ ├── MonoProcessor.java │ │ │ │ ├── MonoPublishMulticast.java │ │ │ │ ├── MonoPublishOn.java │ │ │ │ ├── MonoReduce.java │ │ │ │ ├── MonoReduceSeed.java │ │ │ │ ├── MonoRepeat.java │ │ │ │ ├── MonoRepeatPredicate.java │ │ │ │ ├── MonoRepeatWhen.java │ │ │ │ ├── MonoRetry.java │ │ │ │ ├── MonoRetryWhen.java │ │ │ │ ├── MonoRunnable.java │ │ │ │ ├── MonoSequenceEqual.java │ │ │ │ ├── MonoSingle.java │ │ │ │ ├── MonoSingleCallable.java │ │ │ │ ├── MonoSingleMono.java │ │ │ │ ├── MonoSingleOptional.java │ │ │ │ ├── MonoSingleOptionalCallable.java │ │ │ │ ├── MonoSink.java │ │ │ │ ├── MonoSource.java │ │ │ │ ├── MonoSourceFlux.java │ │ │ │ ├── MonoSourceFluxFuseable.java │ │ │ │ ├── MonoSourceFuseable.java │ │ │ │ ├── MonoStreamCollector.java │ │ │ │ ├── MonoSubscribeOn.java │ │ │ │ ├── MonoSubscribeOnCallable.java │ │ │ │ ├── MonoSubscribeOnValue.java │ │ │ │ ├── MonoSupplier.java │ │ │ │ ├── MonoSwitchIfEmpty.java │ │ │ │ ├── MonoTakeLastOne.java │ │ │ │ ├── MonoTakeUntilOther.java │ │ │ │ ├── MonoTap.java │ │ │ │ ├── MonoTapFuseable.java │ │ │ │ ├── MonoTapRestoringThreadLocals.java │ │ │ │ ├── MonoTimed.java │ │ │ │ ├── MonoTimeout.java │ │ │ │ ├── MonoToCompletableFuture.java │ │ │ │ ├── MonoUsing.java │ │ │ │ ├── MonoUsingWhen.java │ │ │ │ ├── MonoWhen.java │ │ │ │ ├── MonoZip.java │ │ │ │ ├── NextProcessor.java │ │ │ │ ├── OnNextFailureStrategy.java │ │ │ │ ├── OperatorDisposables.java │ │ │ │ ├── Operators.java │ │ │ │ ├── OptimizableOperator.java │ │ │ │ ├── ParallelArraySource.java │ │ │ │ ├── ParallelCollect.java │ │ │ │ ├── ParallelConcatMap.java │ │ │ │ ├── ParallelDoOnEach.java │ │ │ │ ├── ParallelFilter.java │ │ │ │ ├── ParallelFlatMap.java │ │ │ │ ├── ParallelFlux.java │ │ │ │ ├── ParallelFluxHide.java │ │ │ │ ├── ParallelFluxName.java │ │ │ │ ├── ParallelFluxOnAssembly.java │ │ │ │ ├── ParallelFluxRestoringThreadLocals.java │ │ │ │ ├── ParallelGroup.java │ │ │ │ ├── ParallelLift.java │ │ │ │ ├── ParallelLiftFuseable.java │ │ │ │ ├── ParallelLog.java │ │ │ │ ├── ParallelMap.java │ │ │ │ ├── ParallelMergeOrdered.java │ │ │ │ ├── ParallelMergeReduce.java │ │ │ │ ├── ParallelMergeSequential.java │ │ │ │ ├── ParallelMergeSort.java │ │ │ │ ├── ParallelPeek.java │ │ │ │ ├── ParallelReduceSeed.java │ │ │ │ ├── ParallelRunOn.java │ │ │ │ ├── ParallelSource.java │ │ │ │ ├── ParallelThen.java │ │ │ │ ├── QueueDrainSubscriber.java │ │ │ │ ├── ReplayProcessor.java │ │ │ │ ├── SerializedSubscriber.java │ │ │ │ ├── Signal.java │ │ │ │ ├── SignalLogger.java │ │ │ │ ├── SignalPeek.java │ │ │ │ ├── SignalType.java │ │ │ │ ├── SinkEmptyMulticast.java │ │ │ │ ├── SinkEmptySerialized.java │ │ │ │ ├── SinkManyBestEffort.java │ │ │ │ ├── SinkManyEmitterProcessor.java │ │ │ │ ├── SinkManyReplayProcessor.java │ │ │ │ ├── SinkManySerialized.java │ │ │ │ ├── SinkManyUnicast.java │ │ │ │ ├── SinkManyUnicastNoBackpressure.java │ │ │ │ ├── SinkOneMulticast.java │ │ │ │ ├── SinkOneSerialized.java │ │ │ │ ├── Sinks.java │ │ │ │ ├── SinksSpecs.java │ │ │ │ ├── SourceProducer.java │ │ │ │ ├── StateLogger.java │ │ │ │ ├── StrictSubscriber.java │ │ │ │ ├── SynchronousSink.java │ │ │ │ ├── Timed.java │ │ │ │ ├── Traces.java │ │ │ │ ├── UnicastProcessor.java │ │ │ │ ├── doc-files │ │ │ │ │ └── marbles │ │ │ │ │ │ ├── all.svg │ │ │ │ │ │ ├── and.svg │ │ │ │ │ │ ├── any.svg │ │ │ │ │ │ ├── autoConnect.svg │ │ │ │ │ │ ├── autoConnectWithMinSubscribers.svg │ │ │ │ │ │ ├── block.svg │ │ │ │ │ │ ├── blockFirst.svg │ │ │ │ │ │ ├── blockFirstWithTimeout.svg │ │ │ │ │ │ ├── blockLast.svg │ │ │ │ │ │ ├── blockLastWithTimeout.svg │ │ │ │ │ │ ├── blockOptional.svg │ │ │ │ │ │ ├── blockOptionalWithTimeout.svg │ │ │ │ │ │ ├── blockWithTimeout.svg │ │ │ │ │ │ ├── buffer.svg │ │ │ │ │ │ ├── bufferTimeoutWithMaxSizeAndTimespan.svg │ │ │ │ │ │ ├── bufferUntil.svg │ │ │ │ │ │ ├── bufferUntilChanged.svg │ │ │ │ │ │ ├── bufferUntilChangedWithKey.svg │ │ │ │ │ │ ├── bufferUntilWithCutBefore.svg │ │ │ │ │ │ ├── bufferWhen.svg │ │ │ │ │ │ ├── bufferWhenWithSupplier.svg │ │ │ │ │ │ ├── bufferWhile.svg │ │ │ │ │ │ ├── bufferWithBoundary.svg │ │ │ │ │ │ ├── bufferWithMaxSize.svg │ │ │ │ │ │ ├── bufferWithMaxSizeEqualsSkipSize.svg │ │ │ │ │ │ ├── bufferWithMaxSizeGreaterThanSkipSize.svg │ │ │ │ │ │ ├── bufferWithMaxSizeLessThanSkipSize.svg │ │ │ │ │ │ ├── bufferWithTimespan.svg │ │ │ │ │ │ ├── bufferWithTimespanEqualsOpenBufferEvery.svg │ │ │ │ │ │ ├── bufferWithTimespanGreaterThanOpenBufferEvery.svg │ │ │ │ │ │ ├── bufferWithTimespanLessThanOpenBufferEvery.svg │ │ │ │ │ │ ├── cacheForFlux.svg │ │ │ │ │ │ ├── cacheForMono.svg │ │ │ │ │ │ ├── cacheWithHistoryLimitForFlux.svg │ │ │ │ │ │ ├── cacheWithTtlAndMaxLimitForFlux.svg │ │ │ │ │ │ ├── cacheWithTtlForFlux.svg │ │ │ │ │ │ ├── cacheWithTtlForMono.svg │ │ │ │ │ │ ├── cancelOnForFlux.svg │ │ │ │ │ │ ├── cancelOnForMono.svg │ │ │ │ │ │ ├── castForFlux.svg │ │ │ │ │ │ ├── castForMono.svg │ │ │ │ │ │ ├── collect.svg │ │ │ │ │ │ ├── collectList.svg │ │ │ │ │ │ ├── collectMapWithKeyAndValueExtractors.svg │ │ │ │ │ │ ├── collectMapWithKeyExtractor.svg │ │ │ │ │ │ ├── collectMultiMapWithKeyAndValueExtractors.svg │ │ │ │ │ │ ├── collectMultiMapWithKeyExtractor.svg │ │ │ │ │ │ ├── collectSortedList.svg │ │ │ │ │ │ ├── collectSortedListWithComparator.svg │ │ │ │ │ │ ├── collectWithCollector.svg │ │ │ │ │ │ ├── combineLatest.svg │ │ │ │ │ │ ├── concatAsyncSources.svg │ │ │ │ │ │ ├── concatMap.svg │ │ │ │ │ │ ├── concatMapIterable.svg │ │ │ │ │ │ ├── concatVarSources.svg │ │ │ │ │ │ ├── concatWithForFlux.svg │ │ │ │ │ │ ├── concatWithForMono.svg │ │ │ │ │ │ ├── concatWithValues.svg │ │ │ │ │ │ ├── count.svg │ │ │ │ │ │ ├── createForFlux.svg │ │ │ │ │ │ ├── createForMono.svg │ │ │ │ │ │ ├── createWithOverflowStrategy.svg │ │ │ │ │ │ ├── defaultIfEmpty.svg │ │ │ │ │ │ ├── deferForFlux.svg │ │ │ │ │ │ ├── deferForMono.svg │ │ │ │ │ │ ├── delay.svg │ │ │ │ │ │ ├── delayElement.svg │ │ │ │ │ │ ├── delayElements.svg │ │ │ │ │ │ ├── delaySequence.svg │ │ │ │ │ │ ├── delaySubscriptionForFlux.svg │ │ │ │ │ │ ├── delaySubscriptionForMono.svg │ │ │ │ │ │ ├── delaySubscriptionWithPublisherForFlux.svg │ │ │ │ │ │ ├── delaySubscriptionWithPublisherForMono.svg │ │ │ │ │ │ ├── delayUntilForFlux.svg │ │ │ │ │ │ ├── delayUntilForMono.svg │ │ │ │ │ │ ├── dematerializeForFlux.svg │ │ │ │ │ │ ├── dematerializeForMono.svg │ │ │ │ │ │ ├── distinct.svg │ │ │ │ │ │ ├── distinctUntilChanged.svg │ │ │ │ │ │ ├── distinctUntilChangedWithKey.svg │ │ │ │ │ │ ├── distinctWithKey.svg │ │ │ │ │ │ ├── doAfterTerminateForFlux.svg │ │ │ │ │ │ ├── doAfterTerminateForMono.svg │ │ │ │ │ │ ├── doFinallyForFlux.svg │ │ │ │ │ │ ├── doFinallyForMono.svg │ │ │ │ │ │ ├── doFirstForFlux.svg │ │ │ │ │ │ ├── doFirstForMono.svg │ │ │ │ │ │ ├── doOnCancelForFlux.svg │ │ │ │ │ │ ├── doOnCancelForMono.svg │ │ │ │ │ │ ├── doOnComplete.svg │ │ │ │ │ │ ├── doOnEachForFlux.svg │ │ │ │ │ │ ├── doOnEachForMono.svg │ │ │ │ │ │ ├── doOnErrorForFlux.svg │ │ │ │ │ │ ├── doOnErrorForMono.svg │ │ │ │ │ │ ├── doOnErrorWithClassPredicateForFlux.svg │ │ │ │ │ │ ├── doOnErrorWithClassPredicateForMono.svg │ │ │ │ │ │ ├── doOnErrorWithPredicateForFlux.svg │ │ │ │ │ │ ├── doOnErrorWithPredicateForMono.svg │ │ │ │ │ │ ├── doOnNextForFlux.svg │ │ │ │ │ │ ├── doOnNextForMono.svg │ │ │ │ │ │ ├── doOnRequestForFlux.svg │ │ │ │ │ │ ├── doOnRequestForMono.svg │ │ │ │ │ │ ├── doOnSubscribe.svg │ │ │ │ │ │ ├── doOnSuccess.svg │ │ │ │ │ │ ├── doOnTerminateForFlux.svg │ │ │ │ │ │ ├── doOnTerminateForMono.svg │ │ │ │ │ │ ├── elapsedForFlux.svg │ │ │ │ │ │ ├── elapsedForMono.svg │ │ │ │ │ │ ├── elementAt.svg │ │ │ │ │ │ ├── elementAtWithDefault.svg │ │ │ │ │ │ ├── empty.svg │ │ │ │ │ │ ├── error.svg │ │ │ │ │ │ ├── errorWhenRequested.svg │ │ │ │ │ │ ├── errorWithSupplier.svg │ │ │ │ │ │ ├── filterForFlux.svg │ │ │ │ │ │ ├── filterForMono.svg │ │ │ │ │ │ ├── filterWhenForFlux.svg │ │ │ │ │ │ ├── filterWhenForMono.svg │ │ │ │ │ │ ├── firstWithSignalForFlux.svg │ │ │ │ │ │ ├── firstWithSignalForMono.svg │ │ │ │ │ │ ├── firstWithValueForFlux.svg │ │ │ │ │ │ ├── firstWithValueForMono.svg │ │ │ │ │ │ ├── flatMapForFlux.svg │ │ │ │ │ │ ├── flatMapForMono.svg │ │ │ │ │ │ ├── flatMapIterableForFlux.svg │ │ │ │ │ │ ├── flatMapIterableForMono.svg │ │ │ │ │ │ ├── flatMapMany.svg │ │ │ │ │ │ ├── flatMapManyWithMappersOnTerminalEvents.svg │ │ │ │ │ │ ├── flatMapSequential.svg │ │ │ │ │ │ ├── flatMapSequentialWithConcurrency.svg │ │ │ │ │ │ ├── flatMapSequentialWithConcurrencyAndPrefetch.svg │ │ │ │ │ │ ├── flatMapWithConcurrency.svg │ │ │ │ │ │ ├── flatMapWithConcurrencyAndPrefetch.svg │ │ │ │ │ │ ├── flatMapWithMappersOnTerminalEventsForFlux.svg │ │ │ │ │ │ ├── flux.svg │ │ │ │ │ │ ├── fromArray.svg │ │ │ │ │ │ ├── fromCallable.svg │ │ │ │ │ │ ├── fromForFlux.svg │ │ │ │ │ │ ├── fromForMono.svg │ │ │ │ │ │ ├── fromFuture.svg │ │ │ │ │ │ ├── fromFutureSupplier.svg │ │ │ │ │ │ ├── fromIterable.svg │ │ │ │ │ │ ├── fromRunnable.svg │ │ │ │ │ │ ├── fromStream.svg │ │ │ │ │ │ ├── fromSupplier.svg │ │ │ │ │ │ ├── generate.svg │ │ │ │ │ │ ├── generateStateless.svg │ │ │ │ │ │ ├── generateWithCleanup.svg │ │ │ │ │ │ ├── groupByWithKeyMapper.svg │ │ │ │ │ │ ├── groupByWithKeyMapperAndValueMapper.svg │ │ │ │ │ │ ├── groupJoin.svg │ │ │ │ │ │ ├── hasElementForFlux.svg │ │ │ │ │ │ ├── hasElementForMono.svg │ │ │ │ │ │ ├── hasElements.svg │ │ │ │ │ │ ├── ignoreElementForMono.svg │ │ │ │ │ │ ├── ignoreElementsForFlux.svg │ │ │ │ │ │ ├── ignoreElementsForMono.svg │ │ │ │ │ │ ├── index.svg │ │ │ │ │ │ ├── indexWithMapper.svg │ │ │ │ │ │ ├── interval.svg │ │ │ │ │ │ ├── intervalWithDelay.svg │ │ │ │ │ │ ├── join.svg │ │ │ │ │ │ ├── just.svg │ │ │ │ │ │ ├── justMultiple.svg │ │ │ │ │ │ ├── justOrEmpty.svg │ │ │ │ │ │ ├── last.svg │ │ │ │ │ │ ├── lastWithDefault.svg │ │ │ │ │ │ ├── limitRate.svg │ │ │ │ │ │ ├── limitRateWithHighAndLowTide.svg │ │ │ │ │ │ ├── logForFlux.svg │ │ │ │ │ │ ├── logForMono.svg │ │ │ │ │ │ ├── mapForFlux.svg │ │ │ │ │ │ ├── mapForMono.svg │ │ │ │ │ │ ├── mapNotNullForFlux.svg │ │ │ │ │ │ ├── mapNotNullForMono.svg │ │ │ │ │ │ ├── materializeForFlux.svg │ │ │ │ │ │ ├── materializeForMono.svg │ │ │ │ │ │ ├── mergeAsyncSources.svg │ │ │ │ │ │ ├── mergeComparing.svg │ │ │ │ │ │ ├── mergeComparingNaturalOrder.svg │ │ │ │ │ │ ├── mergeComparingWith.svg │ │ │ │ │ │ ├── mergeFixedSources.svg │ │ │ │ │ │ ├── mergePriority.svg │ │ │ │ │ │ ├── mergePriorityNaturalOrder.svg │ │ │ │ │ │ ├── mergeSequentialAsyncSources.svg │ │ │ │ │ │ ├── mergeSequentialVarSources.svg │ │ │ │ │ │ ├── mergeWithForFlux.svg │ │ │ │ │ │ ├── mergeWithForMono.svg │ │ │ │ │ │ ├── mono.svg │ │ │ │ │ │ ├── never.svg │ │ │ │ │ │ ├── next.svg │ │ │ │ │ │ ├── ofTypeForFlux.svg │ │ │ │ │ │ ├── ofTypeForMono.svg │ │ │ │ │ │ ├── onBackpressureBuffer.svg │ │ │ │ │ │ ├── onBackpressureBufferWithDurationAndMaxSize.svg │ │ │ │ │ │ ├── onBackpressureBufferWithMaxSize.svg │ │ │ │ │ │ ├── onBackpressureBufferWithMaxSizeConsumer.svg │ │ │ │ │ │ ├── onBackpressureBufferWithMaxSizeStrategyDropOldest.svg │ │ │ │ │ │ ├── onBackpressureDrop.svg │ │ │ │ │ │ ├── onBackpressureDropWithConsumer.svg │ │ │ │ │ │ ├── onBackpressureError.svg │ │ │ │ │ │ ├── onBackpressureLatest.svg │ │ │ │ │ │ ├── onErrorCompleteForFlux.svg │ │ │ │ │ │ ├── onErrorCompleteForMono.svg │ │ │ │ │ │ ├── onErrorContinue.svg │ │ │ │ │ │ ├── onErrorContinueWithClassPredicate.svg │ │ │ │ │ │ ├── onErrorContinueWithPredicate.svg │ │ │ │ │ │ ├── onErrorMapForFlux.svg │ │ │ │ │ │ ├── onErrorMapForMono.svg │ │ │ │ │ │ ├── onErrorMapWithClassPredicateForFlux.svg │ │ │ │ │ │ ├── onErrorMapWithClassPredicateForMono.svg │ │ │ │ │ │ ├── onErrorMapWithPredicateForFlux.svg │ │ │ │ │ │ ├── onErrorMapWithPredicateForMono.svg │ │ │ │ │ │ ├── onErrorResumeForFlux.svg │ │ │ │ │ │ ├── onErrorResumeForMono.svg │ │ │ │ │ │ ├── onErrorReturnForFlux.svg │ │ │ │ │ │ ├── onErrorReturnForMono.svg │ │ │ │ │ │ ├── orForFlux.svg │ │ │ │ │ │ ├── orForMono.svg │ │ │ │ │ │ ├── parallel.svg │ │ │ │ │ │ ├── publish.svg │ │ │ │ │ │ ├── publishNext.svg │ │ │ │ │ │ ├── publishOnForFlux.svg │ │ │ │ │ │ ├── publishOnForMono.svg │ │ │ │ │ │ ├── push.svg │ │ │ │ │ │ ├── pushWithOverflowStrategy.svg │ │ │ │ │ │ ├── range.svg │ │ │ │ │ │ ├── reduce.svg │ │ │ │ │ │ ├── reduceWith.svg │ │ │ │ │ │ ├── reduceWithSameReturnType.svg │ │ │ │ │ │ ├── refCount.svg │ │ │ │ │ │ ├── refCountWithMinSubscribers.svg │ │ │ │ │ │ ├── refCountWithMinSubscribersAndGracePeriod.svg │ │ │ │ │ │ ├── repeatForFlux.svg │ │ │ │ │ │ ├── repeatForMono.svg │ │ │ │ │ │ ├── repeatWhenEmpty.svg │ │ │ │ │ │ ├── repeatWhenForFlux.svg │ │ │ │ │ │ ├── repeatWhenForMono.svg │ │ │ │ │ │ ├── repeatWithAttemptsAndPredicateForFlux.svg │ │ │ │ │ │ ├── repeatWithAttemptsAndPredicateForMono.svg │ │ │ │ │ │ ├── repeatWithAttemptsForFlux.svg │ │ │ │ │ │ ├── repeatWithAttemptsForMono.svg │ │ │ │ │ │ ├── repeatWithPredicateForFlux.svg │ │ │ │ │ │ ├── repeatWithPredicateForMono.svg │ │ │ │ │ │ ├── replay.svg │ │ │ │ │ │ ├── replayWithHistory.svg │ │ │ │ │ │ ├── replayWithHistoryAndTtl.svg │ │ │ │ │ │ ├── replayWithTtl.svg │ │ │ │ │ │ ├── retryBackoffForFlux.svg │ │ │ │ │ │ ├── retryBackoffForMono.svg │ │ │ │ │ │ ├── retryForFlux.svg │ │ │ │ │ │ ├── retryForMono.svg │ │ │ │ │ │ ├── retryWhenForFlux.svg │ │ │ │ │ │ ├── retryWhenForMono.svg │ │ │ │ │ │ ├── retryWhenSpecForFlux.svg │ │ │ │ │ │ ├── retryWhenSpecForMono.svg │ │ │ │ │ │ ├── retryWithAttemptsAndPredicateForFlux.svg │ │ │ │ │ │ ├── retryWithAttemptsAndPredicateForMono.svg │ │ │ │ │ │ ├── retryWithAttemptsForFlux.svg │ │ │ │ │ │ ├── retryWithAttemptsForMono.svg │ │ │ │ │ │ ├── retryWithPredicateForFlux.svg │ │ │ │ │ │ ├── retryWithPredicateForMono.svg │ │ │ │ │ │ ├── sampleAtRegularInterval.svg │ │ │ │ │ │ ├── sampleFirstAtRegularInterval.svg │ │ │ │ │ │ ├── sampleFirstWithSamplerFactory.svg │ │ │ │ │ │ ├── sampleTimeoutWithThrottlerFactory.svg │ │ │ │ │ │ ├── sampleTimeoutWithThrottlerFactoryAndMaxConcurrency.svg │ │ │ │ │ │ ├── sampleWithSampler.svg │ │ │ │ │ │ ├── scan.svg │ │ │ │ │ │ ├── scanWith.svg │ │ │ │ │ │ ├── scanWithSameReturnType.svg │ │ │ │ │ │ ├── sequenceEqual.svg │ │ │ │ │ │ ├── shareForMono.svg │ │ │ │ │ │ ├── shareNext.svg │ │ │ │ │ │ ├── singleForFlux.svg │ │ │ │ │ │ ├── singleForMono.svg │ │ │ │ │ │ ├── singleOptional.svg │ │ │ │ │ │ ├── singleOrEmpty.svg │ │ │ │ │ │ ├── singleWithDefault.svg │ │ │ │ │ │ ├── sinkDirectAllOrNothing.svg │ │ │ │ │ │ ├── sinkDirectBestEffort.svg │ │ │ │ │ │ ├── sinkNoWarmup.svg │ │ │ │ │ │ ├── sinkWarmup.svg │ │ │ │ │ │ ├── skip.svg │ │ │ │ │ │ ├── skipLast.svg │ │ │ │ │ │ ├── skipUntil.svg │ │ │ │ │ │ ├── skipUntilOther.svg │ │ │ │ │ │ ├── skipWhile.svg │ │ │ │ │ │ ├── skipWithTimespan.svg │ │ │ │ │ │ ├── sort.svg │ │ │ │ │ │ ├── startWithIterable.svg │ │ │ │ │ │ ├── startWithPublisher.svg │ │ │ │ │ │ ├── startWithValues.svg │ │ │ │ │ │ ├── subscribeForFlux.svg │ │ │ │ │ │ ├── subscribeForMono.svg │ │ │ │ │ │ ├── subscribeIgoringAllSignalsForFlux.svg │ │ │ │ │ │ ├── subscribeIgoringAllSignalsForMono.svg │ │ │ │ │ │ ├── subscribeOnForFlux.svg │ │ │ │ │ │ ├── subscribeOnForMono.svg │ │ │ │ │ │ ├── subscribeWithOnNextAndOnErrorAndOnCompleteForFlux.svg │ │ │ │ │ │ ├── subscribeWithOnNextAndOnErrorAndOnCompleteForMono.svg │ │ │ │ │ │ ├── subscribeWithOnNextAndOnErrorForFlux.svg │ │ │ │ │ │ ├── subscribeWithOnNextAndOnErrorForMono.svg │ │ │ │ │ │ ├── subscribeWithOnNextForFlux.svg │ │ │ │ │ │ ├── subscribeWithOnNextForMono.svg │ │ │ │ │ │ ├── switchIfEmptyForFlux.svg │ │ │ │ │ │ ├── switchIfEmptyForMono.svg │ │ │ │ │ │ ├── switchMap.svg │ │ │ │ │ │ ├── switchOnFirst.svg │ │ │ │ │ │ ├── switchOnNext.svg │ │ │ │ │ │ ├── takeLast.svg │ │ │ │ │ │ ├── takeLimitRequestFalse.svg │ │ │ │ │ │ ├── takeLimitRequestTrue.svg │ │ │ │ │ │ ├── takeUntil.svg │ │ │ │ │ │ ├── takeUntilOtherForFlux.svg │ │ │ │ │ │ ├── takeUntilOtherForMono.svg │ │ │ │ │ │ ├── takeWhile.svg │ │ │ │ │ │ ├── takeWithTimespanForFlux.svg │ │ │ │ │ │ ├── takeWithTimespanForMono.svg │ │ │ │ │ │ ├── thenEmptyForFlux.svg │ │ │ │ │ │ ├── thenEmptyForMono.svg │ │ │ │ │ │ ├── thenForFlux.svg │ │ │ │ │ │ ├── thenForMono.svg │ │ │ │ │ │ ├── thenManyForFlux.svg │ │ │ │ │ │ ├── thenManyForMono.svg │ │ │ │ │ │ ├── thenReturn.svg │ │ │ │ │ │ ├── thenWithMonoForFlux.svg │ │ │ │ │ │ ├── thenWithMonoForMono.svg │ │ │ │ │ │ ├── timedForFlux.svg │ │ │ │ │ │ ├── timedForMono.svg │ │ │ │ │ │ ├── timeoutFallbackForFlux.svg │ │ │ │ │ │ ├── timeoutFallbackForMono.svg │ │ │ │ │ │ ├── timeoutForFlux.svg │ │ │ │ │ │ ├── timeoutForMono.svg │ │ │ │ │ │ ├── timeoutPublisher.svg │ │ │ │ │ │ ├── timeoutPublisherAndFallbackForMono.svg │ │ │ │ │ │ ├── timeoutPublisherFunctionAndFallbackForFlux.svg │ │ │ │ │ │ ├── timeoutPublisherFunctionForFlux.svg │ │ │ │ │ │ ├── timestampForFlux.svg │ │ │ │ │ │ ├── timestampForMono.svg │ │ │ │ │ │ ├── toFuture.svg │ │ │ │ │ │ ├── toIterable.svg │ │ │ │ │ │ ├── toIterableWithBatchSize.svg │ │ │ │ │ │ ├── toStream.svg │ │ │ │ │ │ ├── toStreamWithBatchSize.svg │ │ │ │ │ │ ├── transformDeferredForFlux.svg │ │ │ │ │ │ ├── transformDeferredForMono.svg │ │ │ │ │ │ ├── transformForFlux.svg │ │ │ │ │ │ ├── transformForMono.svg │ │ │ │ │ │ ├── usingForFlux.svg │ │ │ │ │ │ ├── usingForMono.svg │ │ │ │ │ │ ├── usingWhenCleanupErrorForFlux.svg │ │ │ │ │ │ ├── usingWhenEarlyCancelForFlux.svg │ │ │ │ │ │ ├── usingWhenFailureForFlux.svg │ │ │ │ │ │ ├── usingWhenFailureForMono.svg │ │ │ │ │ │ ├── usingWhenSuccessForFlux.svg │ │ │ │ │ │ ├── usingWhenSuccessForMono.svg │ │ │ │ │ │ ├── when.svg │ │ │ │ │ │ ├── whenDelayError.svg │ │ │ │ │ │ ├── windowTimeout.svg │ │ │ │ │ │ ├── windowUntil.svg │ │ │ │ │ │ ├── windowUntilChanged.svg │ │ │ │ │ │ ├── windowUntilChangedWithKeySelector.svg │ │ │ │ │ │ ├── windowUntilWithCutBefore.svg │ │ │ │ │ │ ├── windowWhen.svg │ │ │ │ │ │ ├── windowWhile.svg │ │ │ │ │ │ ├── windowWithBoundary.svg │ │ │ │ │ │ ├── windowWithMaxSize.svg │ │ │ │ │ │ ├── windowWithMaxSizeEqualsSkipSize.svg │ │ │ │ │ │ ├── windowWithMaxSizeGreaterThanSkipSize.svg │ │ │ │ │ │ ├── windowWithMaxSizeLessThanSkipSize.svg │ │ │ │ │ │ ├── windowWithTimespan.svg │ │ │ │ │ │ ├── windowWithTimespanEqualsOpenWindowEvery.svg │ │ │ │ │ │ ├── windowWithTimespanGreaterThanOpenWindowEvery.svg │ │ │ │ │ │ ├── windowWithTimespanLessThanOpenWindowEvery.svg │ │ │ │ │ │ ├── withLatestFrom.svg │ │ │ │ │ │ ├── zipAsyncSourcesForFlux.svg │ │ │ │ │ │ ├── zipDelayErrorFixedSources.svg │ │ │ │ │ │ ├── zipDelayErrorIterableSources.svg │ │ │ │ │ │ ├── zipDelayErrorVarSourcesWithZipper.svg │ │ │ │ │ │ ├── zipFixedSourcesForFlux.svg │ │ │ │ │ │ ├── zipFixedSourcesForMono.svg │ │ │ │ │ │ ├── zipIterableSourcesForFlux.svg │ │ │ │ │ │ ├── zipIterableSourcesForMono.svg │ │ │ │ │ │ ├── zipTwoSourcesWithZipperForFlux.svg │ │ │ │ │ │ ├── zipTwoSourcesWithZipperForMono.svg │ │ │ │ │ │ ├── zipVarSourcesWithZipperForMono.svg │ │ │ │ │ │ ├── zipWhenForMono.svg │ │ │ │ │ │ ├── zipWhenWithZipperForMono.svg │ │ │ │ │ │ ├── zipWithIterableForFlux.svg │ │ │ │ │ │ ├── zipWithIterableUsingZipperForFlux.svg │ │ │ │ │ │ ├── zipWithOtherForFlux.svg │ │ │ │ │ │ ├── zipWithOtherForMono.svg │ │ │ │ │ │ ├── zipWithOtherUsingZipperForFlux.svg │ │ │ │ │ │ └── zipWithOtherUsingZipperForMono.svg │ │ │ │ └── package-info.java │ │ │ └── scheduler │ │ │ │ ├── BoundedElasticScheduler.java │ │ │ │ ├── BoundedElasticSchedulerSupplier.java │ │ │ │ ├── BoundedElasticThreadPerTaskScheduler.java │ │ │ │ ├── DelegateServiceScheduler.java │ │ │ │ ├── DelegatingScheduledExecutorService.java │ │ │ │ ├── EmptyCompositeDisposable.java │ │ │ │ ├── ExecutorScheduler.java │ │ │ │ ├── ExecutorServiceWorker.java │ │ │ │ ├── ImmediateScheduler.java │ │ │ │ ├── InstantPeriodicWorkerTask.java │ │ │ │ ├── NonBlocking.java │ │ │ │ ├── ParallelScheduler.java │ │ │ │ ├── PeriodicSchedulerTask.java │ │ │ │ ├── PeriodicWorkerTask.java │ │ │ │ ├── ReactorBlockHoundIntegration.java │ │ │ │ ├── ReactorThreadFactory.java │ │ │ │ ├── Scheduler.java │ │ │ │ ├── SchedulerMetricDecorator.java │ │ │ │ ├── SchedulerState.java │ │ │ │ ├── SchedulerTask.java │ │ │ │ ├── Schedulers.java │ │ │ │ ├── SingleScheduler.java │ │ │ │ ├── SingleWorkerScheduler.java │ │ │ │ ├── VirtualThreadFactory.java │ │ │ │ ├── WorkerTask.java │ │ │ │ └── package-info.java │ │ │ └── util │ │ │ ├── Logger.java │ │ │ ├── Loggers.java │ │ │ ├── Metrics.java │ │ │ ├── annotation │ │ │ ├── Incubating.java │ │ │ ├── NonNull.java │ │ │ ├── NonNullApi.java │ │ │ └── Nullable.java │ │ │ ├── concurrent │ │ │ ├── MpscLinkedQueue.java │ │ │ ├── Queues.java │ │ │ ├── SpscArrayQueue.java │ │ │ ├── SpscLinkedArrayQueue.java │ │ │ └── package-info.java │ │ │ ├── context │ │ │ ├── Context.java │ │ │ ├── Context0.java │ │ │ ├── Context1.java │ │ │ ├── Context2.java │ │ │ ├── Context3.java │ │ │ ├── Context4.java │ │ │ ├── Context5.java │ │ │ ├── ContextN.java │ │ │ ├── ContextView.java │ │ │ ├── CoreContext.java │ │ │ ├── ReactorContextAccessor.java │ │ │ └── package-info.java │ │ │ ├── function │ │ │ ├── Tuple2.java │ │ │ ├── Tuple3.java │ │ │ ├── Tuple4.java │ │ │ ├── Tuple5.java │ │ │ ├── Tuple6.java │ │ │ ├── Tuple7.java │ │ │ ├── Tuple8.java │ │ │ ├── Tuples.java │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ ├── repeat │ │ │ ├── ImmutableRepeatSignal.java │ │ │ └── RepeatSpec.java │ │ │ └── retry │ │ │ ├── ImmutableRetrySignal.java │ │ │ ├── Retry.java │ │ │ ├── RetryBackoffSpec.java │ │ │ ├── RetrySpec.java │ │ │ └── doc-files │ │ │ └── marbles │ │ │ ├── retrySpecAttempts.svg │ │ │ ├── retrySpecBackoff.svg │ │ │ ├── retrySpecFixed.svg │ │ │ └── retrySpecInARow.svg │ ├── java11 │ │ └── reactor │ │ │ └── core │ │ │ └── publisher │ │ │ └── CallSiteSupplierFactory.java │ ├── java21 │ │ └── reactor │ │ │ └── core │ │ │ └── scheduler │ │ │ ├── BoundedElasticSchedulerSupplier.java │ │ │ ├── BoundedElasticThreadPerTaskScheduler.java │ │ │ └── VirtualThreadFactory.java │ └── resources │ │ └── META-INF │ │ ├── native-image │ │ └── io.projectreactor │ │ │ └── reactor-core │ │ │ └── reflect-config.json │ │ └── services │ │ ├── io.micrometer.context.ContextAccessor │ │ └── reactor.blockhound.integration.BlockHoundIntegration │ ├── tckTest │ └── java │ │ └── reactor │ │ └── core │ │ └── publisher │ │ └── tck │ │ ├── AbstractFluxVerification.java │ │ ├── FluxBlackboxProcessorVerification.java │ │ ├── FluxGenerateVerification.java │ │ └── FluxSwitchOnFirstVerification.java │ ├── test │ ├── java │ │ └── reactor │ │ │ ├── HooksTraceTest.java │ │ │ ├── ReactorLauncherSessionListener.java │ │ │ ├── ReactorTestExecutionListener.java │ │ │ ├── core │ │ │ ├── ContextBestPracticesArchTest.java │ │ │ ├── CoreTest.java │ │ │ ├── DisposableTest.java │ │ │ ├── DisposablesTest.java │ │ │ ├── ExceptionsTest.java │ │ │ ├── FuseableTest.java │ │ │ ├── ListCompositeDisposableTest.java │ │ │ ├── QueueSubscriptionTest.java │ │ │ ├── ScannableTest.java │ │ │ ├── SwapDisposableTest.java │ │ │ ├── TestLoggerExtension.java │ │ │ ├── publisher │ │ │ │ ├── AbstractFluxConcatMapTest.java │ │ │ │ ├── BaseSubscriberTest.java │ │ │ │ ├── BlockingIterableTest.java │ │ │ │ ├── BlockingOptionalMonoSubscriberTest.java │ │ │ │ ├── BlockingSingleSubscriberTest.java │ │ │ │ ├── BlockingTests.java │ │ │ │ ├── ConnectableFluxHideTest.java │ │ │ │ ├── ConnectableFluxOnAssemblyTest.java │ │ │ │ ├── ContextLossDetectionTest.java │ │ │ │ ├── ContextPropagationNotThereSmokeTest.java │ │ │ │ ├── ContextTests.java │ │ │ │ ├── FluxArrayTest.java │ │ │ │ ├── FluxAutoConnectFuseableTest.java │ │ │ │ ├── FluxAutoConnectTest.java │ │ │ │ ├── FluxBufferBoundaryTest.java │ │ │ │ ├── FluxBufferPredicateTest.java │ │ │ │ ├── FluxBufferTest.java │ │ │ │ ├── FluxBufferTimeoutFairBackpressureTest.java │ │ │ │ ├── FluxBufferTimeoutTest.java │ │ │ │ ├── FluxBufferWhenTest.java │ │ │ │ ├── FluxCacheTest.java │ │ │ │ ├── FluxCallableOnAssemblyTest.java │ │ │ │ ├── FluxCallableTest.java │ │ │ │ ├── FluxCancelOnTest.java │ │ │ │ ├── FluxCastTest.java │ │ │ │ ├── FluxCombineLatestTest.java │ │ │ │ ├── FluxConcatArrayTest.java │ │ │ │ ├── FluxConcatIterableTest.java │ │ │ │ ├── FluxConcatMapNoPrefetchTest.java │ │ │ │ ├── FluxConcatMapTest.java │ │ │ │ ├── FluxConcatWithTest.java │ │ │ │ ├── FluxContextWriteTest.java │ │ │ │ ├── FluxCreateTest.java │ │ │ │ ├── FluxDefaultIfEmptyTest.java │ │ │ │ ├── FluxDeferComposeTest.java │ │ │ │ ├── FluxDeferContextualTest.java │ │ │ │ ├── FluxDeferTest.java │ │ │ │ ├── FluxDelaySequenceTest.java │ │ │ │ ├── FluxDelaySubscriptionTest.java │ │ │ │ ├── FluxDelayUntilTest.java │ │ │ │ ├── FluxDematerializeTest.java │ │ │ │ ├── FluxDetachTest.java │ │ │ │ ├── FluxDistinctTest.java │ │ │ │ ├── FluxDistinctUntilChangedTest.java │ │ │ │ ├── FluxDoFinallyTest.java │ │ │ │ ├── FluxDoFirstTest.java │ │ │ │ ├── FluxDoOnEachTest.java │ │ │ │ ├── FluxElapsedTest.java │ │ │ │ ├── FluxEmptyTest.java │ │ │ │ ├── FluxErrorOnRequestTest.java │ │ │ │ ├── FluxErrorSuppliedTest.java │ │ │ │ ├── FluxErrorTest.java │ │ │ │ ├── FluxExpandTest.java │ │ │ │ ├── FluxFilterFuseableTest.java │ │ │ │ ├── FluxFilterTest.java │ │ │ │ ├── FluxFilterWhenTest.java │ │ │ │ ├── FluxFirstWithSignalOrTest.java │ │ │ │ ├── FluxFirstWithSignalTest.java │ │ │ │ ├── FluxFirstWithValueTest.java │ │ │ │ ├── FluxFlatMapTest.java │ │ │ │ ├── FluxFlattenIterableTest.java │ │ │ │ ├── FluxGenerateTest.java │ │ │ │ ├── FluxGroupByTest.java │ │ │ │ ├── FluxGroupJoinTest.java │ │ │ │ ├── FluxHandleTest.java │ │ │ │ ├── FluxHideTest.java │ │ │ │ ├── FluxIndexTest.java │ │ │ │ ├── FluxIndexedFuseableTest.java │ │ │ │ ├── FluxIntervalTest.java │ │ │ │ ├── FluxIterableTest.java │ │ │ │ ├── FluxJoinTest.java │ │ │ │ ├── FluxJustTest.java │ │ │ │ ├── FluxLimitRequestTest.java │ │ │ │ ├── FluxLogTest.java │ │ │ │ ├── FluxMapNotNullTest.java │ │ │ │ ├── FluxMapSignalTest.java │ │ │ │ ├── FluxMapTest.java │ │ │ │ ├── FluxMaterializeTest.java │ │ │ │ ├── FluxMergeComparingTest.java │ │ │ │ ├── FluxMergeOrderedTest.java │ │ │ │ ├── FluxMergeSequentialTest.java │ │ │ │ ├── FluxMergeTest.java │ │ │ │ ├── FluxMergeWithTest.java │ │ │ │ ├── FluxNameFuseableTest.java │ │ │ │ ├── FluxNameTest.java │ │ │ │ ├── FluxNeverTest.java │ │ │ │ ├── FluxOnAssemblyTest.java │ │ │ │ ├── FluxOnBackpressureBufferStrategyTest.java │ │ │ │ ├── FluxOnBackpressureBufferTest.java │ │ │ │ ├── FluxOnBackpressureBufferTimeoutTest.java │ │ │ │ ├── FluxOnBackpressureDropTest.java │ │ │ │ ├── FluxOnBackpressureLatestTest.java │ │ │ │ ├── FluxOnErrorResumeTest.java │ │ │ │ ├── FluxOnErrorReturnTest.java │ │ │ │ ├── FluxPeekFuseableTest.java │ │ │ │ ├── FluxPeekTest.java │ │ │ │ ├── FluxPublishMulticastTest.java │ │ │ │ ├── FluxPublishOnTest.java │ │ │ │ ├── FluxPublishTest.java │ │ │ │ ├── FluxRangeTest.java │ │ │ │ ├── FluxRefCountGraceTest.java │ │ │ │ ├── FluxRefCountTest.java │ │ │ │ ├── FluxRepeatPredicateTest.java │ │ │ │ ├── FluxRepeatTest.java │ │ │ │ ├── FluxRepeatWhenTest.java │ │ │ │ ├── FluxReplayTest.java │ │ │ │ ├── FluxRetryTest.java │ │ │ │ ├── FluxRetryWhenTest.java │ │ │ │ ├── FluxSampleFirstTest.java │ │ │ │ ├── FluxSampleTest.java │ │ │ │ ├── FluxSampleTimeoutTest.java │ │ │ │ ├── FluxScanSeedTest.java │ │ │ │ ├── FluxScanTest.java │ │ │ │ ├── FluxSkipLastTest.java │ │ │ │ ├── FluxSkipTest.java │ │ │ │ ├── FluxSkipUntilOtherTest.java │ │ │ │ ├── FluxSkipUntilTest.java │ │ │ │ ├── FluxSkipWhileTest.java │ │ │ │ ├── FluxSourceMonoTest.java │ │ │ │ ├── FluxSourceTest.java │ │ │ │ ├── FluxStartWithTest.java │ │ │ │ ├── FluxStreamTest.java │ │ │ │ ├── FluxSubscribeOnCallableTest.java │ │ │ │ ├── FluxSubscribeOnTest.java │ │ │ │ ├── FluxSubscribeOnValueTest.java │ │ │ │ ├── FluxSwitchIfEmptyTest.java │ │ │ │ ├── FluxSwitchMapTest.java │ │ │ │ ├── FluxSwitchOnFirstTest.java │ │ │ │ ├── FluxSwitchOnNextTest.java │ │ │ │ ├── FluxTakeLastOneTest.java │ │ │ │ ├── FluxTakeLastTest.java │ │ │ │ ├── FluxTakeTest.java │ │ │ │ ├── FluxTakeUntilOtherTest.java │ │ │ │ ├── FluxTakeUntilPredicateTest.java │ │ │ │ ├── FluxTakeWhileTest.java │ │ │ │ ├── FluxThenManyTest.java │ │ │ │ ├── FluxTimedTest.java │ │ │ │ ├── FluxTimeoutTest.java │ │ │ │ ├── FluxTimestampTest.java │ │ │ │ ├── FluxUsingTest.java │ │ │ │ ├── FluxUsingWhenTest.java │ │ │ │ ├── FluxWindowBoundaryTest.java │ │ │ │ ├── FluxWindowPredicateTest.java │ │ │ │ ├── FluxWindowTest.java │ │ │ │ ├── FluxWindowTimeoutTest.java │ │ │ │ ├── FluxWindowWhenTest.java │ │ │ │ ├── FluxWithLatestFromTest.java │ │ │ │ ├── FluxZipIterableTest.java │ │ │ │ ├── FluxZipTest.java │ │ │ │ ├── FuseableBestPracticesArchTest.java │ │ │ │ ├── HooksTest.java │ │ │ │ ├── InnerProducerTest.java │ │ │ │ ├── InternalManySinkTest.java │ │ │ │ ├── InternalOneSinkTest.java │ │ │ │ ├── LambdaMonoSubscriberTest.java │ │ │ │ ├── LambdaSubscriberTest.java │ │ │ │ ├── LiftFunctionTest.java │ │ │ │ ├── MonoAllTest.java │ │ │ │ ├── MonoAnyTest.java │ │ │ │ ├── MonoCacheInvalidateIfTest.java │ │ │ │ ├── MonoCacheInvalidateWhenTest.java │ │ │ │ ├── MonoCacheTimeTest.java │ │ │ │ ├── MonoCallableOnAssemblyTest.java │ │ │ │ ├── MonoCallableTest.java │ │ │ │ ├── MonoCancelOnTest.java │ │ │ │ ├── MonoCastTest.java │ │ │ │ ├── MonoCollectListTest.java │ │ │ │ ├── MonoCollectMapTest.java │ │ │ │ ├── MonoCollectTest.java │ │ │ │ ├── MonoCompletionStageTest.java │ │ │ │ ├── MonoContextWriteTest.java │ │ │ │ ├── MonoCountTest.java │ │ │ │ ├── MonoCreateTest.java │ │ │ │ ├── MonoCurrentContextTest.java │ │ │ │ ├── MonoDefaultIfEmptyTest.java │ │ │ │ ├── MonoDeferComposeTest.java │ │ │ │ ├── MonoDeferTest.java │ │ │ │ ├── MonoDelayElementTest.java │ │ │ │ ├── MonoDelaySubscriptionTest.java │ │ │ │ ├── MonoDelayTest.java │ │ │ │ ├── MonoDelayUntilTest.java │ │ │ │ ├── MonoDematerializeTest.java │ │ │ │ ├── MonoDetachTest.java │ │ │ │ ├── MonoDoFinallyTest.java │ │ │ │ ├── MonoDoFirstTest.java │ │ │ │ ├── MonoDoOnEachTest.java │ │ │ │ ├── MonoElapsedTest.java │ │ │ │ ├── MonoElementAtTest.java │ │ │ │ ├── MonoEmptyTest.java │ │ │ │ ├── MonoErrorSuppliedTest.java │ │ │ │ ├── MonoErrorTest.java │ │ │ │ ├── MonoExpandTest.java │ │ │ │ ├── MonoFilterTest.java │ │ │ │ ├── MonoFilterWhenTest.java │ │ │ │ ├── MonoFirstWithSignalTest.java │ │ │ │ ├── MonoFirstWithValueTest.java │ │ │ │ ├── MonoFlatMapManyTest.java │ │ │ │ ├── MonoFlatMapTest.java │ │ │ │ ├── MonoFlattenIterableTest.java │ │ │ │ ├── MonoFromPublisherTest.java │ │ │ │ ├── MonoHandleTest.java │ │ │ │ ├── MonoHasElementsTest.java │ │ │ │ ├── MonoHideTest.java │ │ │ │ ├── MonoIgnoreElementTest.java │ │ │ │ ├── MonoIgnoreElementsTest.java │ │ │ │ ├── MonoIgnoreEmptyTest.java │ │ │ │ ├── MonoIgnorePublisherTest.java │ │ │ │ ├── MonoIgnoreThenTest.java │ │ │ │ ├── MonoInnerProducerBaseTest.java │ │ │ │ ├── MonoJustTest.java │ │ │ │ ├── MonoLogTest.java │ │ │ │ ├── MonoMapNotNullTest.java │ │ │ │ ├── MonoMapTest.java │ │ │ │ ├── MonoMaterializeTest.java │ │ │ │ ├── MonoNameFuseableTest.java │ │ │ │ ├── MonoNameTest.java │ │ │ │ ├── MonoNeverTest.java │ │ │ │ ├── MonoNextTest.java │ │ │ │ ├── MonoOnAssemblyTest.java │ │ │ │ ├── MonoOnErrorResumeTest.java │ │ │ │ ├── MonoPeekAfterTest.java │ │ │ │ ├── MonoPeekTerminalTest.java │ │ │ │ ├── MonoPeekTest.java │ │ │ │ ├── MonoPublishMulticastTest.java │ │ │ │ ├── MonoPublishOnTest.java │ │ │ │ ├── MonoReduceSeedTest.java │ │ │ │ ├── MonoReduceTest.java │ │ │ │ ├── MonoRepeatPredicateTest.java │ │ │ │ ├── MonoRepeatTest.java │ │ │ │ ├── MonoRepeatWhenEmptyTest.java │ │ │ │ ├── MonoRetryTest.java │ │ │ │ ├── MonoRetryWhenTest.java │ │ │ │ ├── MonoRunnableTest.java │ │ │ │ ├── MonoSequenceEqualTest.java │ │ │ │ ├── MonoSingleCallableTest.java │ │ │ │ ├── MonoSingleMonoTest.java │ │ │ │ ├── MonoSingleOptionalCallableTest.java │ │ │ │ ├── MonoSingleOptionalTest.java │ │ │ │ ├── MonoSingleTest.java │ │ │ │ ├── MonoSourceFluxTest.java │ │ │ │ ├── MonoSourceTest.java │ │ │ │ ├── MonoStreamCollectorTest.java │ │ │ │ ├── MonoSubscribeOnCallableTest.java │ │ │ │ ├── MonoSubscribeOnTest.java │ │ │ │ ├── MonoSubscribeOnValueTest.java │ │ │ │ ├── MonoSubscriberTest.java │ │ │ │ ├── MonoSupplierTest.java │ │ │ │ ├── MonoSwitchIfEmptyTest.java │ │ │ │ ├── MonoTakeLastOneTest.java │ │ │ │ ├── MonoTakeUntilOtherTest.java │ │ │ │ ├── MonoThenManyTest.java │ │ │ │ ├── MonoTimedTest.java │ │ │ │ ├── MonoTimeoutTest.java │ │ │ │ ├── MonoTimestampTest.java │ │ │ │ ├── MonoToCompletableFutureTest.java │ │ │ │ ├── MonoUsingTest.java │ │ │ │ ├── MonoUsingWhenTest.java │ │ │ │ ├── MonoWhenTest.java │ │ │ │ ├── MonoZipTest.java │ │ │ │ ├── NextProcessorTest.java │ │ │ │ ├── OnDiscardShouldNotLeakTest.java │ │ │ │ ├── OnNextFailureStrategyTest.java │ │ │ │ ├── OperatorDisposablesTest.java │ │ │ │ ├── OperatorsTest.java │ │ │ │ ├── ParallelArraySourceTest.java │ │ │ │ ├── ParallelCollectTest.java │ │ │ │ ├── ParallelConcatMapTest.java │ │ │ │ ├── ParallelDoOnEachTest.java │ │ │ │ ├── ParallelFilterTest.java │ │ │ │ ├── ParallelFlatMapTest.java │ │ │ │ ├── ParallelFluxHideTest.java │ │ │ │ ├── ParallelFluxNameTest.java │ │ │ │ ├── ParallelFluxOnAssemblyTest.java │ │ │ │ ├── ParallelFluxTest.java │ │ │ │ ├── ParallelGroupTest.java │ │ │ │ ├── ParallelLiftTest.java │ │ │ │ ├── ParallelLogTest.java │ │ │ │ ├── ParallelMapTest.java │ │ │ │ ├── ParallelMergeOrderedTest.java │ │ │ │ ├── ParallelMergeReduceTest.java │ │ │ │ ├── ParallelMergeSequentialTest.java │ │ │ │ ├── ParallelMergeSortTest.java │ │ │ │ ├── ParallelPeekTest.java │ │ │ │ ├── ParallelReduceSeedTest.java │ │ │ │ ├── ParallelRunOnTest.java │ │ │ │ ├── ParallelSourceTest.java │ │ │ │ ├── ParallelThenTest.java │ │ │ │ ├── QueueDrainSubscriberTest.java │ │ │ │ ├── SerializedSubscriberTest.java │ │ │ │ ├── SignalLoggerTests.java │ │ │ │ ├── SignalTest.java │ │ │ │ ├── SinkEmptyMulticastTest.java │ │ │ │ ├── SinkManyBestEffortTest.java │ │ │ │ ├── SinkManyEmitterProcessorTest.java │ │ │ │ ├── SinkManyReplayProcessorTest.java │ │ │ │ ├── SinkManySerializedTest.java │ │ │ │ ├── SinkManyUnicastNoBackpressureTest.java │ │ │ │ ├── SinkManyUnicastTest.java │ │ │ │ ├── SinkOneMulticastTest.java │ │ │ │ ├── SinksTest.java │ │ │ │ ├── StrictSubscriberTest.java │ │ │ │ ├── TailCallSubscribeTest.java │ │ │ │ ├── TracesTest.java │ │ │ │ ├── loop │ │ │ │ │ ├── FluxGroupByLoop.java │ │ │ │ │ └── FluxPublishOnLoop.java │ │ │ │ └── scenarios │ │ │ │ │ ├── AbstractReactorTest.java │ │ │ │ │ ├── FizzBuzzTests.java │ │ │ │ │ ├── FluxSpecTests.java │ │ │ │ │ ├── FluxTests.java │ │ │ │ │ ├── FluxWindowConsistencyTest.java │ │ │ │ │ ├── MonoTests.java │ │ │ │ │ ├── PopularTagTests.java │ │ │ │ │ └── ScatterGatherTests.java │ │ │ └── scheduler │ │ │ │ ├── AbstractSchedulerTest.java │ │ │ │ ├── BoundedElasticSchedulerTest.java │ │ │ │ ├── DelegateServiceSchedulerTest.java │ │ │ │ ├── ExecutorSchedulerTest.java │ │ │ │ ├── ExecutorSchedulerTrampolineTest.java │ │ │ │ ├── GenericBoundedElasticThreadPerTaskSchedulerTest.java │ │ │ │ ├── ImmediateSchedulerTest.java │ │ │ │ ├── InstantPeriodicWorkerTaskTest.java │ │ │ │ ├── ParallelSchedulerTest.java │ │ │ │ ├── RejectedExecutionTest.java │ │ │ │ ├── SchedulerWorkersHooksTest.java │ │ │ │ ├── SchedulersHooksTest.java │ │ │ │ ├── SchedulersTest.java │ │ │ │ ├── SingleSchedulerTest.java │ │ │ │ ├── SingleWorkerAroundTimerSchedulerTest.java │ │ │ │ ├── SingleWorkerSchedulerTest.java │ │ │ │ └── WorkerTaskTest.java │ │ │ ├── guide │ │ │ ├── FakeRepository.java │ │ │ ├── FakeUtils1.java │ │ │ ├── FakeUtils2.java │ │ │ ├── GuideDebuggingExtraTests.java │ │ │ └── GuideTests.java │ │ │ ├── test │ │ │ ├── AssertionsUtils.java │ │ │ ├── AutoDisposingExtension.java │ │ │ ├── FakeDisposable.java │ │ │ ├── MemoryUtils.java │ │ │ ├── MockUtils.java │ │ │ ├── ParameterizedTestWithName.java │ │ │ ├── TestBestPracticesArchTest.java │ │ │ ├── publisher │ │ │ │ ├── BaseOperatorTest.java │ │ │ │ ├── FluxEmptySyncFuseable.java │ │ │ │ ├── FluxFuseableExceptionOnPoll.java │ │ │ │ ├── FluxOperatorTest.java │ │ │ │ ├── MonoOperatorTest.java │ │ │ │ ├── OperatorScenario.java │ │ │ │ ├── ParallelOperatorTest.java │ │ │ │ └── ReduceOperatorTest.java │ │ │ └── subscriber │ │ │ │ └── AssertSubscriber.java │ │ │ └── util │ │ │ ├── ConsoleLoggerTest.java │ │ │ ├── JdkLoggerTest.java │ │ │ ├── LoggerTest.java │ │ │ ├── LoggersTest.java │ │ │ ├── MetricsNoMicrometerTest.java │ │ │ ├── concurrent │ │ │ ├── MpscLinkedQueueTest.java │ │ │ ├── QueuesOneQueueTest.java │ │ │ ├── QueuesTest.java │ │ │ └── SpscArrayQueueTest.java │ │ │ ├── context │ │ │ ├── Context0Test.java │ │ │ ├── Context1Test.java │ │ │ ├── Context2Test.java │ │ │ ├── Context3Test.java │ │ │ ├── Context4Test.java │ │ │ ├── Context5Test.java │ │ │ ├── ContextNTest.java │ │ │ ├── ContextTest.java │ │ │ ├── ContextViewTest.java │ │ │ └── CoreContextTest.java │ │ │ ├── function │ │ │ ├── Tuple2Test.java │ │ │ ├── Tuple3Test.java │ │ │ ├── Tuple4Test.java │ │ │ ├── Tuple5Test.java │ │ │ ├── Tuple6Test.java │ │ │ ├── Tuple7Test.java │ │ │ ├── Tuple8Test.java │ │ │ └── TupleTests.java │ │ │ ├── repeat │ │ │ └── RepeatSpecTest.java │ │ │ └── retry │ │ │ ├── RetryBackoffSpecTest.java │ │ │ └── RetrySpecTest.java │ ├── java21 │ │ └── reactor │ │ │ └── core │ │ │ └── scheduler │ │ │ └── BoundedElasticThreadPerTaskSchedulerTest.java │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ ├── org.junit.platform.launcher.LauncherSessionListener │ │ │ └── org.junit.platform.launcher.TestExecutionListener │ │ └── logback.xml │ ├── withContextPropagation102Test │ └── java │ │ └── reactor │ │ └── core │ │ └── publisher │ │ └── ContextPropagationTest.java │ └── withMicrometerTest │ └── java │ ├── io │ └── micrometer │ │ └── scopedvalue │ │ ├── Scope.java │ │ ├── ScopeHolder.java │ │ ├── ScopedValue.java │ │ └── ScopedValueThreadLocalAccessor.java │ └── reactor │ ├── core │ ├── publisher │ │ ├── AutomaticContextPropagationTest.java │ │ ├── ContextPropagationTest.java │ │ ├── ContextPropagationWithScopesTest.java │ │ ├── FluxContextWriteRestoringThreadLocalsTest.java │ │ ├── FluxMetricsFuseableTest.java │ │ ├── FluxMetricsTest.java │ │ ├── FluxRetryWhenTest.java │ │ ├── FluxTapTest.java │ │ ├── MonoContextWriteRestoringThreadLocalsTest.java │ │ ├── MonoMetricsFuseableTest.java │ │ ├── MonoMetricsTest.java │ │ ├── ThreadSwitchingConnectableFlux.java │ │ ├── ThreadSwitchingFlux.java │ │ ├── ThreadSwitchingMono.java │ │ └── ThreadSwitchingParallelFlux.java │ └── scheduler │ │ └── SchedulersMetricsTest.java │ └── util │ ├── MetricsTest.java │ └── context │ └── ReactorContextAccessorTest.java ├── reactor-test ├── build.gradle └── src │ ├── main │ └── java │ │ └── reactor │ │ └── test │ │ ├── DefaultStepVerifierBuilder.java │ │ ├── MessageFormatter.java │ │ ├── StepVerifier.java │ │ ├── StepVerifierOptions.java │ │ ├── ValueFormatters.java │ │ ├── package-info.java │ │ ├── publisher │ │ ├── ColdTestPublisher.java │ │ ├── DefaultTestPublisher.java │ │ ├── PublisherProbe.java │ │ ├── TestPublisher.java │ │ └── package-info.java │ │ ├── scheduler │ │ ├── VirtualTimeScheduler.java │ │ └── package-info.java │ │ ├── subscriber │ │ ├── ConditionalTestSubscriber.java │ │ ├── DefaultConditionalTestSubscriber.java │ │ ├── DefaultTestSubscriber.java │ │ ├── TestSubscriber.java │ │ ├── TestSubscriberBuilder.java │ │ └── package-info.java │ │ └── util │ │ ├── LoggerUtils.java │ │ ├── RaceTestUtils.java │ │ └── TestLogger.java │ └── test │ ├── java │ └── reactor │ │ └── test │ │ ├── DefaultContextExpectationsTest.java │ │ ├── DefaultStepVerifierBuilderTests.java │ │ ├── MessageFormatterTest.java │ │ ├── StepVerifierAssertionsTests.java │ │ ├── StepVerifierDefaultTimeoutTests.java │ │ ├── StepVerifierOptionsTest.java │ │ ├── StepVerifierTests.java │ │ ├── StepVerifierTimeoutTests.java │ │ ├── ValueFormattersTest.java │ │ ├── publisher │ │ ├── ColdTestPublisherTests.java │ │ ├── DefaultTestPublisherTests.java │ │ └── PublisherProbeTest.java │ │ ├── scheduler │ │ └── VirtualTimeSchedulerTests.java │ │ ├── subscriber │ │ ├── DefaultConditionalTestSubscriberTest.java │ │ ├── DefaultTestSubscriberTest.java │ │ └── TestSubscriberBuilderTest.java │ │ └── util │ │ ├── LoggerUtilsTest.java │ │ └── TestLoggerTest.java │ └── resources │ └── logback.xml ├── reactor-tools ├── build.gradle └── src │ ├── buildPluginTest │ ├── java │ │ └── reactor │ │ │ └── tools │ │ │ └── agent │ │ │ └── ApplyingByteBuddyPluginGradleTest.java │ └── resources │ │ └── mock-gradle │ │ ├── build.gradle │ │ ├── settings.gradle │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── demo │ │ │ └── SomeClass.java │ │ └── test │ │ └── java │ │ └── demo │ │ └── SomeClassTest.java │ ├── jarFileTest │ └── java │ │ └── reactor │ │ └── tools │ │ ├── AbstractJarFileTest.java │ │ └── JarFileShadingTest.java │ ├── javaAgentTest │ └── java │ │ └── reactor │ │ └── tools │ │ └── agent │ │ └── ReactorDebugJavaAgentTest.java │ ├── main │ └── java │ │ └── reactor │ │ └── tools │ │ └── agent │ │ ├── CallSiteInfoAddingMethodVisitor.java │ │ ├── ReactorDebugAgent.java │ │ ├── ReactorDebugByteBuddyPlugin.java │ │ ├── ReactorDebugClassVisitor.java │ │ └── ReturnHandlingMethodVisitor.java │ └── test │ └── java │ └── reactor │ └── tools │ └── agent │ └── ReactorDebugAgentTest.java └── settings.gradle /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Each line is a file pattern followed by one or more owners. 2 | # 3 | # These owners will be the default reviewers for everything in 4 | # the repo. 5 | # 6 | # See https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners 7 | 8 | * @reactor/core-team 9 | 10 | #/reactor-tools/* @xxx 11 | -------------------------------------------------------------------------------- /.github/dco.yml: -------------------------------------------------------------------------------- 1 | require: 2 | members: false 3 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | <!-- 2 | Thanks for contributing to Project Reactor. Please review the following notes 3 | about formatting your PR description. 4 | --> 5 | 6 | <!-- What changes from the user's perspective? --> 7 | 8 | 9 | <!-- Next paragraph contains more technical details --> 10 | 11 | 12 | <!-- The footer can contain the issue references: --> 13 | <!-- See #{OPTIONAL_REF}. --> 14 | <!-- Fixes #{ISSUE}. --> 15 | 16 | <!-- 17 | The PR description will be used to craft a final squash merge commit 18 | and the title will be used in release notes, so please keep them up-to-date. 19 | More detailed description of the commit message convention: 20 | https://github.com/reactor/.github/blob/main/CONTRIBUTING.md#black_nib-commit-message-convention 21 | https://github.com/reactor/.github/blob/main/CONTRIBUTING.md#message-convention 22 | --> 23 | -------------------------------------------------------------------------------- /.github/release.yml: -------------------------------------------------------------------------------- 1 | changelog: 2 | exclude: 3 | labels: 4 | - ignore-changelog 5 | - type/test 6 | - type/test/flaky 7 | - type/chores 8 | - type/dependency-upgrade 9 | categories: 10 | - title: ":warning: Update considerations and deprecations" 11 | labels: 12 | - "warn/api-change" 13 | - "warn/behavior-change" 14 | - "warn/blocker" 15 | - "warn/deprecation" 16 | - "warn/regression" 17 | - title: ":sparkles: New features and improvements" 18 | labels: 19 | - "type/enhancement" 20 | - title: ":lady_beetle: Bug fixes" 21 | labels: 22 | - "type/bug" 23 | - title: ":book: Documentation" 24 | labels: 25 | - "type/documentation" 26 | - title: ":question: Other Changes" 27 | labels: 28 | - "*" 29 | -------------------------------------------------------------------------------- /.github/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | ########################################################### 5 | # JAVA 6 | ########################################################### 7 | 8 | mkdir -p /opt/openjdk 9 | pushd /opt/openjdk > /dev/null 10 | JDK_URL="https://github.com/AdoptOpenJDK/openjdk9-binaries/releases/download/jdk-9.0.4%2B11/OpenJDK9U-jdk_x64_linux_hotspot_9.0.4_11.tar.gz" 11 | mkdir java9 12 | pushd java9 > /dev/null 13 | curl -L ${JDK_URL} --output OpenJDK9U-jdk_x64_linux_hotspot_9.0.4_11.tar.gz -------------------------------------------------------------------------------- /.github/workflows/full.yml: -------------------------------------------------------------------------------- 1 | name: Full Check 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: "0 14 * * 0" 7 | permissions: {} 8 | jobs: 9 | run-tests: 10 | runs-on: ubuntu-22.04 11 | strategy: 12 | fail-fast: false 13 | matrix: 14 | branch: [ 3.7.x, main ] 15 | test-type: 16 | - type: core 17 | arguments: ":reactor-core:test --no-daemon" 18 | - type: other # includes java21Test and java9Test for 3.6+/ java11Test for 3.7+ 19 | arguments: "check -x :reactor-core:test -x spotlessCheck -x :reactor-core:jcstress --no-daemon" 20 | - type: jcstress 21 | arguments: ":reactor-core:jcstress -Pjcstress.mode=quick --no-daemon" 22 | name: Test on ${{ matrix.branch }} - ${{ matrix.test-type.type }} tests 23 | steps: 24 | - name: Checkout Repository 25 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4 26 | with: 27 | ref: ${{ matrix.branch }} 28 | - name: Setup Java 8 29 | uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # tag=v3 30 | with: 31 | distribution: 'temurin' 32 | java-version: 8 33 | - name: Setup Java 11 34 | if: contains('main 3.7.x', matrix.branch) 35 | uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # tag=v3 36 | with: 37 | distribution: 'temurin' 38 | java-version: 11 39 | - name: Setup Java 21 40 | if: contains('main 3.7.x', matrix.branch) 41 | uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # tag=v3 42 | with: 43 | distribution: 'temurin' 44 | java-version: 21 45 | - name: Setup Gradle 46 | uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 47 | - name: Run Gradle Tests 48 | run: ./gradlew ${{ matrix.test-type.arguments }} 49 | -------------------------------------------------------------------------------- /.github/workflows/gradle-wrapper-validation.yml: -------------------------------------------------------------------------------- 1 | name: "Gradle Wrapper" 2 | on: [push, pull_request] 3 | permissions: {} 4 | jobs: 5 | validation: 6 | name: "validation" 7 | runs-on: ubuntu-22.04 8 | steps: 9 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4 10 | - uses: gradle/actions/wrapper-validation@ac638b010cf58a27ee6c972d7336334ccaf61c96 11 | -------------------------------------------------------------------------------- /.github/workflows/snapshots.yml: -------------------------------------------------------------------------------- 1 | name: Snapshots Check 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: "0 20 * * *" 7 | permissions: {} 8 | jobs: 9 | run-tests: 10 | runs-on: ubuntu-22.04 11 | strategy: 12 | fail-fast: false 13 | matrix: 14 | branch: [ 3.7.x, main ] 15 | test-type: 16 | - type: core 17 | arguments: ":reactor-core:test --no-daemon -DuseSnapshotMicrometerVersion=true" 18 | - type: other # includes java21Test and java9Test for 3.6+ / java11Test for 3.7+ 19 | arguments: "check -x :reactor-core:test -x spotlessCheck -x :reactor-core:jcstress -DuseSnapshotMicrometerVersion=true --no-daemon" 20 | name: Test on ${{ matrix.branch }} - ${{ matrix.test-type.type }} tests 21 | steps: 22 | - name: Checkout Repository 23 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4 24 | with: 25 | ref: ${{ matrix.branch }} 26 | - name: Setup Java 8 27 | uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # tag=v3 28 | with: 29 | distribution: 'temurin' 30 | java-version: 8 31 | - name: Setup Java 11 32 | if: contains('main 3.7.x', matrix.branch) 33 | uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # tag=v3 34 | with: 35 | distribution: 'temurin' 36 | java-version: 11 37 | - name: Setup Java 21 38 | if: contains('main 3.7.x', matrix.branch) 39 | uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # tag=v3 40 | with: 41 | distribution: 'temurin' 42 | java-version: 21 43 | - name: Setup Gradle 44 | uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 45 | - name: Run Gradle Tests 46 | run: ./gradlew ${{ matrix.test-type.arguments }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #jenv local configuration 2 | .java-version 3 | 4 | .gradletasknamecache 5 | .DS_Store 6 | benchmarks.jar 7 | bin 8 | build 9 | .classpath 10 | .eclipse 11 | .gradle 12 | .project 13 | .settings 14 | out 15 | *.log 16 | *.iml 17 | *.iws 18 | *.ipr 19 | .idea/ 20 | *.java.hsp 21 | *.index 22 | *.data 23 | classes 24 | exportToHtml 25 | .pmd 26 | .ruleset 27 | .rulesets 28 | -------------------------------------------------------------------------------- /.sdkmanrc: -------------------------------------------------------------------------------- 1 | # Enable auto-env through the sdkman_auto_env config 2 | # Add key=value pairs of SDKs to use below 3 | java=8.0.372-librca 4 | -------------------------------------------------------------------------------- /benchmarks/README.md: -------------------------------------------------------------------------------- 1 | ## Usage of JMH tasks 2 | 3 | Only execute specific benchmark(s) (wildcards are added before and after): 4 | ``` 5 | ../gradlew jmh --include="(BenchmarkPrimary|OtherBench)" 6 | ``` 7 | If you want to specify the wildcards yourself, you can pass the full regexp: 8 | ``` 9 | ../gradlew jmh --fullInclude=.*MyBenchmark.* 10 | ``` 11 | 12 | Specify extra profilers: 13 | ``` 14 | ../gradlew jmh --profilers="gc,stack" 15 | ``` 16 | 17 | Prominent profilers (for full list call `jmhProfilers` task): 18 | - comp - JitCompilations, tune your iterations 19 | - stack - which methods used most time 20 | - gc - print garbage collection stats 21 | - hs_thr - thread usage 22 | 23 | Change report format from JSON to one of [CSV, JSON, NONE, SCSV, TEXT]: 24 | ``` 25 | ./gradlew jmh --format=csv 26 | ``` 27 | 28 | Specify JVM arguments: 29 | ``` 30 | ../gradlew jmh --jvmArgs="-Dtest.cluster=local" 31 | ``` 32 | 33 | Run in verification mode (execute benchmarks with minimum of fork/warmup-/benchmark-iterations): 34 | ``` 35 | ../gradlew jmh --verify=true 36 | ``` 37 | 38 | ## Comparing with the baseline 39 | If you wish you run two sets of benchmarks, one for the current change and another one for the "baseline", 40 | there is an additional task `jmhBaseline` that will use the latest release: 41 | ``` 42 | ../gradlew jmh jmhBaseline --include=MyBenchmark 43 | ``` 44 | 45 | ## Resources 46 | - http://tutorials.jenkov.com/java-performance/jmh.html (Introduction) 47 | - https://github.com/openjdk/jmh/tree/master/jmh-samples/src/main/java/org/openjdk/jmh/samples (Samples) 48 | -------------------------------------------------------------------------------- /benchmarks/build.gradle: -------------------------------------------------------------------------------- 1 | import io.reactor.gradle.JmhExecTask 2 | 3 | apply plugin: 'java' 4 | apply plugin: 'idea' 5 | 6 | configurations { 7 | current 8 | baseline { 9 | resolutionStrategy.cacheChangingModulesFor 0, 'seconds' 10 | } 11 | } 12 | 13 | dependencies { 14 | // Use the baseline to avoid using new APIs in the benchmarks 15 | compileOnly libs.reactor.perfBaseline.core 16 | compileOnly libs.reactor.perfBaseline.coreMicrometer 17 | compileOnly libs.jsr305 18 | 19 | implementation libs.jmh.core 20 | implementation libs.reactor.perfBaseline.extra, { 21 | exclude group: 'io.projectreactor', module: 'reactor-core' 22 | } 23 | implementation platform(libs.micrometer.bom) 24 | annotationProcessor libs.jmh.generatorAnnprocess 25 | 26 | current project(':reactor-core') 27 | current project(':reactor-core-micrometer') 28 | baseline libs.reactor.perfBaseline.core, { 29 | changing = true 30 | } 31 | baseline libs.reactor.perfBaseline.coreMicrometer, { 32 | changing = true 33 | } 34 | } 35 | 36 | task jmhProfilers(type: JavaExec, description:'Lists the available profilers for the jmh task', group: 'Development') { 37 | classpath = sourceSets.main.runtimeClasspath 38 | mainClass.set('org.openjdk.jmh.Main') 39 | args '-lprof' 40 | } 41 | 42 | task jmh(type: JmhExecTask, description: 'Executing JMH benchmarks') { 43 | classpath = sourceSets.main.runtimeClasspath + configurations.current 44 | } 45 | 46 | task jmhBaseline(type: JmhExecTask, description: 'Executing JMH baseline benchmarks') { 47 | classpath = sourceSets.main.runtimeClasspath + configurations.baseline 48 | } 49 | -------------------------------------------------------------------------------- /benchmarks/src/main/resources/ospd.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactor/reactor-core/fce7664a4e8191c87b9215aedc6ca9f174fc477c/benchmarks/src/main/resources/ospd.txt.gz -------------------------------------------------------------------------------- /benchmarks/src/main/resources/words.shakespeare.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactor/reactor-core/fce7664a4e8191c87b9215aedc6ca9f174fc477c/benchmarks/src/main/resources/words.shakespeare.txt.gz -------------------------------------------------------------------------------- /buildSrc/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | plugins { 18 | id 'java-gradle-plugin' 19 | } 20 | 21 | repositories { 22 | mavenCentral() 23 | gradlePluginPortal() 24 | } 25 | 26 | dependencies { 27 | testImplementation libs.assertJ 28 | testImplementation platform(libs.junit.bom) 29 | testImplementation libs.junit.jupiterApi 30 | testRuntimeOnly libs.junit.jupiterEngine 31 | } 32 | 33 | test { 34 | useJUnitPlatform() 35 | testLogging { 36 | showStackTraces = true 37 | exceptionFormat = "FULL" 38 | } 39 | } 40 | 41 | gradlePlugin { 42 | plugins { 43 | detectCIPlugin { 44 | id = "io.reactor.gradle.detect-ci" 45 | implementationClass = "io.reactor.gradle.DetectCiPlugin" 46 | } 47 | javaConventionsPlugin { 48 | id = "io.reactor.gradle.java-conventions" 49 | implementationClass = "io.reactor.gradle.JavaConventions" 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /buildSrc/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | //import the catalog from main project 18 | dependencyResolutionManagement { 19 | versionCatalogs { 20 | libs { 21 | from(files("../gradle/libs.versions.toml")) 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /codequality/eclipse/reactor.importorder: -------------------------------------------------------------------------------- 1 | #Organize Import Order 2 | #Mon Apr 18 17:00:34 BRT 2016 3 | 4=\# 4 | 3=reactor 5 | 2= 6 | 1=javax 7 | 0=java 8 | -------------------------------------------------------------------------------- /codequality/nohttp/allowlist.lines: -------------------------------------------------------------------------------- 1 | http://tutorials.jenkov.com/java-performance/jmh.html -------------------------------------------------------------------------------- /codequality/spotless/licenseSlashstarStyle.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) $YEAR VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | -------------------------------------------------------------------------------- /docs/antora-assembler.yml: -------------------------------------------------------------------------------- 1 | root_level: 0 2 | build: 3 | publish: false 4 | asciidoc: 5 | build: 6 | command: bundle exec asciidoctor-pdf -n -d book 7 | attributes: 8 | source-highlighter: rouge 9 | pdf-theme: ./pdf-theme.yml 10 | -------------------------------------------------------------------------------- /docs/antora-playbook.yml: -------------------------------------------------------------------------------- 1 | antora: 2 | extensions: 3 | - '@springio/antora-extensions/partial-build-extension' 4 | # atlas-extension must be before latest-version-extension so latest versions are applied to imported versions 5 | - '@antora/atlas-extension' 6 | - require: '@springio/antora-extensions/latest-version-extension' 7 | - require: '@springio/antora-extensions/inject-collector-cache-config-extension' 8 | - '@antora/collector-extension' 9 | - id: pdf-extension # pdf-extension is enabled from antora-docs.gradle 10 | require: '@antora/pdf-extension' 11 | enabled: false 12 | - require: '@springio/antora-extensions/root-component-extension' 13 | root_component_name: 'reactor' 14 | site: 15 | title: Reactor Core Reference Guide 16 | url: https://projectreactor.io/docs/core/release/reference 17 | content: 18 | sources: 19 | - url: ./.. 20 | branches: HEAD 21 | start_path: docs 22 | worktrees: true 23 | asciidoc: 24 | extensions: 25 | - '@asciidoctor/tabs' 26 | - '@springio/asciidoctor-extensions' 27 | attributes: 28 | page-stackoverflow-url: https://stackoverflow.com/tags/project-reactor 29 | page-pagination: '' 30 | hide-uri-scheme: '@' 31 | tabs-sync-option: '@' 32 | chomp: 'all' 33 | doctype: book 34 | icons: font 35 | toc2: true 36 | sectnums: true 37 | sectanchors: true 38 | source-highlighter: highlightjs 39 | highlightjsdir: modules/ROOT/assets/highlight 40 | highlightjs-theme: railscasts 41 | sourcemap: true 42 | urls: 43 | latest_version_segment: '' 44 | runtime: 45 | log: 46 | failure_level: warn 47 | format: pretty 48 | ui: 49 | bundle: 50 | url: https://github.com/reactor/antora-ui-projectreactor/releases/download/latest/ui-bundle.zip 51 | snapshot: true 52 | -------------------------------------------------------------------------------- /docs/antora.yml: -------------------------------------------------------------------------------- 1 | name: reactor 2 | version: true 3 | title: Reactor 3 Reference Guide 4 | start_page: aboutDoc.adoc 5 | nav: 6 | - modules/ROOT/nav.adoc 7 | ext: 8 | collector: 9 | run: 10 | command: gradlew -q -Dorg.gradle.jvmargs="-Xmx3g -XX:+HeapDumpOnOutOfMemoryError" :docs:generateAntoraResources 11 | local: true 12 | scan: 13 | dir: ./build/generated-antora-resources 14 | 15 | asciidoc: 16 | attributes: 17 | attribute-missing: 'warn' 18 | chomp: 'all' 19 | source-language: java 20 | reactor-github-repo: 'https://github.com/reactor/reactor-core/tree/main' 21 | javadoc: 'https://projectreactor.io/docs/core/{project-version}/api' 22 | author: 23 | - Stephane Maldini 24 | - Simon Baslé 25 | -------------------------------------------------------------------------------- /docs/api/overview.html: -------------------------------------------------------------------------------- 1 | <!DOCTYPE html> 2 | <html> 3 | <head> 4 | <title></title> 5 | </head> 6 | <body> 7 | This document is the API specification for the Reactor Core library. 8 | 9 | Routine use of Reactor will involve the composable <a href="https://www.reactive-streams.org" 10 | target="_blank">Reactive Streams</a> 11 | <a href="/docs/core/release/api/reactor/core/publisher/Flux.html" target="_blank">Flux</a> 12 | and <a href="/docs/core/release/api/reactor/core/publisher/Mono.html"target="_blank">Mono</a> 13 | located under <a href="/docs/core/release/api/reactor/core/publisher/package-summary.html" target="_blank">reactor.core.publisher</a>. 14 | <hr/> 15 | <div id="overviewBody"> 16 | <p> 17 | Reactor Core is a succinct and powerful foundational library for building reactive and efficient applications 18 | on the JVM. 19 | More detailed documentation is available on the <a href="https://projectreactor.io/docs/core/release/reference/" 20 | target="_blank">reference guide</a>. 21 | </p> 22 | </div> 23 | </body> 24 | </html> 25 | -------------------------------------------------------------------------------- /docs/modules/ROOT/assets/highlight/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006, Ivan Sagalaev 2 | All rights reserved. 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of highlight.js nor the names of its contributors 12 | may be used to endorse or promote products derived from this software 13 | without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY 16 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /docs/modules/ROOT/assets/highlight/styles/railscasts.min.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Railscasts-like style (c) Visoft, Inc. (Damien White) 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; 9 | overflow-x: auto; 10 | padding: 0.5em; 11 | background: #232323; 12 | color: #e6e1dc; 13 | } 14 | 15 | .hljs-comment, 16 | .hljs-quote { 17 | color: #bc9458; 18 | font-style: italic; 19 | } 20 | 21 | .hljs-keyword, 22 | .hljs-selector-tag { 23 | color: #c26230; 24 | } 25 | 26 | .hljs-string, 27 | .hljs-number, 28 | .hljs-regexp, 29 | .hljs-variable, 30 | .hljs-template-variable { 31 | color: #a5c261; 32 | } 33 | 34 | .hljs-subst { 35 | color: #519f50; 36 | } 37 | 38 | .hljs-tag, 39 | .hljs-name { 40 | color: #e8bf6a; 41 | } 42 | 43 | .hljs-type { 44 | color: #da4939; 45 | } 46 | 47 | 48 | .hljs-symbol, 49 | .hljs-bullet, 50 | .hljs-built_in, 51 | .hljs-builtin-name, 52 | .hljs-attr, 53 | .hljs-link { 54 | color: #6d9cbe; 55 | } 56 | 57 | .hljs-params { 58 | color: #d0d0ff; 59 | } 60 | 61 | .hljs-attribute { 62 | color: #cda869; 63 | } 64 | 65 | .hljs-meta { 66 | color: #9b859d; 67 | } 68 | 69 | .hljs-title, 70 | .hljs-section { 71 | color: #ffc66d; 72 | } 73 | 74 | .hljs-addition { 75 | background-color: #144212; 76 | color: #e6e1dc; 77 | display: inline-block; 78 | width: 100%; 79 | } 80 | 81 | .hljs-deletion { 82 | background-color: #600; 83 | color: #e6e1dc; 84 | display: inline-block; 85 | width: 100%; 86 | } 87 | 88 | .hljs-selector-class { 89 | color: #9b703f; 90 | } 91 | 92 | .hljs-selector-id { 93 | color: #8b98ab; 94 | } 95 | 96 | .hljs-emphasis { 97 | font-style: italic; 98 | } 99 | 100 | .hljs-strong { 101 | font-weight: bold; 102 | } 103 | 104 | .hljs-link { 105 | text-decoration: underline; 106 | } 107 | -------------------------------------------------------------------------------- /docs/modules/ROOT/assets/images/flux.svg: -------------------------------------------------------------------------------- 1 | ../../../../../reactor-core/src/main/java/reactor/core/publisher/doc-files/marbles/flux.svg -------------------------------------------------------------------------------- /docs/modules/ROOT/assets/images/gs-cold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactor/reactor-core/fce7664a4e8191c87b9215aedc6ca9f174fc477c/docs/modules/ROOT/assets/images/gs-cold.png -------------------------------------------------------------------------------- /docs/modules/ROOT/assets/images/gs-compose.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactor/reactor-core/fce7664a4e8191c87b9215aedc6ca9f174fc477c/docs/modules/ROOT/assets/images/gs-compose.png -------------------------------------------------------------------------------- /docs/modules/ROOT/assets/images/gs-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactor/reactor-core/fce7664a4e8191c87b9215aedc6ca9f174fc477c/docs/modules/ROOT/assets/images/gs-hot.png -------------------------------------------------------------------------------- /docs/modules/ROOT/assets/images/gs-operators.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactor/reactor-core/fce7664a4e8191c87b9215aedc6ca9f174fc477c/docs/modules/ROOT/assets/images/gs-operators.png -------------------------------------------------------------------------------- /docs/modules/ROOT/assets/images/gs-reftail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactor/reactor-core/fce7664a4e8191c87b9215aedc6ca9f174fc477c/docs/modules/ROOT/assets/images/gs-reftail.png -------------------------------------------------------------------------------- /docs/modules/ROOT/assets/images/gs-transform.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactor/reactor-core/fce7664a4e8191c87b9215aedc6ca9f174fc477c/docs/modules/ROOT/assets/images/gs-transform.png -------------------------------------------------------------------------------- /docs/modules/ROOT/assets/images/logo-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactor/reactor-core/fce7664a4e8191c87b9215aedc6ca9f174fc477c/docs/modules/ROOT/assets/images/logo-2x.png -------------------------------------------------------------------------------- /docs/modules/ROOT/assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactor/reactor-core/fce7664a4e8191c87b9215aedc6ca9f174fc477c/docs/modules/ROOT/assets/images/logo.png -------------------------------------------------------------------------------- /docs/modules/ROOT/assets/images/mono.svg: -------------------------------------------------------------------------------- 1 | ../../../../../reactor-core/src/main/java/reactor/core/publisher/doc-files/marbles/mono.svg -------------------------------------------------------------------------------- /docs/modules/ROOT/nav.adoc: -------------------------------------------------------------------------------- 1 | * xref:aboutDoc.adoc[] 2 | * xref:gettingStarted.adoc[] 3 | * xref:reactiveProgramming.adoc[] 4 | * xref:coreFeatures.adoc[] 5 | ** xref:coreFeatures/flux.adoc[] 6 | ** xref:coreFeatures/mono.adoc[] 7 | ** xref:coreFeatures/simple-ways-to-create-a-flux-or-mono-and-subscribe-to-it.adoc[] 8 | ** xref:coreFeatures/programmatically-creating-sequence.adoc[] 9 | ** xref:coreFeatures/schedulers.adoc[] 10 | ** xref:coreFeatures/error-handling.adoc[] 11 | ** xref:coreFeatures/sinks.adoc[] 12 | * xref:kotlin.adoc[] 13 | * xref:testing.adoc[] 14 | * xref:debugging.adoc[] 15 | * xref:metrics.adoc[] 16 | * xref:advancedFeatures.adoc[] 17 | ** xref:advancedFeatures/advanced-mutualizing-operator-usage.adoc[] 18 | ** xref:advancedFeatures/reactor-hotCold.adoc[] 19 | ** xref:advancedFeatures/advanced-broadcast-multiple-subscribers-connectableflux.adoc[] 20 | ** xref:advancedFeatures/advanced-three-sorts-batching.adoc[] 21 | ** xref:advancedFeatures/advanced-parallelizing-parralelflux.adoc[] 22 | ** xref:advancedFeatures/scheduler-factory.adoc[] 23 | ** xref:advancedFeatures/hooks.adoc[] 24 | ** xref:advancedFeatures/context.adoc[] 25 | ** xref:advanced-contextPropagation.adoc[] 26 | ** xref:advancedFeatures/cleanup.adoc[] 27 | ** xref:advancedFeatures/null-safety.adoc[] 28 | * Appendices 29 | ** xref:apdx-operatorChoice.adoc[Which operator do I need?] 30 | ** xref:apdx-howtoReadMarbles.adoc[How to read marble diagrams?] 31 | ** xref:faq.adoc[FAQ, Best Practices, and "How do I...?] 32 | ** xref:apdx-reactorExtra.adoc[Reactor-Extra] 33 | //TODO later add appendices about internals, writing operators, fusion 34 | //include::apdx-implem.adoc[levelOffset=1] 35 | //include::apdx-writingOperator.adoc[levelOffset=1] 36 | //include::apdx-optimizations.adoc[levelOffset=1] 37 | //TODO later add appendix about migrating from RxJava? 38 | //include::apdx-migrating.adoc[levelOffset=1] 39 | 40 | 41 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/advancedFeatures.adoc: -------------------------------------------------------------------------------- 1 | [[advanced]] 2 | = Advanced Features and Concepts 3 | 4 | This chapter covers advanced features and concepts of Reactor, including the following: 5 | 6 | * xref:advancedFeatures/advanced-mutualizing-operator-usage.adoc[Mutualizing Operator Usage] 7 | * xref:advancedFeatures/reactor-hotCold.adoc[Hot Versus Cold] 8 | * xref:advancedFeatures/advanced-broadcast-multiple-subscribers-connectableflux.adoc[Broadcasting to Multiple Subscribers with `ConnectableFlux`] 9 | * xref:advancedFeatures/advanced-three-sorts-batching.adoc[Three Sorts of Batching] 10 | * xref:advancedFeatures/advanced-parallelizing-parralelflux.adoc[Parallelizing Work with `ParallelFlux`] 11 | * xref:advancedFeatures/scheduler-factory.adoc[Replacing Default `Schedulers`] 12 | * xref:advancedFeatures/hooks.adoc[Using Global Hooks] 13 | * xref:advancedFeatures/context.adoc[Adding a Context to a Reactive Sequence] 14 | * xref:advanced-contextPropagation.adoc[Context-Propagation Support] 15 | * xref:advancedFeatures/null-safety.adoc[Null Safety] 16 | * xref:advancedFeatures/cleanup.adoc[Dealing with Objects that Need Cleanup] 17 | 18 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/apdx-implem.adoc: -------------------------------------------------------------------------------- 1 | [[how-is-reactor-implemented?]] 2 | = How is Reactor implemented? 3 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/apdx-migrating.adoc: -------------------------------------------------------------------------------- 1 | [[migrating-from-rxjava]] 2 | = Migrating from RxJava 3 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/apdx-optimizations.adoc: -------------------------------------------------------------------------------- 1 | [[automatic-optimizations]] 2 | = Automatic optimizations 3 | 4 | [[macrofusion]] 5 | == Macro-fusion 6 | 7 | [[microfusion]] 8 | == Micro-fusion 9 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/apdx-writingOperator.adoc: -------------------------------------------------------------------------------- 1 | [[a-primer-on-writing-an-operator]] 2 | = A Primer on Writing an Operator 3 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/coreFeatures.adoc: -------------------------------------------------------------------------------- 1 | [[core-features]] 2 | = Reactor Core Features 3 | 4 | The Reactor project main artifact is `reactor-core`, a reactive library that focuses on 5 | the Reactive Streams specification and targets Java 8. 6 | 7 | Reactor introduces composable reactive types that implement `Publisher` but also provide 8 | a rich vocabulary of operators: `Flux` and `Mono`. A `Flux` object 9 | represents a reactive sequence of 0..N items, while a `Mono` object represents a 10 | single-value-or-empty (0..1) result. 11 | 12 | This distinction carries a bit of semantic information into the type, indicating the 13 | rough cardinality of the asynchronous processing. For instance, an HTTP request produces 14 | only one response, so there is not much sense in doing a `count` operation. Expressing 15 | the result of such an HTTP call as a `Mono<HttpResponse>` thus makes more sense than 16 | expressing it as a `Flux<HttpResponse>`, as it offers only operators that are relevant to 17 | a context of zero items or one item. 18 | 19 | Operators that change the maximum cardinality of the processing also switch to the 20 | relevant type. For instance, the `count` operator exists in `Flux`, but it returns a 21 | `Mono<Long>`. 22 | 23 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/coreFeatures/flux.adoc: -------------------------------------------------------------------------------- 1 | [[flux]] 2 | = Flux, an Asynchronous Sequence of 0-N Items 3 | 4 | The following image shows how a `Flux` transforms items: 5 | 6 | image::flux.svg[Flux, role="invert-dark"] 7 | 8 | A `Flux<T>` is a standard `Publisher<T>` that represents an asynchronous sequence of 0 to N 9 | emitted items, optionally terminated by either a completion signal or an error. 10 | As in the Reactive Streams spec, these three types of signal translate to calls to a downstream 11 | Subscriber's `onNext`, `onComplete`, and `onError` methods. 12 | 13 | With this large scope of possible signals, `Flux` is the general-purpose reactive type. 14 | Note that all events, even terminating ones, are optional: no `onNext` event but an 15 | `onComplete` event represents an _empty_ finite sequence, but remove the `onComplete` and 16 | you have an _infinite_ empty sequence (not particularly useful, except for tests around cancellation). 17 | Similarly, infinite sequences are not necessarily empty. For example, `Flux.interval(Duration)` 18 | produces a `Flux<Long>` that is infinite and emits regular ticks from a clock. 19 | 20 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/coreFeatures/mono.adoc: -------------------------------------------------------------------------------- 1 | [[mono]] 2 | = Mono, an Asynchronous 0-1 Result 3 | 4 | The following image shows how a `Mono` transforms an item: 5 | 6 | image::mono.svg[Mono, role="invert-dark"] 7 | 8 | A `Mono<T>` is a specialized `Publisher<T>` that emits at most one item _via_ the 9 | `onNext` signal then terminates with an `onComplete` signal (successful `Mono`, 10 | with or without value), or only emits a single `onError` signal (failed `Mono`). 11 | 12 | 13 | Most `Mono` implementations are expected to immediately call `onComplete` on their 14 | `Subscriber` after having called `onNext`. `Mono.never()` is an outlier: it doesn't 15 | emit any signal, which is not technically forbidden although not terribly useful outside 16 | of tests. On the other hand, a combination of `onNext` and `onError` is explicitly forbidden. 17 | 18 | `Mono` offers only a subset of the operators that are available for a `Flux`, and 19 | some operators (notably those that combine the `Mono` with another `Publisher`) 20 | switch to a `Flux`. 21 | For example, `Mono#concatWith(Publisher)` returns a `Flux` while `Mono#then(Mono)` 22 | returns another `Mono`. 23 | 24 | Note that you can use a `Mono` to represent no-value asynchronous processes that only 25 | have the concept of completion (similar to a `Runnable`). To create one, you can use an empty 26 | `Mono<Void>`. 27 | 28 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/coreFeatures/programmatically-creating-sequence.adoc: -------------------------------------------------------------------------------- 1 | include::../producing.adoc[] 2 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/coreFeatures/sinks.adoc: -------------------------------------------------------------------------------- 1 | include::../processors.adoc[] 2 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/metrics-details.adoc: -------------------------------------------------------------------------------- 1 | == Meters and tags for Reactor-Core-Micrometer module 2 | 3 | [[micrometer-details-metrics]] 4 | === `Micrometer.metrics()` 5 | Below is the list of meters used by the metrics tap listener feature, as exposed via 6 | `Micrometer.metrics(MeterRegistry meterRegistry)`. 7 | 8 | IMPORTANT: Please note that metrics below use a dynamic `%s` prefix. 9 | When applied on a `Flux` or `Mono` that uses the `name(String n)` operator, this is replaced with `n`. 10 | Otherwise, this is replaced by the default value of `"reactor"`. 11 | 12 | include::partial$meterListener_metrics.adoc[leveloffset=3] 13 | 14 | [[micrometer-details-timedScheduler]] 15 | === `Micrometer.timedScheduler()` 16 | Below is the list of meters used by the TimedScheduler feature, as exposed via 17 | `Micrometer.timedScheduler(Scheduler original, MeterRegistry meterRegistry, String metricsPrefix)`. 18 | 19 | IMPORTANT: Please note that metrics below use a dynamic `%s` prefix. This is replaced with the provided `metricsPrefix` in practice. 20 | 21 | include::partial$timedScheduler_metrics.adoc[leveloffset=3] 22 | 23 | [[micrometer-details-observation]] 24 | === `Micrometer.observation()` 25 | Below is the list of meters used by the observation tap listener feature, as exposed via 26 | `Micrometer.observation(ObservationRegistry registry)`. 27 | 28 | This is the ANONYMOUS observation, but you can create a similar Observation with a custom name by using the `name(String)` operator. 29 | 30 | NOTE: You can also fully customize Micrometer's Observation via 31 | `Micrometer.observation(ObservationRegistry registry, Function<ObservationRegistry, Observation> observationSupplier)` 32 | with your own Observation supplier, allowing to configure its attributes (name, contextual name, low and high cardinality keys, ...). 33 | 34 | include::partial$observation_metrics.adoc[leveloffset=3] 35 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/snippetRetryWhenRetry.adoc: -------------------------------------------------------------------------------- 1 | [source,java] 2 | [%unbreakable] 3 | ---- 4 | 5 | AtomicInteger errorCount = new AtomicInteger(); 6 | Flux<String> flux = 7 | Flux.<String>error(new IllegalArgumentException()) 8 | .doOnError(e -> errorCount.incrementAndGet()) 9 | .retryWhen(Retry.from(companion -> // <1> 10 | companion.map(rs -> { // <2> 11 | if (rs.totalRetries() < 3) return rs.totalRetries(); // <3> 12 | else throw Exceptions.propagate(rs.failure()); // <4> 13 | }) 14 | )); 15 | ---- 16 | <1> We customize `Retry` by adapting from a `Function` lambda rather than providing a concrete class 17 | <2> The companion emits `RetrySignal` objects, which bear number of retries so far and last failure 18 | <3> To allow for three retries, we consider indexes < 3 and return a value to emit (here we simply return the index). 19 | <4> In order to terminate the sequence in error, we throw the original exception after 20 | these three retries. 21 | -------------------------------------------------------------------------------- /docs/pdf-theme.yml: -------------------------------------------------------------------------------- 1 | extends: default 2 | role: 3 | red: 4 | font-color: #FF0000 5 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | version=3.8.0-M5 2 | bomVersion=2025.0.0-M5 3 | metricsMicrometerVersion=1.3.0-M5 4 | 5 | org.gradle.parallel=true 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactor/reactor-core/fce7664a4e8191c87b9215aedc6ca9f174fc477c/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /reactor-core-micrometer/src/main/java/reactor/core/observability/micrometer/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Support of Micrometer 1.10+ instrumentation on reactor-core classes. 19 | */ 20 | @NonNullApi 21 | package reactor.core.observability.micrometer; 22 | 23 | import reactor.util.annotation.NonNullApi; -------------------------------------------------------------------------------- /reactor-core-micrometer/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | <!-- 2 | ~ Copyright (c) 2011-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ https://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" BASIS, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | 17 | <configuration> 18 | 19 | <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"> 20 | <encoder> 21 | <pattern> 22 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 23 | </pattern> 24 | </encoder> 25 | </appender> 26 | <logger name="reactor" level="info"/> 27 | 28 | <root level="info"> 29 | <appender-ref ref="stdout"/> 30 | </root> 31 | 32 | </configuration> -------------------------------------------------------------------------------- /reactor-core/src/blockHoundTest/java/reactor/core/scheduler/ReactorBlockHoundIntegrationSPITest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.scheduler; 18 | 19 | import java.util.ServiceLoader; 20 | 21 | import org.junit.jupiter.api.Test; 22 | import reactor.blockhound.integration.BlockHoundIntegration; 23 | 24 | import static org.assertj.core.api.Assertions.assertThat; 25 | 26 | public class ReactorBlockHoundIntegrationSPITest { 27 | 28 | @Test 29 | public void shouldSupportServiceLoader() { 30 | assertThat(ServiceLoader.load(BlockHoundIntegration.class)) 31 | .hasAtLeastOneElementOfType(ReactorBlockHoundIntegration.class); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /reactor-core/src/blockHoundTest/java/reactor/core/scheduler/ReactorTestBlockHoundIntegration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.scheduler; 18 | 19 | import reactor.blockhound.BlockHound; 20 | import reactor.blockhound.integration.BlockHoundIntegration; 21 | import reactor.test.util.RaceTestUtils; 22 | 23 | public final class ReactorTestBlockHoundIntegration implements BlockHoundIntegration { 24 | 25 | @Override 26 | public void applyTo(BlockHound.Builder builder) { 27 | builder.allowBlockingCallsInside(RaceTestUtils.class.getName(), "lambda$race$2"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /reactor-core/src/blockHoundTest/resources/META-INF/services/reactor.blockhound.integration.BlockHoundIntegration: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2024 VMware Inc. or its affiliates, All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | reactor.core.scheduler.ReactorTestBlockHoundIntegration -------------------------------------------------------------------------------- /reactor-core/src/jcstress/java/reactor/core/publisher/InnerStressSubscriber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | public class InnerStressSubscriber<T> extends StressSubscriber<T> { 20 | 21 | final StressSubscriber<?> parent; 22 | 23 | InnerStressSubscriber(StressSubscriber<?> parent) { 24 | this.parent = parent; 25 | } 26 | 27 | @Override 28 | public void onComplete() { 29 | super.onComplete(); 30 | this.parent.subscription.request(1); 31 | } 32 | 33 | @Override 34 | public void cancel() { 35 | super.cancel(); 36 | } 37 | } -------------------------------------------------------------------------------- /reactor-core/src/jcstress/java/reactor/core/publisher/StressSubscription.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2025 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import java.util.concurrent.atomic.AtomicBoolean; 20 | import java.util.concurrent.atomic.AtomicInteger; 21 | import java.util.concurrent.atomic.AtomicLongFieldUpdater; 22 | 23 | import org.reactivestreams.Subscription; 24 | import reactor.core.CoreSubscriber; 25 | 26 | public class StressSubscription<T> implements Subscription { 27 | 28 | final CoreSubscriber<? super T> actual; 29 | 30 | volatile long requested; 31 | 32 | @SuppressWarnings("rawtypes") 33 | static final AtomicLongFieldUpdater<StressSubscription> REQUESTED = 34 | AtomicLongFieldUpdater.newUpdater(StressSubscription.class, "requested"); 35 | 36 | public final AtomicInteger requestsCount = new AtomicInteger(); 37 | public final AtomicBoolean cancelled = new AtomicBoolean(); 38 | 39 | public StressSubscription(CoreSubscriber<? super T> actual) { 40 | this.actual = actual; 41 | } 42 | 43 | @Override 44 | public void request(long n) { 45 | requestsCount.incrementAndGet(); 46 | Operators.addCap(REQUESTED, this, n); 47 | } 48 | 49 | @Override 50 | public void cancel() { 51 | cancelled.set(true); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /reactor-core/src/jcstress/resources/logback.xml: -------------------------------------------------------------------------------- 1 | <!-- 2 | ~ Copyright (c) 2011-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ https://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" BASIS, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | 17 | <configuration> 18 | 19 | <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"> 20 | <encoder> 21 | <pattern> 22 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 23 | </pattern> 24 | </encoder> 25 | </appender> 26 | 27 | <!--<logger name="reactor.core.publisher.tck" level="debug"/>--> 28 | <logger name="reactor" level="info"/> 29 | <logger name="wqp" level="off"/> 30 | <logger name="after-flatmap" level="debug"/> 31 | <logger name="logError.default" level="trace"/> 32 | <logger name="logError.fine" level="trace"/> 33 | <logger name="logError.finest" level="trace"/> 34 | 35 | <root level="info"> 36 | <appender-ref ref="stdout"/> 37 | </root> 38 | 39 | </configuration> -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/adapter/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Adapt 19 | * {@link org.reactivestreams.Publisher} to Java 9+ 20 | * {@link reactor.adapter.JdkFlowAdapter Flow.Publisher}. More adapter can be found 21 | * in reactor-adapter under https://github.com/reactor/reactor-addons/ including RxJava1 and 22 | * RxJava2. 23 | * 24 | * @author Stephane Maldini 25 | */ 26 | @NonNullApi 27 | package reactor.adapter; 28 | 29 | import reactor.util.annotation.NonNullApi; -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/CorePublisher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core; 18 | 19 | import java.util.function.Function; 20 | 21 | import org.reactivestreams.Publisher; 22 | import org.reactivestreams.Subscriber; 23 | import reactor.core.publisher.Hooks; 24 | import reactor.util.context.Context; 25 | 26 | /** 27 | * A {@link CoreSubscriber} aware publisher. 28 | * 29 | * 30 | * @param <T> the {@link CoreSubscriber} data type 31 | * 32 | * @since 3.3.0 33 | */ 34 | public interface CorePublisher<T> extends Publisher<T> { 35 | 36 | /** 37 | * An internal {@link Publisher#subscribe(Subscriber)} that will bypass 38 | * {@link Hooks#onLastOperator(Function)} pointcut. 39 | * <p> 40 | * In addition to behave as expected by {@link Publisher#subscribe(Subscriber)} 41 | * in a controlled manner, it supports direct subscribe-time {@link Context} passing. 42 | * 43 | * @param subscriber the {@link Subscriber} interested into the published sequence 44 | * @see Publisher#subscribe(Subscriber) 45 | */ 46 | void subscribe(CoreSubscriber<? super T> subscriber); 47 | 48 | } 49 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Core components of the framework supporting extensions to the Reactive Stream 19 | * programming model. 20 | * 21 | */ 22 | @NonNullApi 23 | package reactor.core; 24 | 25 | import reactor.util.annotation.NonNullApi; -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/BlockingFirstSubscriber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2023 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.util.context.Context; 20 | 21 | /** 22 | * Blocks until the upstream signals its first value or completes. 23 | * 24 | * @param <T> the value type 25 | * @see <a href="https://github.com/reactor/reactive-streams-commons">https://github.com/reactor/reactive-streams-commons</a> 26 | */ 27 | final class BlockingFirstSubscriber<T> extends BlockingSingleSubscriber<T> { 28 | 29 | public BlockingFirstSubscriber(Context context) { 30 | super(context); 31 | } 32 | 33 | @Override 34 | public void onNext(T t) { 35 | if (value == null) { 36 | value = t; 37 | dispose(); 38 | countDown(); 39 | } 40 | } 41 | 42 | @Override 43 | public void onError(Throwable t) { 44 | if (value == null) { 45 | error = t; 46 | } 47 | countDown(); 48 | } 49 | 50 | @Override 51 | public String stepName() { 52 | return "blockFirst"; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/BlockingLastSubscriber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2023 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.util.context.Context; 20 | 21 | /** 22 | * Blocks until the upstream signals its last value or completes. 23 | * 24 | * @param <T> the value type 25 | * @see <a href="https://github.com/reactor/reactive-streams-commons">https://github.com/reactor/reactive-streams-commons</a> 26 | */ 27 | final class BlockingLastSubscriber<T> extends BlockingSingleSubscriber<T> { 28 | 29 | public BlockingLastSubscriber(Context context) { 30 | super(context); 31 | } 32 | 33 | @Override 34 | public void onNext(T t) { 35 | value = t; 36 | } 37 | 38 | @Override 39 | public void onError(Throwable t) { 40 | value = null; 41 | error = t; 42 | countDown(); 43 | } 44 | 45 | @Override 46 | public String stepName() { 47 | return "blockLast"; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/BlockingMonoSubscriber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2023 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.util.context.Context; 20 | 21 | /** 22 | * Blocks assuming the upstream is a Mono, until it signals its value or completes. 23 | * Compared to {@link BlockingFirstSubscriber}, this variant doesn't cancel the upstream 24 | * in onNext. 25 | * 26 | * @param <T> the value type 27 | * @see <a href="https://github.com/reactor/reactive-streams-commons">https://github.com/reactor/reactive-streams-commons</a> 28 | */ 29 | final class BlockingMonoSubscriber<T> extends BlockingSingleSubscriber<T> { 30 | 31 | public BlockingMonoSubscriber(Context context) { 32 | super(context); 33 | } 34 | 35 | @Override 36 | public void onNext(T t) { 37 | if (value == null) { 38 | value = t; 39 | countDown(); 40 | } 41 | } 42 | 43 | @Override 44 | public void onError(Throwable t) { 45 | if (value == null) { 46 | error = t; 47 | } 48 | countDown(); 49 | } 50 | 51 | @Override 52 | public String stepName() { 53 | return "block"; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/BufferOverflowStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | /** 20 | * Strategies to deal with overflow of a buffer during 21 | * {@link Flux#onBackpressureBuffer(int, BufferOverflowStrategy) 22 | * backpressure buffering}. 23 | * 24 | * @author Simon Baslé 25 | */ 26 | public enum BufferOverflowStrategy { 27 | 28 | /** 29 | * Propagate an {@link IllegalStateException} when the buffer is full. 30 | */ 31 | ERROR, 32 | /** 33 | * Drop the new element without propagating an error when the buffer is full. 34 | */ 35 | DROP_LATEST, 36 | /** 37 | * When the buffer is full, remove the oldest element from it and offer the 38 | * new element at the end instead. Do not propagate an error. 39 | */ 40 | DROP_OLDEST 41 | 42 | } 43 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/ConnectableFluxRestoringThreadLocals.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import java.util.Objects; 20 | import java.util.function.Consumer; 21 | 22 | import reactor.core.CoreSubscriber; 23 | import reactor.core.Disposable; 24 | 25 | class ConnectableFluxRestoringThreadLocals<T> extends ConnectableFlux<T> { 26 | 27 | private final ConnectableFlux<T> source; 28 | 29 | public ConnectableFluxRestoringThreadLocals(ConnectableFlux<T> source) { 30 | this.source = Objects.requireNonNull(source, "source"); 31 | } 32 | 33 | @Override 34 | public void connect(Consumer<? super Disposable> cancelSupport) { 35 | source.connect(cancelSupport); 36 | } 37 | 38 | @Override 39 | public void subscribe(CoreSubscriber<? super T> actual) { 40 | source.subscribe(Operators.restoreContextOnSubscriber(source, actual)); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/ContextHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.util.context.Context; 20 | 21 | interface ContextHolder { 22 | 23 | /** 24 | * Request a {@link Context} from dependent components which can include downstream 25 | * operators during subscribing or a terminal {@link org.reactivestreams.Subscriber}. 26 | * 27 | * @return a resolved context 28 | */ 29 | Context currentContext(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/DirectInnerContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2022 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | /** 20 | * A package-private interface allowing to mutualize logic between {@link DirectProcessor} 21 | * and {@link SinkManyBestEffort}. 22 | * 23 | * @author Simon Baslé 24 | * @deprecated remove again once DirectProcessor is removed 25 | */ 26 | @Deprecated 27 | interface DirectInnerContainer<T> { 28 | 29 | /** 30 | * Add a new {@link SinkManyBestEffort.DirectInner} to this publisher. 31 | * 32 | * @param s the new {@link SinkManyBestEffort.DirectInner} to add 33 | * 34 | * @return {@code true} if the inner could be added, {@code false} if the publisher cannot accept new subscribers 35 | */ 36 | boolean add(SinkManyBestEffort.DirectInner<T> s); 37 | 38 | /** 39 | * Remove an {@link SinkManyBestEffort.DirectInner} from this publisher. Does nothing if the inner is not currently managed 40 | * by the publisher. 41 | * 42 | * @param s the {@link SinkManyBestEffort.DirectInner} to remove 43 | */ 44 | void remove(SinkManyBestEffort.DirectInner<T> s); 45 | } 46 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/FluxCallable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2023 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import java.util.concurrent.Callable; 20 | 21 | import reactor.core.CoreSubscriber; 22 | import reactor.core.Fuseable; 23 | import reactor.util.annotation.Nullable; 24 | 25 | /** 26 | * For each subscriber, a Supplier is invoked and the returned value emitted. 27 | * 28 | * @param <T> the value type; 29 | */ 30 | final class FluxCallable<T> extends Flux<T> implements Callable<T>, Fuseable, SourceProducer<T> { 31 | 32 | final Callable<T> callable; 33 | 34 | FluxCallable(Callable<T> callable) { 35 | this.callable = callable; 36 | } 37 | 38 | @Override 39 | public void subscribe(CoreSubscriber<? super T> actual) { 40 | actual.onSubscribe(new MonoCallable.MonoCallableSubscription<>(actual, callable)); 41 | } 42 | 43 | @Override 44 | @Nullable 45 | public T call() throws Exception { 46 | return callable.call(); 47 | } 48 | 49 | @Override 50 | public Object scanUnsafe(Attr key) { 51 | if (key == Attr.RUN_STYLE) return Attr.RunStyle.SYNC; 52 | return SourceProducer.super.scanUnsafe(key); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/FluxError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2023 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import java.util.Objects; 20 | 21 | import reactor.core.Exceptions; 22 | import reactor.core.Fuseable; 23 | 24 | import reactor.core.CoreSubscriber; 25 | 26 | /** 27 | * Emits a constant or generated Throwable instance to Subscribers. 28 | * 29 | * @param <T> the value type 30 | * 31 | * @see <a href="https://github.com/reactor/reactive-streams-commons">Reactive-Streams-Commons</a> 32 | */ 33 | final class FluxError<T> extends Flux<T> implements Fuseable.ScalarCallable, SourceProducer<T> { 34 | 35 | final Throwable error; 36 | 37 | FluxError(Throwable error) { 38 | this.error = Objects.requireNonNull(error); 39 | } 40 | 41 | @Override 42 | public void subscribe(CoreSubscriber<? super T> actual) { 43 | Operators.error(actual, error); 44 | } 45 | 46 | @Override 47 | public Object call() throws Exception { 48 | if(error instanceof Exception){ 49 | throw ((Exception)error); 50 | } 51 | throw Exceptions.propagate(error); 52 | } 53 | 54 | @Override 55 | public Object scanUnsafe(Attr key) { 56 | if (key == Attr.RUN_STYLE) return Attr.RunStyle.SYNC; 57 | return SourceProducer.super.scanUnsafe(key); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/FluxSourceMonoFuseable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.core.CoreSubscriber; 20 | import reactor.core.Fuseable; 21 | import reactor.core.Scannable; 22 | 23 | /** 24 | * @author Stephane Maldini 25 | */ 26 | final class FluxSourceMonoFuseable<I> extends FluxFromMonoOperator<I, I> implements Fuseable { 27 | 28 | FluxSourceMonoFuseable(Mono<? extends I> source) { 29 | super(source); 30 | } 31 | 32 | /** 33 | * Default is simply delegating and decorating with {@link Flux} API. Note this 34 | * assumes an identity between input and output types. 35 | * @param actual 36 | */ 37 | @Override 38 | public CoreSubscriber<? super I> subscribeOrReturn(CoreSubscriber<? super I> actual) { 39 | return actual; 40 | } 41 | 42 | 43 | @Override 44 | public String stepName() { 45 | if (source instanceof Scannable) { 46 | return "FluxFromMono(" + Scannable.from(source).stepName() + ")"; 47 | } 48 | return "FluxFromMono(" + source.toString() + ")"; 49 | } 50 | 51 | @Override 52 | public Object scanUnsafe(Attr key) { 53 | if (key == Attr.RUN_STYLE) return Scannable.from(source).scanUnsafe(key); 54 | return super.scanUnsafe(key); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/FluxTakeLastOne.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.core.CoreSubscriber; 20 | import reactor.core.Fuseable; 21 | 22 | /** 23 | * Emits the last N values the source emitted before its completion. 24 | * 25 | * @param <T> the value type 26 | * @see <a href="https://github.com/reactor/reactive-streams-commons">Reactive-Streams-Commons</a> 27 | */ 28 | final class FluxTakeLastOne<T> extends InternalFluxOperator<T, T> implements Fuseable { 29 | 30 | FluxTakeLastOne(Flux<? extends T> source) { 31 | super(source); 32 | } 33 | 34 | @Override 35 | public CoreSubscriber<? super T> subscribeOrReturn(CoreSubscriber<? super T> actual) { 36 | return new MonoTakeLastOne.TakeLastOneSubscriber<>(actual, null, false); 37 | } 38 | 39 | @Override 40 | public int getPrefetch() { 41 | return Integer.MAX_VALUE; 42 | } 43 | 44 | @Override 45 | public Object scanUnsafe(Attr key) { 46 | if (key == Attr.RUN_STYLE) return Attr.RunStyle.SYNC; 47 | return super.scanUnsafe(key); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/GroupedFlux.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | 20 | import reactor.util.annotation.NonNull; 21 | 22 | /** 23 | * Represents a sequence of events which has an associated key. 24 | * 25 | * @param <K> the key type 26 | * @param <V> the value type 27 | */ 28 | public abstract class GroupedFlux<K, V> extends Flux<V> { 29 | 30 | /** 31 | * Return the key of the {@link GroupedFlux}. 32 | * @return the key 33 | */ 34 | @NonNull 35 | public abstract K key(); 36 | } 37 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/InnerConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.core.CoreSubscriber; 20 | import reactor.core.Scannable; 21 | 22 | /** 23 | * 24 | * A {@link InnerConsumer} is a {@link Scannable} {@link CoreSubscriber}. 25 | * 26 | * @param <I> input operator produced type 27 | * 28 | * @author Stephane Maldini 29 | */ 30 | interface InnerConsumer<I> 31 | extends CoreSubscriber<I>, Scannable { 32 | 33 | } 34 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/InnerOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.util.context.Context; 20 | 21 | /** 22 | * 23 | * @param <I> input operator consumed type 24 | * @param <O> output operator produced type 25 | * 26 | * @author Stephane Maldini 27 | */ 28 | interface InnerOperator<I, O> 29 | extends InnerConsumer<I>, InnerProducer<O> { 30 | 31 | @Override 32 | default Context currentContext() { 33 | return actual().currentContext(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/InnerProducer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2023 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | 20 | import org.reactivestreams.Subscriber; 21 | import org.reactivestreams.Subscription; 22 | import reactor.core.CoreSubscriber; 23 | import reactor.core.Scannable; 24 | import reactor.util.annotation.Nullable; 25 | 26 | /** 27 | * 28 | * {@link InnerProducer} is a {@link reactor.core.Scannable} {@link Subscription} that produces 29 | * data to an {@link #actual()} {@link Subscriber} 30 | * 31 | * @param <O> output operator produced type 32 | * 33 | * @author Stephane Maldini 34 | */ 35 | interface InnerProducer<O> 36 | extends Scannable, Subscription { 37 | 38 | CoreSubscriber<? super O> actual(); 39 | 40 | @Override 41 | @Nullable 42 | default Object scanUnsafe(Attr key){ 43 | if (key == Attr.ACTUAL) { 44 | return actual(); 45 | } 46 | if (key == InternalProducerAttr.INSTANCE) return true; 47 | return null; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/InternalProducerAttr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.core.Scannable; 20 | 21 | class InternalProducerAttr extends Scannable.Attr<Boolean> { 22 | 23 | private InternalProducerAttr(Boolean defaultValue) { 24 | super(defaultValue); 25 | } 26 | 27 | static final InternalProducerAttr INSTANCE = new InternalProducerAttr(true); 28 | } 29 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/MonoBridges.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import java.util.function.Function; 20 | 21 | import org.reactivestreams.Publisher; 22 | 23 | /** 24 | * Utilities to avoid vararg array copying overhead when relaying vararg parameters 25 | * to underlying Java methods from their corresponding Kotlin functions. 26 | * <p> 27 | * When <a href="https://youtrack.jetbrains.com/issue/KT-17043">this</a> issue is 28 | * resolved, uses of these bridge methods can be removed. 29 | * 30 | * @author DoHyung Kim 31 | * @since 3.1 32 | */ 33 | final class MonoBridges { 34 | 35 | static <R> Mono<R> zip(Function<? super Object[], ? extends R> combinator, Mono<?>[] monos) { 36 | return Mono.zip(combinator, monos); 37 | } 38 | 39 | static Mono<Void> when(Publisher<?>[] sources) { 40 | return Mono.when(sources); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/MonoCancelOn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.core.CoreSubscriber; 20 | import reactor.core.scheduler.Scheduler; 21 | 22 | final class MonoCancelOn<T> extends InternalMonoOperator<T, T> { 23 | 24 | final Scheduler scheduler; 25 | 26 | MonoCancelOn(Mono<T> source, Scheduler scheduler) { 27 | super(source); 28 | this.scheduler = scheduler; 29 | } 30 | 31 | @Override 32 | public CoreSubscriber<? super T> subscribeOrReturn(CoreSubscriber<? super T> actual) { 33 | return new FluxCancelOn.CancelSubscriber<T>(actual, scheduler); 34 | } 35 | 36 | @Override 37 | public Object scanUnsafe(Attr key) { 38 | if (key == Attr.RUN_ON) return scheduler; 39 | if (key == Attr.RUN_STYLE) return Attr.RunStyle.ASYNC; 40 | 41 | return super.scanUnsafe(key); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/MonoContextWrite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import java.util.Objects; 20 | import java.util.function.Function; 21 | 22 | import reactor.core.CoreSubscriber; 23 | import reactor.core.Fuseable; 24 | import reactor.util.context.Context; 25 | 26 | final class MonoContextWrite<T> extends InternalMonoOperator<T, T> implements Fuseable { 27 | 28 | final Function<Context, Context> doOnContext; 29 | 30 | MonoContextWrite(Mono<? extends T> source, 31 | Function<Context, Context> doOnContext) { 32 | super(source); 33 | this.doOnContext = Objects.requireNonNull(doOnContext, "doOnContext"); 34 | } 35 | 36 | @Override 37 | public CoreSubscriber<? super T> subscribeOrReturn(CoreSubscriber<? super T> actual) { 38 | Context c = doOnContext.apply(actual.currentContext()); 39 | 40 | return new FluxContextWrite.ContextWriteSubscriber<>(actual, c); 41 | } 42 | 43 | @Override 44 | public Object scanUnsafe(Attr key) { 45 | if (key == Attr.RUN_STYLE) return Attr.RunStyle.SYNC; 46 | return super.scanUnsafe(key); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/MonoCurrentContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2023 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.core.CoreSubscriber; 20 | import reactor.core.Fuseable; 21 | import reactor.core.Scannable; 22 | import reactor.util.context.Context; 23 | 24 | /** 25 | * Materialize current {@link Context} from the subscribing flow 26 | */ 27 | @Deprecated 28 | final class MonoCurrentContext extends Mono<Context> 29 | implements Fuseable, Scannable { 30 | 31 | static final MonoCurrentContext INSTANCE = new MonoCurrentContext(); 32 | 33 | @SuppressWarnings("unchecked") 34 | public void subscribe(CoreSubscriber<? super Context> actual) { 35 | Context ctx = actual.currentContext(); 36 | actual.onSubscribe(Operators.scalarSubscription(actual, ctx)); 37 | } 38 | 39 | @Override 40 | public Object scanUnsafe(Attr key) { 41 | if (key == Attr.RUN_STYLE) return Attr.RunStyle.SYNC; 42 | if (key == InternalProducerAttr.INSTANCE) return true; 43 | return null; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/MonoDefaultIfEmpty.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import java.util.Objects; 20 | 21 | import reactor.core.CoreSubscriber; 22 | 23 | /** 24 | * Emits a default value if the wrapped Mono is empty. 25 | * @param <T> the value type 26 | */ 27 | final class MonoDefaultIfEmpty<T> extends InternalMonoOperator<T, T> { 28 | final T defaultValue; 29 | 30 | MonoDefaultIfEmpty(Mono<? extends T> source, T defaultValue) { 31 | super(source); 32 | this.defaultValue = Objects.requireNonNull(defaultValue, "defaultValue"); 33 | } 34 | 35 | @Override 36 | public CoreSubscriber<? super T> subscribeOrReturn(CoreSubscriber<? super T> actual) { 37 | return new FluxDefaultIfEmpty.DefaultIfEmptySubscriber<>(actual, defaultValue); 38 | } 39 | 40 | @Override 41 | public Object scanUnsafe(Attr key) { 42 | if (key == Attr.RUN_STYLE) return Attr.RunStyle.SYNC; 43 | return super.scanUnsafe(key); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/MonoDematerialize.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.core.CoreSubscriber; 20 | 21 | /** 22 | * @author Stephane Maldini 23 | */ 24 | final class MonoDematerialize<T> extends InternalMonoOperator<Signal<T>, T> { 25 | 26 | MonoDematerialize(Mono<Signal<T>> source) { 27 | super(source); 28 | } 29 | 30 | @Override 31 | public CoreSubscriber<? super Signal<T>> subscribeOrReturn(CoreSubscriber<? super T> actual) { 32 | return new FluxDematerialize.DematerializeSubscriber<>(actual, true); 33 | } 34 | 35 | @Override 36 | public Object scanUnsafe(Attr key) { 37 | if (key == Attr.RUN_STYLE) return Attr.RunStyle.SYNC; 38 | return super.scanUnsafe(key); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/MonoDetach.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.core.CoreSubscriber; 20 | 21 | /** 22 | * Detaches both the child Subscriber and the Subscription on 23 | * termination or cancellation. 24 | * <p>This should help with odd retention scenarios when running 25 | * wit non Rx mentality based Publishers. 26 | * 27 | * @param <T> the value type 28 | * @see <a href="https://github.com/reactor/reactive-streams-commons">Reactive-Streams-Commons</a> 29 | */ 30 | final class MonoDetach<T> extends InternalMonoOperator<T, T> { 31 | 32 | MonoDetach(Mono<? extends T> source) { 33 | super(source); 34 | } 35 | 36 | @Override 37 | public CoreSubscriber<? super T> subscribeOrReturn(CoreSubscriber<? super T> actual) { 38 | return new FluxDetach.DetachSubscriber<>(actual); 39 | } 40 | 41 | @Override 42 | public Object scanUnsafe(Attr key) { 43 | if (key == Attr.RUN_STYLE) return Attr.RunStyle.SYNC; 44 | return super.scanUnsafe(key); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/MonoDoOnEach.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import java.util.Objects; 20 | import java.util.function.Consumer; 21 | 22 | import reactor.core.CoreSubscriber; 23 | 24 | /** 25 | * Peek into the lifecycle events and signals of a sequence 26 | * 27 | * @param <T> the value type 28 | * 29 | * @see <a href="https://github.com/reactor/reactive-streams-commons">Reactive-Streams-Commons</a> 30 | */ 31 | final class MonoDoOnEach<T> extends InternalMonoOperator<T, T> { 32 | 33 | final Consumer<? super Signal<T>> onSignal; 34 | 35 | MonoDoOnEach(Mono<? extends T> source, Consumer<? super Signal<T>> onSignal) { 36 | super(source); 37 | this.onSignal = Objects.requireNonNull(onSignal, "onSignal"); 38 | } 39 | 40 | @Override 41 | public CoreSubscriber<? super T> subscribeOrReturn(CoreSubscriber<? super T> actual) { 42 | return FluxDoOnEach.createSubscriber(actual, onSignal, false, true); 43 | } 44 | 45 | @Override 46 | public Object scanUnsafe(Attr key) { 47 | if (key == Attr.RUN_STYLE) return Attr.RunStyle.SYNC; 48 | return super.scanUnsafe(key); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/MonoElapsed.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.core.CoreSubscriber; 20 | import reactor.core.Fuseable; 21 | import reactor.core.scheduler.Scheduler; 22 | import reactor.util.function.Tuple2; 23 | 24 | /** 25 | * @author Stephane Maldini 26 | */ 27 | final class MonoElapsed<T> extends InternalMonoOperator<T, Tuple2<Long, T>> implements Fuseable { 28 | 29 | final Scheduler scheduler; 30 | 31 | MonoElapsed(Mono<T> source, Scheduler scheduler) { 32 | super(source); 33 | this.scheduler = scheduler; 34 | } 35 | 36 | @Override 37 | public CoreSubscriber<? super T> subscribeOrReturn(CoreSubscriber<? super Tuple2<Long, T>> actual) { 38 | return new FluxElapsed.ElapsedSubscriber<T>(actual, scheduler); 39 | } 40 | 41 | @Override 42 | public Object scanUnsafe(Attr key) { 43 | if (key == Attr.RUN_ON) return scheduler; 44 | if (key == Attr.RUN_STYLE) return Attr.RunStyle.SYNC; 45 | 46 | return super.scanUnsafe(key); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/MonoHide.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.core.CoreSubscriber; 20 | import reactor.core.Scannable; 21 | 22 | /** 23 | * Wraps another Publisher/Mono and hides its identity, including its 24 | * Subscription. 25 | * 26 | * <p> 27 | * @see <a href="https://github.com/reactor/reactive-streams-commons">Reactive-Streams-Commons</a> 28 | * 29 | * @param <T> the value type 30 | * 31 | */ 32 | final class MonoHide<T> extends InternalMonoOperator<T, T> { 33 | 34 | MonoHide(Mono<? extends T> source) { 35 | super(source); 36 | } 37 | 38 | @Override 39 | public CoreSubscriber<? super T> subscribeOrReturn(CoreSubscriber<? super T> actual) { 40 | return new FluxHide.HideSubscriber<>(actual); 41 | } 42 | 43 | @Override 44 | public Object scanUnsafe(Attr key) { 45 | if (key == Attr.RUN_STYLE) return Attr.RunStyle.SYNC; 46 | return super.scanUnsafe(key); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/MonoIgnoreElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.core.CoreSubscriber; 20 | 21 | /** 22 | * Ignores normal values and passes only the terminal signals along. 23 | * 24 | * @param <T> the value type 25 | * @see <a href="https://github.com/reactor/reactive-streams-commons">Reactive-Streams-Commons</a> 26 | */ 27 | final class MonoIgnoreElement<T> extends InternalMonoOperator<T, T> { 28 | 29 | MonoIgnoreElement(Mono<? extends T> source) { 30 | super(source); 31 | } 32 | 33 | @Override 34 | public CoreSubscriber<? super T> subscribeOrReturn(CoreSubscriber<? super T> actual) { 35 | return new MonoIgnoreElements.IgnoreElementsSubscriber<>(actual); 36 | } 37 | 38 | @Override 39 | public Object scanUnsafe(Attr key) { 40 | if (key == Attr.RUN_STYLE) return Attr.RunStyle.SYNC; 41 | return super.scanUnsafe(key); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/MonoJust.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2023 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import java.time.Duration; 20 | import java.util.Objects; 21 | 22 | import reactor.core.CoreSubscriber; 23 | import reactor.core.Fuseable; 24 | 25 | /** 26 | * @see <a href="https://github.com/reactor/reactive-streams-commons">Reactive-Streams-Commons</a> 27 | */ 28 | final class MonoJust<T> 29 | extends Mono<T> 30 | implements Fuseable.ScalarCallable<T>, Fuseable, SourceProducer<T> { 31 | 32 | final T value; 33 | 34 | MonoJust(T value) { 35 | this.value = Objects.requireNonNull(value, "value"); 36 | } 37 | 38 | @Override 39 | public T call() throws Exception { 40 | return value; 41 | } 42 | 43 | @Override 44 | public T block(Duration m) { 45 | return value; 46 | } 47 | 48 | @Override 49 | public T block() { 50 | return value; 51 | } 52 | 53 | @Override 54 | public void subscribe(CoreSubscriber<? super T> actual) { 55 | actual.onSubscribe(Operators.scalarSubscription(actual, value)); 56 | } 57 | 58 | @Override 59 | public Object scanUnsafe(Attr key) { 60 | if (key == Attr.BUFFERED) return 1; 61 | if (key == Attr.RUN_STYLE) return Attr.RunStyle.SYNC; 62 | return SourceProducer.super.scanUnsafe(key); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/MonoOnErrorReturn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import java.util.function.Predicate; 20 | 21 | import reactor.core.CoreSubscriber; 22 | import reactor.util.annotation.Nullable; 23 | 24 | /** 25 | * See {@link FluxOnErrorReturn}. 26 | * 27 | * @author Simon Baslé 28 | */ 29 | final class MonoOnErrorReturn<T> extends InternalMonoOperator<T, T> { 30 | 31 | @Nullable 32 | final Predicate<? super Throwable> resumableErrorPredicate; 33 | 34 | @Nullable 35 | final T fallbackValue; 36 | 37 | MonoOnErrorReturn(Mono<? extends T> source, @Nullable Predicate<? super Throwable> predicate, @Nullable T value) { 38 | super(source); 39 | resumableErrorPredicate = predicate; 40 | fallbackValue = value; 41 | } 42 | 43 | @Override 44 | public CoreSubscriber<? super T> subscribeOrReturn(CoreSubscriber<? super T> actual) { 45 | return new FluxOnErrorReturn.ReturnSubscriber<>(actual, resumableErrorPredicate, fallbackValue, false); 46 | } 47 | 48 | @Override 49 | public Object scanUnsafe(Attr key) { 50 | if (key == Attr.RUN_STYLE) return Attr.RunStyle.SYNC; 51 | return super.scanUnsafe(key); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/MonoSingleMono.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.core.CoreSubscriber; 20 | import reactor.core.Fuseable; 21 | 22 | /** 23 | * Expects and emits a single item from the source Mono or signals 24 | * NoSuchElementException(or a default generated value) for empty source. 25 | * 26 | * @param <T> the value type 27 | * @see <a href="https://github.com/reactor/reactive-streams-commons">Reactive-Streams-Commons</a> 28 | */ 29 | final class MonoSingleMono<T> extends InternalMonoOperator<T, T> { 30 | 31 | MonoSingleMono(Mono<? extends T> source) { 32 | super(source); 33 | } 34 | 35 | @Override 36 | public CoreSubscriber<? super T> subscribeOrReturn(CoreSubscriber<? super T> actual) { 37 | return new MonoSingle.SingleSubscriber<>(actual, null, false); 38 | } 39 | 40 | @Override 41 | public Object scanUnsafe(Attr key) { 42 | if (key == Attr.RUN_STYLE) return Attr.RunStyle.SYNC; 43 | return super.scanUnsafe(key); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/MonoSourceFlux.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.reactivestreams.Publisher; 20 | import reactor.core.CoreSubscriber; 21 | import reactor.core.Scannable; 22 | 23 | /** 24 | * A connecting {@link Mono} Publisher (right-to-left from a composition chain 25 | * perspective) 26 | * 27 | * @param <I> Upstream type 28 | */ 29 | final class MonoSourceFlux<I> extends MonoFromFluxOperator<I, I> { 30 | 31 | 32 | /** 33 | * Build a {@link MonoSourceFlux} wrapper around the passed parent {@link Publisher} 34 | * 35 | * @param source the {@link Publisher} to decorate 36 | */ 37 | MonoSourceFlux(Flux<? extends I> source) { 38 | super(source); 39 | } 40 | 41 | /** 42 | * Default is simply delegating and decorating with {@link Flux} API. Note this 43 | * assumes an identity between input and output types. 44 | * @param actual 45 | */ 46 | @Override 47 | public CoreSubscriber<? super I> subscribeOrReturn(CoreSubscriber<? super I> actual) { 48 | return actual; 49 | } 50 | 51 | @Override 52 | public Object scanUnsafe(Attr key) { 53 | if (key == Attr.RUN_STYLE) { 54 | return Scannable.from(source).scanUnsafe(key); 55 | } 56 | return super.scanUnsafe(key); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/MonoSourceFluxFuseable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.core.CoreSubscriber; 20 | import reactor.core.Fuseable; 21 | import reactor.core.Scannable; 22 | 23 | /** 24 | * @author Stephane Maldini 25 | */ 26 | final class MonoSourceFluxFuseable<I> extends MonoFromFluxOperator<I, I> implements Fuseable { 27 | 28 | MonoSourceFluxFuseable(Flux<? extends I> source) { 29 | super(source); 30 | } 31 | 32 | /** 33 | * Default is simply delegating and decorating with {@link Flux} API. Note this 34 | * assumes an identity between input and output types. 35 | * @param actual 36 | */ 37 | @Override 38 | public CoreSubscriber<? super I> subscribeOrReturn(CoreSubscriber<? super I> actual) { 39 | return actual; 40 | } 41 | 42 | @Override 43 | public Object scanUnsafe(Attr key) { 44 | if (key == Attr.RUN_STYLE) { 45 | return Scannable.from(source).scanUnsafe(key); 46 | } 47 | return super.scanUnsafe(key); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/MonoSwitchIfEmpty.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2023 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import java.util.Objects; 20 | 21 | import reactor.core.CoreSubscriber; 22 | 23 | /** 24 | * Switches to another source if the first source turns out to be empty. 25 | * 26 | * @param <T> the value type 27 | * @see <a href="https://github.com/reactor/reactive-streams-commons">Reactive-Streams-Commons</a> 28 | */ 29 | final class MonoSwitchIfEmpty<T> extends InternalMonoOperator<T, T> { 30 | 31 | final Mono<? extends T> other; 32 | 33 | MonoSwitchIfEmpty(Mono<? extends T> source, Mono<? extends T> other) { 34 | super(source); 35 | this.other = fromDirect(Objects.requireNonNull(other, "other")); 36 | } 37 | 38 | @Override 39 | public CoreSubscriber<? super T> subscribeOrReturn(CoreSubscriber<? super T> actual) { 40 | FluxSwitchIfEmpty.SwitchIfEmptySubscriber<T> parent = new 41 | FluxSwitchIfEmpty.SwitchIfEmptySubscriber<>(actual, other); 42 | 43 | actual.onSubscribe(parent); 44 | 45 | return parent; 46 | } 47 | 48 | @Override 49 | public Object scanUnsafe(Attr key) { 50 | if (key == Attr.RUN_STYLE) return Attr.RunStyle.SYNC; 51 | return super.scanUnsafe(key); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/MonoTimed.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import java.time.Duration; 20 | import java.time.Instant; 21 | import java.util.Objects; 22 | import java.util.concurrent.TimeUnit; 23 | 24 | import org.reactivestreams.Subscription; 25 | 26 | import reactor.core.CoreSubscriber; 27 | import reactor.core.scheduler.Scheduler; 28 | import reactor.util.annotation.Nullable; 29 | 30 | /** 31 | * @author Simon Baslé 32 | */ 33 | final class MonoTimed<T> extends InternalMonoOperator<T, Timed<T>> { 34 | 35 | final Scheduler clock; 36 | 37 | MonoTimed(Mono<? extends T> source, Scheduler clock) { 38 | super(source); 39 | this.clock = clock; 40 | } 41 | 42 | @Override 43 | public CoreSubscriber<? super T> subscribeOrReturn(CoreSubscriber<? super Timed<T>> actual) { 44 | return new FluxTimed.TimedSubscriber<>(actual, this.clock); 45 | } 46 | 47 | @Nullable 48 | @Override 49 | public Object scanUnsafe(Attr key) { 50 | if (key == Attr.PREFETCH) return 0; 51 | if (key == Attr.RUN_STYLE) return Attr.RunStyle.SYNC; 52 | 53 | return super.scanUnsafe(key); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/ParallelFluxRestoringThreadLocals.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.core.CoreSubscriber; 20 | import reactor.core.Scannable; 21 | 22 | class ParallelFluxRestoringThreadLocals<T> extends ParallelFlux<T> implements 23 | Scannable { 24 | 25 | private final ParallelFlux<? extends T> source; 26 | 27 | ParallelFluxRestoringThreadLocals(ParallelFlux<? extends T> source) { 28 | this.source = source; 29 | } 30 | 31 | @Override 32 | public int parallelism() { 33 | return source.parallelism(); 34 | } 35 | 36 | @Override 37 | public void subscribe(CoreSubscriber<? super T>[] subscribers) { 38 | CoreSubscriber<? super T>[] actualSubscribers = 39 | Operators.restoreContextOnSubscribers(source, subscribers); 40 | 41 | source.subscribe(actualSubscribers); 42 | } 43 | 44 | @Override 45 | public Object scanUnsafe(Attr key) { 46 | if (key == Attr.PARENT) return source; 47 | if (key == Attr.PREFETCH) return getPrefetch(); 48 | if (key == Attr.RUN_STYLE) return Attr.RunStyle.SYNC; 49 | if (key == InternalProducerAttr.INSTANCE) return true; 50 | return null; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/SinkOneSerialized.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import reactor.core.publisher.Sinks.One; 20 | 21 | public class SinkOneSerialized<T> extends SinkEmptySerialized<T> implements InternalOneSink<T>, ContextHolder { 22 | 23 | final One<T> sinkOne; 24 | 25 | public SinkOneSerialized(One<T> sinkOne, ContextHolder contextHolder) { 26 | super(sinkOne, contextHolder); 27 | this.sinkOne = sinkOne; 28 | } 29 | 30 | @Override 31 | public Sinks.EmitResult tryEmitValue(T t) { 32 | Thread currentThread = Thread.currentThread(); 33 | if (!tryAcquire(currentThread)) { 34 | return Sinks.EmitResult.FAIL_NON_SERIALIZED; 35 | } 36 | 37 | try { 38 | return sinkOne.tryEmitValue(t); 39 | } 40 | finally { 41 | if (WIP.decrementAndGet(this) == 0) { 42 | LOCKED_AT.compareAndSet(this, currentThread, null); 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/SourceProducer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2023 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.reactivestreams.Publisher; 20 | import reactor.core.Scannable; 21 | import reactor.util.annotation.Nullable; 22 | 23 | /** 24 | * 25 | * {@link SourceProducer} is a {@link Publisher} that is {@link Scannable} for the 26 | * purpose of being tied back to a chain of operators. By itself it doesn't allow 27 | * walking the hierarchy of operators, as they can only be tied from downstream to upstream 28 | * by referencing their sources. 29 | * 30 | * @param <O> output operator produced type 31 | * 32 | * @author Simon Baslé 33 | */ 34 | interface SourceProducer<O> extends Scannable, Publisher<O> { 35 | 36 | @Override 37 | @Nullable 38 | default Object scanUnsafe(Attr key) { 39 | if (key == Attr.PARENT) return null; 40 | if (key == Attr.ACTUAL) return null; 41 | if (key == InternalProducerAttr.INSTANCE) return true; 42 | 43 | return null; 44 | } 45 | 46 | @Override 47 | default String stepName() { 48 | return "source(" + getClass().getSimpleName() + ")"; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/doc-files/marbles/never.svg: -------------------------------------------------------------------------------- 1 | <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="24 27 362 162" width="362" height="162" id="svg39"> 2 | <defs id="defs9"> 3 | <font-face font-family="'Tahoma','Nimbus Sans L'" font-size="24" panose-1="2 11 9 2 3 0 4 2 2 3" units-per-em="1000" underline-position="-75" underline-thickness="50" slope="0" x-height="501" cap-height="682" ascent="923" descent="-235" font-weight="700" id="font-face2" stemv="0" stemh="0" accent-height="0" ideographic="0" alphabetic="0" mathematical="0" hanging="0" v-ideographic="0" v-alphabetic="0" v-mathematical="0" v-hanging="0" strikethrough-position="0" strikethrough-thickness="0" overline-position="0" overline-thickness="0"> 4 | <font-face-src> 5 | <font-face-name name="Tahoma-Bold"/> 6 | </font-face-src> 7 | </font-face> 8 | <marker orient="auto" overflow="visible" markerUnits="strokeWidth" id="FilledArrow_Marker" stroke-miterlimit="10" viewBox="-1 -6 14 12" markerWidth="14" markerHeight="12" color="#34302c" stroke-linejoin="miter"> 9 | <g id="g6"> 10 | <path d="M12 0L0-4v9z" id="path4" fill="currentColor" stroke="currentColor" stroke-width="1"/> 11 | </g> 12 | </marker> 13 | </defs> 14 | <path d="M34 33h331v67H34V34z" id="path19" fill="#fff" fill-opacity="1" stroke="#34302c" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="none" stroke-opacity="1"/> 15 | <text id="text23" x="-89" y="53" fill="#34302c" fill-opacity="1" stroke="none" stroke-dasharray="none" stroke-opacity="1"> 16 | <tspan font-size="24" font-weight="700" x="165" y="75" id="tspan21" font-family="Tahoma,'Nimbus Sans L'" fill="#34302c">never</tspan> 17 | </text> 18 | <path id="line34" d="M30 172h324" fill="none" fill-opacity="1" stroke="#34302c" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="none" stroke-opacity="1" marker-end="url(#FilledArrow_Marker)"/> 19 | </svg> 20 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/publisher/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011-2022 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Provide main Reactive APIs in {@link reactor.core.publisher.Flux} and {@link reactor.core.publisher.Mono}, 19 | * as well as various helper classes, interfaces used in the composition API, variants of Flux and operator-building 20 | * utilities. 21 | * 22 | * <h2>Flux</h2> 23 | * A typed N-elements or zero sequence {@link org.reactivestreams.Publisher} with core reactive extensions. 24 | * 25 | * <h2>Mono</h2> 26 | * A typed one-element at most sequence {@link org.reactivestreams.Publisher} with core reactive extensions. 27 | ** 28 | * @author Stephane Maldini 29 | */ 30 | @NonNullApi 31 | package reactor.core.publisher; 32 | 33 | import reactor.util.annotation.NonNullApi; -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/scheduler/EmptyCompositeDisposable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.scheduler; 18 | 19 | import reactor.core.Disposable; 20 | 21 | import java.util.Collection; 22 | 23 | final class EmptyCompositeDisposable implements Disposable.Composite { 24 | 25 | @Override 26 | public boolean add(Disposable d) { 27 | return false; 28 | } 29 | 30 | @Override 31 | public boolean addAll(Collection<? extends Disposable> ds) { 32 | return false; 33 | } 34 | 35 | @Override 36 | public boolean remove(Disposable d) { 37 | return false; 38 | } 39 | 40 | @Override 41 | public int size() { 42 | return 0; 43 | } 44 | 45 | @Override 46 | public void dispose() { 47 | } 48 | 49 | @Override 50 | public boolean isDisposed() { 51 | return false; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/scheduler/NonBlocking.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.scheduler; 18 | 19 | /** 20 | * A marker interface that is detected on {@link Thread Threads} while executing Reactor 21 | * blocking APIs, resulting in these calls throwing an exception. 22 | * <p> 23 | * See {@link Schedulers#isInNonBlockingThread()}} and 24 | * {@link Schedulers#isNonBlockingThread(Thread)} 25 | * 26 | * @author Simon Baslé 27 | */ 28 | public interface NonBlocking { } 29 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/core/scheduler/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * {@link reactor.core.scheduler.Scheduler} contract and static 19 | * registry and factory methods in {@link reactor.core.scheduler.Schedulers}. 20 | * 21 | * @author Stephane Maldini 22 | */ 23 | @NonNullApi 24 | package reactor.core.scheduler; 25 | 26 | import reactor.util.annotation.NonNullApi; -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/util/annotation/Incubating.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.util.annotation; 18 | 19 | import java.lang.annotation.Documented; 20 | import java.lang.annotation.ElementType; 21 | import java.lang.annotation.Retention; 22 | import java.lang.annotation.RetentionPolicy; 23 | import java.lang.annotation.Target; 24 | 25 | /** 26 | * Signifies that the annotated functionality is currently in a developmental phase. 27 | * An API marked as {@code @Incubating} is subject to potential modifications (including removal) without prior notice. 28 | * 29 | * @author Violeta Georgieva 30 | * @since 3.7.0 31 | */ 32 | @Target({ElementType.PACKAGE, ElementType.TYPE, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.FIELD}) 33 | @Retention(RetentionPolicy.RUNTIME) 34 | @Documented 35 | public @interface Incubating { 36 | } 37 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/util/annotation/NonNullApi.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.util.annotation; 18 | 19 | import java.lang.annotation.Documented; 20 | import java.lang.annotation.ElementType; 21 | import java.lang.annotation.Retention; 22 | import java.lang.annotation.RetentionPolicy; 23 | import java.lang.annotation.Target; 24 | 25 | import javax.annotation.Nonnull; 26 | import javax.annotation.meta.TypeQualifierDefault; 27 | 28 | /** 29 | * A common Reactor annotation (similar to Spring one) to declare that parameters and return 30 | * values are to be considered as non-nullable by default for a given package. 31 | * Leverages JSR 305 meta-annotations to indicate nullability in Java to common tools with 32 | * JSR 305 support and used by Kotlin to infer nullability of Reactor API. 33 | * 34 | * <p>Should be used at package level in association with {@link Nullable} 35 | * annotations at parameter and return value level. 36 | * 37 | * @author Sebastien Deleuze 38 | * @author Juergen Hoeller 39 | * @since 3.1.0 40 | * @see Nullable 41 | * @see NonNull 42 | */ 43 | @Target(ElementType.PACKAGE) 44 | @Retention(RetentionPolicy.RUNTIME) 45 | @Documented 46 | @Nonnull 47 | @TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER}) 48 | public @interface NonNullApi { 49 | } 50 | -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/util/concurrent/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Queue {@link reactor.util.concurrent.Queues suppliers and utilities} 19 | * Used for operational serialization (serializing threads) or buffering (asynchronous boundary). 20 | * 21 | * @author Stephane Maldini 22 | */ 23 | @NonNullApi 24 | package reactor.util.concurrent; 25 | 26 | import reactor.util.annotation.NonNullApi; -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/util/context/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Miscellaneous utility classes, such as loggers, tuples or queue suppliers and implementations. 19 | */ 20 | @NonNullApi 21 | package reactor.util.context; 22 | 23 | import reactor.util.annotation.NonNullApi; -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/util/function/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * {@link reactor.util.function.Tuples Tuples} provide a type-safe way to specify multiple parameters. 19 | */ 20 | @NonNullApi 21 | package reactor.util.function; 22 | 23 | import reactor.util.annotation.NonNullApi; -------------------------------------------------------------------------------- /reactor-core/src/main/java/reactor/util/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Miscellaneous utility classes, such as loggers, tuples or queue suppliers and implementations. 19 | */ 20 | @NonNullApi 21 | package reactor.util; 22 | 23 | import reactor.util.annotation.NonNullApi; -------------------------------------------------------------------------------- /reactor-core/src/main/resources/META-INF/native-image/io.projectreactor/reactor-core/reflect-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "condition": { 4 | "typeReachable": "reactor.core.publisher.Traces" 5 | }, 6 | "name": "reactor.core.publisher.Traces$StackWalkerCallSiteSupplierFactory", 7 | "methods": [ 8 | { 9 | "name": "<init>", 10 | "parameterTypes": [] 11 | } 12 | ] 13 | }, 14 | { 15 | "condition": { 16 | "typeReachable": "reactor.core.publisher.Traces" 17 | }, 18 | "name": "reactor.core.publisher.Traces$ExceptionCallSiteSupplierFactory", 19 | "methods": [ 20 | { 21 | "name": "<init>", 22 | "parameterTypes": [] 23 | } 24 | ] 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /reactor-core/src/main/resources/META-INF/services/io.micrometer.context.ContextAccessor: -------------------------------------------------------------------------------- 1 | reactor.util.context.ReactorContextAccessor -------------------------------------------------------------------------------- /reactor-core/src/main/resources/META-INF/services/reactor.blockhound.integration.BlockHoundIntegration: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019-2021 VMware Inc. or its affiliates, All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | reactor.core.scheduler.ReactorBlockHoundIntegration -------------------------------------------------------------------------------- /reactor-core/src/tckTest/java/reactor/core/publisher/tck/FluxGenerateVerification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher.tck; 18 | 19 | import java.util.logging.Level; 20 | 21 | import org.reactivestreams.Publisher; 22 | import org.reactivestreams.tck.PublisherVerification; 23 | import org.reactivestreams.tck.TestEnvironment; 24 | import org.testng.annotations.Test; 25 | import reactor.core.publisher.Flux; 26 | 27 | /** 28 | * @author Stephane Maldini 29 | */ 30 | @Test 31 | public class FluxGenerateVerification extends PublisherVerification<Long> { 32 | 33 | public FluxGenerateVerification() { 34 | super(new TestEnvironment(500), 1000); 35 | } 36 | 37 | @Override 38 | public Publisher<Long> createPublisher(long elements) { 39 | return Flux.<Long, Long>generate(() -> 0L, (cursor, s) -> { 40 | if(cursor < elements && cursor < elements) { 41 | s.next(cursor); 42 | } 43 | else if(cursor == elements){ 44 | s.complete(); 45 | } 46 | 47 | return cursor + 1; 48 | }) 49 | 50 | .map(data -> data * 10) 51 | .map( data -> data / 10) 52 | .log("log-test", Level.FINE); 53 | } 54 | 55 | @Override 56 | public Publisher<Long> createFailedPublisher() { 57 | return Flux.error(new Exception("test")); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /reactor-core/src/tckTest/java/reactor/core/publisher/tck/FluxSwitchOnFirstVerification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher.tck; 18 | 19 | import org.reactivestreams.Publisher; 20 | import org.reactivestreams.tck.PublisherVerification; 21 | import org.reactivestreams.tck.TestEnvironment; 22 | import org.testng.annotations.Test; 23 | import reactor.core.publisher.Flux; 24 | 25 | @Test 26 | public class FluxSwitchOnFirstVerification extends PublisherVerification<Integer> { 27 | 28 | public FluxSwitchOnFirstVerification() { 29 | super(new TestEnvironment()); 30 | } 31 | 32 | @Override 33 | public Publisher<Integer> createPublisher(long elements) { 34 | return Flux.range(0, Integer.MAX_VALUE < elements ? Integer.MAX_VALUE : (int) elements) 35 | .switchOnFirst((first, innerFlux) -> innerFlux); 36 | } 37 | 38 | @Override 39 | public Publisher<Integer> createFailedPublisher() { 40 | return Flux.<Integer>error(new RuntimeException()) 41 | .switchOnFirst((first, innerFlux) -> innerFlux); 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/ReactorLauncherSessionListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor; 18 | 19 | import org.junit.platform.launcher.LauncherSession; 20 | import org.junit.platform.launcher.LauncherSessionListener; 21 | import reactor.test.AssertionsUtils; 22 | import reactor.test.util.LoggerUtils; 23 | import reactor.util.Loggers; 24 | 25 | public class ReactorLauncherSessionListener implements LauncherSessionListener { 26 | 27 | /** 28 | * Reset the {@link Loggers} factory to defaults suitable for reactor-core tests. 29 | * Notably, it installs an indirection via {@link LoggerUtils#useCurrentLoggersWithCapture()}. 30 | */ 31 | public static void resetLoggersFactory() { 32 | Loggers.resetLoggerFactory(); 33 | LoggerUtils.useCurrentLoggersWithCapture(); 34 | } 35 | 36 | @Override 37 | public void launcherSessionOpened(LauncherSession session) { 38 | AssertionsUtils.installAssertJTestRepresentation(); 39 | ReactorLauncherSessionListener.resetLoggersFactory(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/ContextPropagationNotThereSmokeTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2023 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | 21 | import static org.assertj.core.api.Assertions.assertThat; 22 | 23 | /** 24 | * For tests that actually assert things when context-propagation is available, see 25 | * {@code withMicrometer} test set. 26 | * @author Simon Baslé 27 | */ 28 | class ContextPropagationNotThereSmokeTest { 29 | 30 | @Test 31 | void contextPropagationIsNotAvailable() { 32 | assertThat(ContextPropagationSupport.isContextPropagationAvailable()).isFalse(); 33 | } 34 | 35 | @Test 36 | void contextCaptureFluxApiIsNoOp() { 37 | Flux<Integer> source = Flux.empty(); 38 | assertThat(source.contextCapture()).isSameAs(source); 39 | } 40 | 41 | @Test 42 | void contextCaptureMonoApiIsNoOp() { 43 | Mono<Integer> source = Mono.empty(); 44 | assertThat(source.contextCapture()).isSameAs(source); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/FluxAutoConnectFuseableTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import org.mockito.Mockito; 21 | import reactor.core.Scannable; 22 | import reactor.test.MockUtils; 23 | 24 | import static org.assertj.core.api.Assertions.assertThat; 25 | 26 | public class FluxAutoConnectFuseableTest { 27 | 28 | @Test 29 | public void scanMain() { 30 | @SuppressWarnings("unchecked") 31 | ConnectableFlux<String> source = Mockito.mock(MockUtils.TestScannableConnectableFlux.class); 32 | Mockito.when(source.getPrefetch()).thenReturn(888); 33 | FluxAutoConnectFuseable<String> test = new FluxAutoConnectFuseable<>(source, 123, d -> { }); 34 | 35 | assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(source); 36 | assertThat(test.scan(Scannable.Attr.PREFETCH)).isEqualTo(888); 37 | assertThat(test.scan(Scannable.Attr.CAPACITY)).isEqualTo(123); 38 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/FluxEmptyTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.Scannable; 21 | import reactor.test.StepVerifier; 22 | 23 | import static org.assertj.core.api.Assertions.assertThat; 24 | import static reactor.core.Scannable.from; 25 | 26 | public class FluxEmptyTest { 27 | 28 | @Test 29 | public void normal() { 30 | StepVerifier.create(Flux.empty()) 31 | .verifyComplete(); 32 | } 33 | 34 | @Test 35 | public void scanOperator(){ 36 | Flux test = Flux.empty(); 37 | 38 | assertThat(from(test).scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/FluxErrorOnRequestTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.CoreSubscriber; 21 | import reactor.core.Scannable; 22 | 23 | import static org.assertj.core.api.Assertions.assertThat; 24 | 25 | public class FluxErrorOnRequestTest { 26 | 27 | @Test 28 | public void scanOperator(){ 29 | FluxErrorOnRequest test = new FluxErrorOnRequest(new IllegalStateException()); 30 | 31 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 32 | assertThat(test.scan(Scannable.Attr.ACTUAL)).isNull(); 33 | } 34 | 35 | @Test 36 | public void scanSubscription() { 37 | CoreSubscriber<Integer> actual = new LambdaSubscriber<>(null, e -> {}, null, sub -> sub.request(100)); 38 | IllegalStateException error = new IllegalStateException(); 39 | FluxErrorOnRequest.ErrorSubscription test = new FluxErrorOnRequest.ErrorSubscription(actual, error); 40 | 41 | assertThat(test.scan(Scannable.Attr.ERROR)).isSameAs(error); 42 | assertThat(test.scan(Scannable.Attr.ACTUAL)).isSameAs(actual); 43 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 44 | } 45 | } -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/FluxLogTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | 20 | import org.junit.jupiter.api.Test; 21 | import reactor.core.Scannable; 22 | 23 | import java.util.logging.Level; 24 | 25 | import static org.assertj.core.api.Assertions.assertThat; 26 | 27 | public class FluxLogTest { 28 | 29 | @Test 30 | public void scanOperator(){ 31 | Flux<Integer> parent = Flux.just(1); 32 | SignalLogger<Integer> log = new SignalLogger<>(parent, "category", Level.INFO, true); 33 | FluxLog<Integer> test = new FluxLog<>(parent, log); 34 | 35 | assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(parent); 36 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 37 | } 38 | 39 | @Test 40 | public void scanFuseableOperator(){ 41 | Flux<Integer> parent = Flux.just(1); 42 | SignalLogger<Integer> log = new SignalLogger<>(parent, "category", Level.INFO, true); 43 | FluxLogFuseable<Integer> test = new FluxLogFuseable<>(parent, log); 44 | 45 | assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(parent); 46 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/FluxMapNotNullTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.test.subscriber.AssertSubscriber; 21 | 22 | public class FluxMapNotNullTest { 23 | 24 | @Test 25 | public void regularMapper() { 26 | AssertSubscriber<Integer> ts = AssertSubscriber.create(); 27 | 28 | Flux.range(1, 5) 29 | .mapNotNull(v -> v * 2) 30 | .subscribe(ts); 31 | 32 | ts.assertValues(2, 4, 6, 8, 10) 33 | .assertComplete() 34 | .assertNoError(); 35 | } 36 | 37 | @Test 38 | public void mapperProducingNulls() { 39 | AssertSubscriber<Integer> ts = AssertSubscriber.create(); 40 | 41 | Flux.range(1, 5) 42 | .mapNotNull(v -> v % 2 == 0 ? v * 2 : null) 43 | .subscribe(ts); 44 | 45 | ts.assertValues(4, 8) 46 | .assertComplete() 47 | .assertNoError(); 48 | } 49 | 50 | @Test 51 | public void mapperThrowingException() { 52 | AssertSubscriber<Integer> ts = AssertSubscriber.create(); 53 | 54 | Flux.range(1, 5) 55 | .<Integer>mapNotNull(v -> {throw new RuntimeException();}) 56 | .subscribe(ts); 57 | 58 | ts.assertError(RuntimeException.class); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/FluxNeverTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.Scannable; 21 | import reactor.test.subscriber.AssertSubscriber; 22 | 23 | import static org.assertj.core.api.Assertions.assertThat; 24 | 25 | public class FluxNeverTest { 26 | 27 | @Test 28 | public void singleInstance() { 29 | assertThat(Flux.never()).isSameAs(Flux.never()); 30 | } 31 | 32 | @Test 33 | public void normal() { 34 | AssertSubscriber<Integer> ts = AssertSubscriber.create(); 35 | 36 | FluxNever.<Integer>instance().subscribe(ts); 37 | 38 | ts 39 | .assertSubscribed() 40 | .assertNoValues() 41 | .assertNoError() 42 | .assertNotComplete(); 43 | } 44 | 45 | @Test 46 | public void scanOperator(){ 47 | FluxNever test = new FluxNever(); 48 | 49 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/FluxSwitchOnNextTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.test.StepVerifier; 21 | 22 | public class FluxSwitchOnNextTest { 23 | 24 | 25 | 26 | @Test 27 | public void switchOnNext() { 28 | StepVerifier.create(Flux.switchOnNext(Flux.just(Flux.just("Three", "Two", "One"), 29 | Flux.just("Zero")))) 30 | .expectNext("Three") 31 | .expectNext("Two") 32 | .expectNext("One") 33 | .expectNext("Zero") 34 | .verifyComplete(); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/FluxTimestampTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import java.time.Duration; 20 | 21 | import org.junit.jupiter.api.Test; 22 | import reactor.test.StepVerifier; 23 | import reactor.util.function.Tuple2; 24 | 25 | public class FluxTimestampTest { 26 | 27 | Flux<Tuple2<Long, String>> scenario_aFluxCanBeTimestamped(){ 28 | return Flux.just("test") 29 | .timestamp(); 30 | } 31 | 32 | @Test 33 | public void aFluxCanBeTimestamped(){ 34 | StepVerifier.withVirtualTime(this::scenario_aFluxCanBeTimestamped, 0) 35 | .thenAwait(Duration.ofSeconds(2)) 36 | .thenRequest(1) 37 | .expectNextMatches(t -> t.getT1() == 2000 && t.getT2().equals("test")) 38 | .verifyComplete(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/InnerProducerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.CoreSubscriber; 21 | import reactor.core.Scannable; 22 | 23 | import static org.assertj.core.api.Assertions.assertThat; 24 | 25 | public class InnerProducerTest { 26 | 27 | @Test 28 | public void scanDefaultMethod() { 29 | CoreSubscriber<String> actual = new LambdaSubscriber<>(null, null, null, null); 30 | InnerProducer<String> test = new InnerProducer<String>() { 31 | @Override 32 | public CoreSubscriber<? super String> actual() { 33 | return actual; 34 | } 35 | 36 | @Override 37 | public void request(long n) { } 38 | 39 | @Override 40 | public void cancel() { } 41 | }; 42 | 43 | assertThat(test.scan(Scannable.Attr.ACTUAL)).isSameAs(actual); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/MonoContextWriteTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | 20 | import org.junit.jupiter.api.Test; 21 | import reactor.core.Scannable; 22 | 23 | import static org.assertj.core.api.Assertions.assertThat; 24 | 25 | public class MonoContextWriteTest { 26 | 27 | @Test 28 | public void scanOperator(){ 29 | MonoContextWrite<Integer> test = new MonoContextWrite<>(Mono.just(1), c -> c); 30 | 31 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 32 | } 33 | } -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/MonoCurrentContextTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.Scannable; 21 | 22 | import static org.assertj.core.api.Assertions.assertThat; 23 | 24 | @Deprecated 25 | public class MonoCurrentContextTest { 26 | 27 | @Test 28 | public void scanOperator(){ 29 | MonoCurrentContext test = MonoCurrentContext.INSTANCE; 30 | 31 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/MonoEmptyTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.Scannable; 21 | import reactor.test.StepVerifier; 22 | 23 | import static org.assertj.core.api.Assertions.assertThat; 24 | 25 | public class MonoEmptyTest { 26 | 27 | @Test 28 | public void normal() { 29 | StepVerifier.create(Mono.empty()) 30 | .verifyComplete(); 31 | } 32 | 33 | @Test 34 | public void scanOperator(){ 35 | MonoEmpty test = new MonoEmpty(); 36 | 37 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/MonoErrorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.Scannable; 21 | import reactor.test.StepVerifier; 22 | 23 | import static org.assertj.core.api.Assertions.assertThatExceptionOfType; 24 | import static org.assertj.core.api.Assertions.assertThat; 25 | 26 | public class MonoErrorTest { 27 | 28 | @Test 29 | public void normal() { 30 | StepVerifier.create(Mono.error(new Exception("test"))) 31 | .verifyErrorMessage("test"); 32 | } 33 | 34 | @Test 35 | public void onMonoRejectedThrowOnBlock() { 36 | assertThatExceptionOfType(Exception.class).isThrownBy(() -> { 37 | Mono.error(new Exception("test")) 38 | .block(); 39 | }); 40 | } 41 | 42 | @Test 43 | public void scanOperator(){ 44 | MonoError test = new MonoError(new NullPointerException()); 45 | 46 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/MonoFlattenIterableTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.Scannable; 21 | import reactor.util.concurrent.Queues; 22 | 23 | import java.util.Arrays; 24 | 25 | import static org.assertj.core.api.Assertions.assertThat; 26 | 27 | public class MonoFlattenIterableTest { 28 | 29 | @Test 30 | public void scanOperator() { 31 | MonoFlattenIterable<Integer, Integer> test = 32 | new MonoFlattenIterable<>(Mono.just(1), i -> Arrays.asList(i), Integer.MAX_VALUE, Queues.one()); 33 | 34 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/MonoFromPublisherTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.Scannable; 21 | 22 | import static org.assertj.core.api.Assertions.assertThat; 23 | 24 | public class MonoFromPublisherTest { 25 | 26 | @Test 27 | public void scanOperator(){ 28 | MonoFromPublisher<String> test = new MonoFromPublisher<>(Flux.just("foo", "bar")); 29 | 30 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/MonoHideTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.Fuseable; 21 | import reactor.core.Scannable; 22 | 23 | import static org.assertj.core.api.Assertions.assertThat; 24 | 25 | public class MonoHideTest { 26 | 27 | @Test 28 | public void normal() { 29 | Mono<Integer> f = Mono.just(1); 30 | assertThat(f).isInstanceOf(Fuseable.ScalarCallable.class); 31 | f = f.hide(); 32 | assertThat(f).isNotInstanceOf(Fuseable.ScalarCallable.class); 33 | assertThat(f).isInstanceOf(MonoHide.class); 34 | } 35 | 36 | @Test 37 | public void scanOperator(){ 38 | Mono<Integer> parent = Mono.just(1); 39 | MonoHide<Integer> test = new MonoHide<>(parent); 40 | 41 | assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(parent); 42 | assertThat(test.scan(Scannable.Attr.PREFETCH)).isEqualTo(Integer.MAX_VALUE); 43 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/MonoIgnoreElementTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.Scannable; 21 | 22 | import static org.assertj.core.api.Assertions.assertThat; 23 | 24 | public class MonoIgnoreElementTest { 25 | 26 | @Test 27 | public void scanOperator(){ 28 | MonoIgnoreElement<Integer> test = new MonoIgnoreElement<>(Mono.just(1)); 29 | 30 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/MonoIgnorePublisherTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.Scannable; 21 | import reactor.test.StepVerifier; 22 | 23 | import static org.assertj.core.api.Assertions.assertThat; 24 | 25 | public class MonoIgnorePublisherTest { 26 | 27 | @Test 28 | public void normal() { 29 | StepVerifier.create(Mono.ignoreElements(Mono.just("foo"))) 30 | .expectSubscription() 31 | .verifyComplete(); 32 | } 33 | 34 | @Test 35 | public void scanOperator(){ 36 | MonoIgnoreElement<String> test = new MonoIgnoreElement<>(Mono.just("foo")); 37 | 38 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 39 | } 40 | } -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/MonoLogTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.Scannable; 21 | 22 | import java.util.logging.Level; 23 | 24 | import static org.assertj.core.api.Assertions.assertThat; 25 | 26 | public class MonoLogTest { 27 | 28 | @Test 29 | public void scanOperator(){ 30 | Mono<Integer> source = Mono.just(1); 31 | MonoLog<Integer> test = new MonoLog<>(source, 32 | new SignalLogger<>(source, "category", Level.INFO, false, SignalType.ON_COMPLETE)); 33 | 34 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 35 | } 36 | 37 | @Test 38 | public void scanFuseableOperator(){ 39 | Mono<Integer> source = Mono.just(1); 40 | MonoLogFuseable<Integer> test = new MonoLogFuseable<>(source, 41 | new SignalLogger<>(source, "category", Level.INFO, false, SignalType.ON_COMPLETE)); 42 | 43 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/MonoMapNotNullTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.test.subscriber.AssertSubscriber; 21 | 22 | public class MonoMapNotNullTest { 23 | 24 | @Test 25 | public void regularMapper() { 26 | AssertSubscriber<Integer> ts = AssertSubscriber.create(); 27 | 28 | Mono.just(1) 29 | .mapNotNull(v -> v * 2) 30 | .subscribe(ts); 31 | 32 | ts.assertValues(2) 33 | .assertComplete() 34 | .assertNoError(); 35 | } 36 | 37 | @Test 38 | public void mapperProducingNulls() { 39 | AssertSubscriber<Integer> ts = AssertSubscriber.create(); 40 | 41 | Mono.just(1) 42 | .mapNotNull(v -> v % 2 == 0 ? v * 2 : null) 43 | .subscribe(ts); 44 | 45 | ts.assertComplete() 46 | .assertNoError(); 47 | } 48 | 49 | @Test 50 | public void mapperThrowingException() { 51 | AssertSubscriber<Integer> ts = AssertSubscriber.create(); 52 | 53 | Mono.just(1) 54 | .<Integer>mapNotNull(v -> {throw new RuntimeException();}) 55 | .subscribe(ts); 56 | 57 | ts.assertError(RuntimeException.class); 58 | }} 59 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/MonoNeverTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.Scannable; 21 | import reactor.test.subscriber.AssertSubscriber; 22 | 23 | import static org.assertj.core.api.Assertions.assertThat; 24 | 25 | public class MonoNeverTest { 26 | 27 | @Test 28 | public void normal() { 29 | Mono.never() 30 | .subscribeWith(AssertSubscriber.create()) 31 | .assertSubscribed() 32 | .assertNoError() 33 | .assertNotComplete(); 34 | } 35 | 36 | @Test 37 | public void scanOperator() { 38 | MonoNever test = new MonoNever(); 39 | 40 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/MonoOnAssemblyTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.Scannable; 21 | import reactor.core.publisher.FluxOnAssembly.AssemblySnapshot; 22 | 23 | import static org.assertj.core.api.Assertions.assertThat; 24 | 25 | public class MonoOnAssemblyTest { 26 | 27 | @Test 28 | public void scanOperator() { 29 | AssemblySnapshot stacktrace = new AssemblySnapshot(null, Traces.callSiteSupplierFactory.get()); 30 | MonoOnAssembly<?> test = new MonoOnAssembly<>(Mono.empty(), stacktrace); 31 | 32 | assertThat(test.scan(Scannable.Attr.ACTUAL_METADATA)).as("ACTUAL_METADATA").isTrue(); 33 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 34 | } 35 | 36 | @Test 37 | public void stepNameAndToString() { 38 | AssemblySnapshot stacktrace = new AssemblySnapshot(null, Traces.callSiteSupplierFactory.get()); 39 | MonoOnAssembly<?> test = new MonoOnAssembly<>(Mono.empty(), stacktrace); 40 | 41 | assertThat(test.toString()) 42 | .isEqualTo(test.stepName()) 43 | .startsWith("reactor.core.publisher.MonoOnAssemblyTest.stepNameAndToString(MonoOnAssemblyTest.java:"); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/MonoSourceFluxTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.Scannable; 21 | 22 | import static org.assertj.core.api.Assertions.assertThat; 23 | 24 | public class MonoSourceFluxTest { 25 | 26 | @Test 27 | public void scanOperator(){ 28 | Flux<String> source = Flux.just("foo", "bar"); 29 | MonoSourceFlux<String> test = new MonoSourceFlux<>(source); 30 | 31 | assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(source); 32 | assertThat(test.scan(Scannable.Attr.PREFETCH)).isEqualTo(Integer.MAX_VALUE); 33 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 34 | } 35 | 36 | @Test 37 | public void scanFuseableOperator(){ 38 | Flux<String> source = Flux.just("foo", "bar"); 39 | MonoSourceFluxFuseable<String> test = new MonoSourceFluxFuseable<>(source); 40 | 41 | assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(source); 42 | assertThat(test.scan(Scannable.Attr.PREFETCH)).isEqualTo(Integer.MAX_VALUE); 43 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 44 | } 45 | } -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/MonoTimestampTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import java.time.Duration; 20 | 21 | import org.junit.jupiter.api.Test; 22 | import reactor.test.StepVerifier; 23 | import reactor.util.function.Tuple2; 24 | 25 | public class MonoTimestampTest { 26 | 27 | Mono<Tuple2<Long, String>> scenario_aMonoCanBeTimestamped(){ 28 | return Mono.just("test") 29 | .timestamp(); 30 | } 31 | 32 | @Test 33 | public void aMonoCanBeTimestamped(){ 34 | StepVerifier.withVirtualTime(this::scenario_aMonoCanBeTimestamped, 0) 35 | .thenAwait(Duration.ofSeconds(2)) 36 | .thenRequest(1) 37 | .expectNextMatches(t -> t.getT1() == 2000 && t.getT2().equals("test")) 38 | .verifyComplete(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/ParallelArraySourceTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import org.reactivestreams.Publisher; 21 | import reactor.core.Scannable; 22 | 23 | import static org.assertj.core.api.Assertions.assertThat; 24 | import static reactor.core.publisher.Flux.just; 25 | 26 | public class ParallelArraySourceTest { 27 | 28 | @Test 29 | public void parallelism() { 30 | @SuppressWarnings("unchecked") 31 | Publisher<Integer>[] sources = new Publisher[2]; 32 | sources[0] = Flux.range(1, 4); 33 | sources[1] = just(10); 34 | ParallelArraySource<Integer> test = new ParallelArraySource<>(sources); 35 | 36 | assertThat(test.parallelism()).isEqualTo(2); 37 | } 38 | 39 | @Test 40 | public void scanOperator(){ 41 | @SuppressWarnings("unchecked") 42 | Publisher<Integer>[] sources = new Publisher[2]; 43 | sources[0] = Flux.range(1, 4); 44 | sources[1] = just(10); 45 | ParallelArraySource<Integer> test = new ParallelArraySource<>(sources); 46 | 47 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/ParallelDoOnEachTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.Scannable; 21 | import reactor.util.concurrent.Queues; 22 | 23 | import static org.assertj.core.api.Assertions.*; 24 | 25 | public class ParallelDoOnEachTest { 26 | 27 | @Test 28 | public void scanOperator(){ 29 | ParallelFlux<Integer> parent = Flux.just(1).parallel(2); 30 | ParallelDoOnEach<Integer> test = new ParallelDoOnEach<>(parent, (k, v) -> {}, (k, v) -> {}, v -> {}); 31 | 32 | assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(parent); 33 | assertThat(test.scan(Scannable.Attr.PREFETCH)).isEqualTo(Queues.SMALL_BUFFER_SIZE); 34 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/ParallelFluxHideTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.Scannable; 21 | 22 | import static org.assertj.core.api.Assertions.assertThat; 23 | 24 | public class ParallelFluxHideTest { 25 | 26 | @Test 27 | public void parallelism() { 28 | ParallelFlux<Integer> source = Flux.range(1, 4).parallel(3); 29 | ParallelFluxHide<Integer> test = new ParallelFluxHide<>(source); 30 | 31 | assertThat(test.parallelism()) 32 | .isEqualTo(3) 33 | .isEqualTo(source.parallelism()); 34 | } 35 | 36 | @Test 37 | public void scanOperator() throws Exception { 38 | ParallelFlux<Integer> source = Flux.range(1, 4).parallel(3); 39 | ParallelFluxHide<Integer> test = new ParallelFluxHide<>(source); 40 | 41 | assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(source); 42 | assertThat(test.scan(Scannable.Attr.PREFETCH)) 43 | .isEqualTo(256) 44 | .isEqualTo(source.getPrefetch()); 45 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/ParallelLiftTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.Scannable; 21 | 22 | import static org.assertj.core.api.Assertions.assertThat; 23 | 24 | public class ParallelLiftTest { 25 | 26 | @Test 27 | public void parallelism() { 28 | ParallelFlux<Integer> source = Flux.range(1, 4).parallel(3); 29 | ParallelLift<Integer, Integer> test = new ParallelLift<>(source, Operators.LiftFunction.liftPublisher(null, (sc, su) -> su)); 30 | 31 | assertThat(test.parallelism()) 32 | .isEqualTo(3) 33 | .isEqualTo(source.parallelism()); 34 | } 35 | 36 | @Test 37 | public void scanOperator() throws Exception { 38 | ParallelFlux<Integer> source = Flux.range(1, 4).parallel(3); 39 | ParallelLift<Integer, Integer> test = new ParallelLift<>(source, Operators.LiftFunction.liftPublisher(null, (sc, su) -> su)); 40 | 41 | assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(source); 42 | assertThat(test.scan(Scannable.Attr.PREFETCH)) 43 | .isEqualTo(256) 44 | .isEqualTo(source.getPrefetch()); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/publisher/loop/FluxGroupByLoop.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher.loop; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.publisher.FluxGroupByTest; 21 | 22 | /** 23 | * @author Stephane Maldini 24 | */ 25 | public class FluxGroupByLoop { 26 | 27 | final FluxGroupByTest groupByTest = new FluxGroupByTest(); 28 | 29 | @Test 30 | public void twoGroupsLongAsyncMergeHiddenLoop() { 31 | for (int i = 0; i < 100; i++) { 32 | groupByTest.twoGroupsLongAsyncMergeHidden(); 33 | } 34 | } 35 | 36 | @Test 37 | public void twoGroupsLongAsyncMergeLoop() { 38 | for (int i = 0; i < 100; i++) { 39 | groupByTest.twoGroupsLongAsyncMerge(); 40 | } 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/core/scheduler/SingleWorkerAroundTimerSchedulerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2022 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.scheduler; 18 | 19 | /** 20 | * @author Stephane Maldini 21 | */ 22 | public class SingleWorkerAroundTimerSchedulerTest extends AbstractSchedulerTest { 23 | 24 | @Override 25 | protected boolean shouldCheckDisposeTask() { 26 | return false; 27 | } 28 | 29 | @Override 30 | protected boolean shouldCheckWorkerTimeScheduling() { 31 | return false; 32 | } 33 | 34 | @Override 35 | protected boolean shouldCheckSupportRestart() { 36 | return false; 37 | } 38 | 39 | @Override 40 | protected boolean shouldCheckInit() { 41 | return false; 42 | } 43 | 44 | @Override 45 | protected Scheduler scheduler() { 46 | return Schedulers.single(Schedulers.newSingle("singleWorkerTimer")); 47 | } 48 | 49 | @Override 50 | protected Scheduler freshScheduler() { 51 | return Schedulers.single(Schedulers.factory.newSingle(new ReactorThreadFactory( 52 | "SingleSchedulerTest", SingleScheduler.COUNTER, false, true, 53 | Schedulers::defaultUncaughtException 54 | ))); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/guide/FakeRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.guide; 18 | 19 | import reactor.core.publisher.Flux; 20 | 21 | /** 22 | * @author Simon Baslé 23 | */ 24 | public class FakeRepository { 25 | 26 | public static Flux<String> findAllUserByName(Flux<String> source) { 27 | return source.map(s -> { throw new IllegalStateException("boom"); }) 28 | .map(s -> s + "-user"); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/guide/FakeUtils1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.guide; 18 | 19 | import java.util.function.Function; 20 | 21 | import reactor.core.publisher.Flux; 22 | 23 | /** 24 | * @author Simon Baslé 25 | */ 26 | public class FakeUtils1 { 27 | 28 | public static final Function<? super Flux<String>, Flux<String>> applyFilters = 29 | f -> f.filter(s -> s.startsWith("s")); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/guide/FakeUtils2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.guide; 18 | 19 | import java.util.function.Function; 20 | 21 | import reactor.core.publisher.Flux; 22 | import reactor.util.function.Tuple2; 23 | 24 | /** 25 | * @author Simon Baslé 26 | */ 27 | public class FakeUtils2 { 28 | 29 | public static final Function<? super Flux<String>, Flux<Tuple2<Long, String>>> enrichUser = 30 | f -> f.elapsed(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/test/FakeDisposable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.test; 18 | 19 | import reactor.core.Disposable; 20 | import reactor.core.Scannable; 21 | 22 | /** 23 | * @author Simon Baslé 24 | */ 25 | public class FakeDisposable implements Disposable, Scannable { 26 | 27 | public volatile int disposed; 28 | 29 | @Override 30 | public boolean isDisposed() { 31 | return disposed > 0; 32 | } 33 | 34 | @Override 35 | public void dispose() { 36 | disposed++; 37 | } 38 | 39 | @Override 40 | public Object scanUnsafe(Attr key) { 41 | if (key == Attr.BUFFERED) return disposed; 42 | return null; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/test/ParameterizedTestWithName.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.test; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | import org.junit.jupiter.params.ParameterizedTest; 25 | 26 | /** 27 | * Meta-annotation that provides a better default for {@link ParameterizedTest} name. 28 | */ 29 | @ParameterizedTest(name="{displayName} [{index}] {argumentsWithNames}") 30 | @Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD }) 31 | @Retention(RetentionPolicy.RUNTIME) 32 | public @interface ParameterizedTestWithName { 33 | 34 | } 35 | -------------------------------------------------------------------------------- /reactor-core/src/test/java/reactor/test/publisher/FluxEmptySyncFuseable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.test.publisher; 18 | 19 | 20 | import reactor.core.CoreSubscriber; 21 | import reactor.core.Fuseable; 22 | import reactor.core.publisher.Flux; 23 | import reactor.util.annotation.Nullable; 24 | 25 | /** 26 | * @author Stephane Maldini 27 | */ 28 | final class FluxEmptySyncFuseable<T> extends Flux<T> implements Fuseable { 29 | 30 | @Override 31 | public void subscribe(CoreSubscriber<? super T> actual) { 32 | actual.onSubscribe(new SynchronousSubscription<T>() { 33 | @Override 34 | @Nullable 35 | public T poll() { 36 | return null; 37 | } 38 | 39 | @Override 40 | public int size() { 41 | return 0; 42 | } 43 | 44 | @Override 45 | public boolean isEmpty() { 46 | return true; 47 | } 48 | 49 | @Override 50 | public void clear() { 51 | 52 | } 53 | 54 | @Override 55 | public void request(long n) { 56 | 57 | } 58 | 59 | @Override 60 | public void cancel() { 61 | 62 | } 63 | }); 64 | actual.onComplete(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /reactor-core/src/test/resources/META-INF/services/org.junit.platform.launcher.LauncherSessionListener: -------------------------------------------------------------------------------- 1 | reactor.ReactorLauncherSessionListener 2 | -------------------------------------------------------------------------------- /reactor-core/src/test/resources/META-INF/services/org.junit.platform.launcher.TestExecutionListener: -------------------------------------------------------------------------------- 1 | reactor.ReactorTestExecutionListener -------------------------------------------------------------------------------- /reactor-core/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | <!-- 2 | ~ Copyright (c) 2011-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ https://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" BASIS, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | 17 | <configuration> 18 | 19 | <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"> 20 | <encoder> 21 | <pattern> 22 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 23 | </pattern> 24 | </encoder> 25 | </appender> 26 | 27 | <!--<logger name="reactor.core.publisher.tck" level="debug"/>--> 28 | <logger name="reactor" level="info"/> 29 | <logger name="wqp" level="off"/> 30 | <logger name="after-flatmap" level="debug"/> 31 | <logger name="logError.default" level="trace"/> 32 | <logger name="logError.fine" level="trace"/> 33 | <logger name="logError.finest" level="trace"/> 34 | 35 | <root level="info"> 36 | <appender-ref ref="stdout"/> 37 | </root> 38 | 39 | </configuration> -------------------------------------------------------------------------------- /reactor-core/src/withMicrometerTest/java/io/micrometer/scopedvalue/ScopeHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.micrometer.scopedvalue; 18 | 19 | import org.assertj.core.util.VisibleForTesting; 20 | 21 | // NOTE: This is a copy from the context-propagation library. Any changes should be 22 | // considered in the upstream first. Please keep in sync. 23 | 24 | /** 25 | * Thread-local storage for the current value in scope for the current Thread. 26 | */ 27 | public class ScopeHolder { 28 | 29 | private static final ThreadLocal<Scope> SCOPE = new ThreadLocal<>(); 30 | 31 | public static ScopedValue currentValue() { 32 | Scope scope = SCOPE.get(); 33 | return scope == null ? null : scope.scopedValue; 34 | } 35 | 36 | public static Scope get() { 37 | return SCOPE.get(); 38 | } 39 | 40 | static void set(Scope scope) { 41 | SCOPE.set(scope); 42 | } 43 | 44 | @VisibleForTesting 45 | public static void remove() { 46 | SCOPE.remove(); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /reactor-core/src/withMicrometerTest/java/reactor/core/publisher/MonoContextWriteRestoringThreadLocalsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020-2023 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.core.publisher; 18 | 19 | 20 | import org.junit.jupiter.api.Test; 21 | import reactor.core.Scannable; 22 | 23 | import static org.assertj.core.api.Assertions.assertThat; 24 | 25 | public class MonoContextWriteRestoringThreadLocalsTest { 26 | 27 | @Test 28 | public void scanOperator(){ 29 | MonoContextWriteRestoringThreadLocals<Integer> test = 30 | new MonoContextWriteRestoringThreadLocals<>(Mono.just(1), c -> c); 31 | 32 | assertThat(test.scan(Scannable.Attr.RUN_STYLE)).isSameAs(Scannable.Attr.RunStyle.SYNC); 33 | } 34 | } -------------------------------------------------------------------------------- /reactor-core/src/withMicrometerTest/java/reactor/util/MetricsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2025 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.util; 18 | 19 | import org.junit.jupiter.api.Test; 20 | 21 | import static org.assertj.core.api.Assertions.assertThat; 22 | 23 | /** 24 | * @author Simon Baslé 25 | */ 26 | @SuppressWarnings("deprecation") 27 | public class MetricsTest { 28 | 29 | @Test 30 | public void smokeTestMicrometerActiveInTests() { 31 | assertThat(Metrics.isInstrumentationAvailable()).isTrue(); 32 | Metrics.MicrometerConfiguration.getRegistry(); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /reactor-test/src/main/java/reactor/test/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Main test components supporting the testing and assertion of publishers. 19 | */ 20 | @NonNullApi 21 | package reactor.test; 22 | 23 | import reactor.util.annotation.NonNullApi; -------------------------------------------------------------------------------- /reactor-test/src/main/java/reactor/test/publisher/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Components supporting the creation of test-oriented 19 | * {@link org.reactivestreams.Publisher Publishers}. 20 | */ 21 | @NonNullApi 22 | package reactor.test.publisher; 23 | 24 | import reactor.util.annotation.NonNullApi; -------------------------------------------------------------------------------- /reactor-test/src/main/java/reactor/test/scheduler/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Components supporting the creation of test-oriented 19 | * {@link reactor.core.scheduler.Scheduler Schedulers}. 20 | */ 21 | @NonNullApi 22 | package reactor.test.scheduler; 23 | 24 | import reactor.util.annotation.NonNullApi; -------------------------------------------------------------------------------- /reactor-test/src/main/java/reactor/test/subscriber/ConditionalTestSubscriber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.test.subscriber; 18 | 19 | import reactor.core.Fuseable; 20 | 21 | /** 22 | * Simple interface for a {@link reactor.core.Fuseable.ConditionalSubscriber} variant of the 23 | * {@link TestSubscriber}. 24 | * 25 | * @author Simon Baslé 26 | */ 27 | public interface ConditionalTestSubscriber<T> extends TestSubscriber<T>, Fuseable.ConditionalSubscriber<T> { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /reactor-test/src/main/java/reactor/test/subscriber/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Components supporting the creation of test-oriented 19 | * {@link org.reactivestreams.Subscriber Subscribers}. 20 | */ 21 | @NonNullApi 22 | package reactor.test.subscriber; 23 | 24 | import reactor.util.annotation.NonNullApi; -------------------------------------------------------------------------------- /reactor-test/src/test/java/reactor/test/StepVerifierTimeoutTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.test; 18 | 19 | import java.time.Duration; 20 | 21 | import org.junit.jupiter.api.Test; 22 | import reactor.core.publisher.Mono; 23 | 24 | import static org.assertj.core.api.Assertions.assertThatExceptionOfType; 25 | 26 | public class StepVerifierTimeoutTests { 27 | 28 | @Test 29 | public void verifyThenAssert_failsAfterCustomTimeout() { 30 | assertThatExceptionOfType(AssertionError.class) 31 | .isThrownBy(() -> 32 | StepVerifier.create(Mono.delay(Duration.ofMillis(150))) 33 | .expectComplete() 34 | .verifyThenAssertThat(Duration.ofMillis(50))) 35 | .withMessageStartingWith("VerifySubscriber timed out"); 36 | } 37 | 38 | @Test 39 | public void verifyThenAssertUsesCustomTimeout() { 40 | try { 41 | StepVerifier.setDefaultTimeout(Duration.ofMillis(50)); 42 | 43 | Duration longerThanDefaultTimeout = Duration.ofMillis(150); 44 | StepVerifier.create(Mono.delay(longerThanDefaultTimeout)) 45 | .expectNext(0L) 46 | .expectComplete() 47 | .verifyThenAssertThat(Duration.ofMillis(250)); 48 | } finally { 49 | StepVerifier.resetDefaultTimeout(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /reactor-test/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | <!-- 2 | ~ Copyright (c) 2011-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ https://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" BASIS, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | 17 | <configuration> 18 | 19 | <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"> 20 | <encoder> 21 | <pattern> 22 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 23 | </pattern> 24 | </encoder> 25 | </appender> 26 | <logger name="reactor" level="info"/> 27 | 28 | <root level="info"> 29 | <appender-ref ref="stdout"/> 30 | </root> 31 | 32 | </configuration> -------------------------------------------------------------------------------- /reactor-tools/src/buildPluginTest/resources/mock-gradle/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | rootProject.name = 'bytebuddy-and-reactoragent' -------------------------------------------------------------------------------- /reactor-tools/src/buildPluginTest/resources/mock-gradle/src/main/java/demo/SomeClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package demo; 18 | 19 | import reactor.core.publisher.Flux; 20 | 21 | public class SomeClass { 22 | 23 | public Flux<Integer> obtainFlux() { 24 | return Flux.just(1); 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /reactor-tools/src/buildPluginTest/resources/mock-gradle/src/test/java/demo/SomeClassTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package demo; 18 | 19 | import org.junit.jupiter.api.Test; 20 | 21 | import reactor.core.Scannable; 22 | import reactor.core.publisher.Flux; 23 | 24 | import static org.assertj.core.api.Assertions.assertThat; 25 | import static org.assertj.core.api.InstanceOfAssertFactories.STRING; 26 | 27 | /** 28 | * This test assumes that the transformation is applied at build time 29 | * and does not manually install it. 30 | */ 31 | public class SomeClassTest { 32 | 33 | @Test 34 | public void shouldAddAssemblyInfo() { 35 | //the first level is instantiated from the production code, which is instrumented 36 | Flux<Integer> flux = new SomeClass().obtainFlux(); 37 | //the second level is instantiated here in test code, which isn't instrumented 38 | flux = flux.map(i -> i); 39 | 40 | Scannable scannable = Scannable.from(flux); 41 | 42 | assertThat(scannable.steps()) 43 | .hasSize(2) 44 | .endsWith("map") 45 | .first(STRING).startsWith("Flux.just ⇢ at demo.SomeClass.obtainFlux(SomeClass.java:"); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /reactor-tools/src/jarFileTest/java/reactor/tools/AbstractJarFileTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.tools; 18 | 19 | import java.net.URI; 20 | import java.nio.file.FileSystem; 21 | import java.nio.file.FileSystems; 22 | import java.nio.file.Path; 23 | import java.nio.file.Paths; 24 | 25 | import static java.util.Collections.emptyMap; 26 | 27 | /** 28 | * A helper class to access the content of a shaded JAR 29 | */ 30 | class AbstractJarFileTest { 31 | 32 | static Path root; 33 | 34 | static { 35 | try { 36 | Path jarFilePath = Paths.get(System.getProperty("jarFile")); 37 | URI jarFileUri = new URI("jar", jarFilePath.toUri().toString(), null); 38 | FileSystem fileSystem = FileSystems.newFileSystem(jarFileUri, emptyMap()); 39 | root = fileSystem.getPath("/"); 40 | } 41 | catch (Exception e) { 42 | throw new RuntimeException(e); 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /reactor-tools/src/javaAgentTest/java/reactor/tools/agent/ReactorDebugJavaAgentTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2021 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package reactor.tools.agent; 18 | 19 | import org.junit.jupiter.api.Test; 20 | import reactor.core.Scannable; 21 | import reactor.core.publisher.Flux; 22 | 23 | import static org.assertj.core.api.Assertions.assertThat; 24 | 25 | /** 26 | * This test assumes that the agent is added to the JVM as a Java Agent 27 | * and does not manually install it. 28 | */ 29 | public class ReactorDebugJavaAgentTest { 30 | 31 | @Test 32 | public void shouldAddAssemblyInfo() { 33 | int baseline = getBaseline(); 34 | Flux<Integer> flux = Flux.just(1); 35 | 36 | assertThat(Scannable.from(flux).stepName()) 37 | .startsWith("Flux.just ⇢ at reactor.tools.agent.ReactorDebugJavaAgentTest.shouldAddAssemblyInfo(ReactorDebugJavaAgentTest.java:" + (baseline + 1)); 38 | } 39 | 40 | @Test 41 | public void initIsNoOp() { 42 | ReactorDebugAgent.init(); 43 | } 44 | 45 | @Test 46 | public void processExistingClassesIsNoOp() { 47 | ReactorDebugAgent.processExistingClasses(); 48 | } 49 | 50 | private static int getBaseline() { 51 | return new Exception().getStackTrace()[1].getLineNumber(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011-2024 VMware Inc. or its affiliates, All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | plugins { 17 | id "org.gradle.toolchains.foojay-resolver-convention" version "1.0.0" 18 | } 19 | 20 | rootProject.name = 'reactor' 21 | 22 | include 'benchmarks', 'reactor-core', 'reactor-test', 'reactor-tools', 'reactor-core-micrometer' 23 | 24 | if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) { 25 | include 'docs' 26 | } 27 | 28 | dependencyResolutionManagement { 29 | versionCatalogs { 30 | libs { 31 | if (System.getProperty("useSnapshotMicrometerVersion")) { 32 | version('micrometer', '1.15.2-SNAPSHOT') 33 | version('micrometerDocsGenerator', "1.0.5-SNAPSHOT") 34 | version('micrometerTracingTest', "1.5.2-SNAPSHOT") 35 | version('contextPropagation', "1.1.4-SNAPSHOT") 36 | } 37 | } 38 | } 39 | } 40 | --------------------------------------------------------------------------------