Fix race condition for FluxMessageChannelTests

The logic in the `FluxMessageChannelTests.testFluxMessageChannelCleanUp()`
relies on the `finishLatch.countDown()` which happens before we
release the lock for a group in the aggregator.
So, when we call a `destroy()` as the next statement, we interrupt
the lock instead of unlocking.
This cause a race condition in the Reactor's `Sink` to terminate properly

* Expose `CorrelationHandlerSpec.releaseLockBeforeSend()` and set it to `true`
in the test to properly unlock before we call `finishLatch.countDown()`
* Deprecate a couple introduced before options in favor of their variants
with `set` prefix
* Fix new Sonar smells
This commit is contained in:
Artem Bilan
2021-02-08 10:33:01 -05:00
parent 338a26d34d
commit d55d8402d9
4 changed files with 49 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 the original author or authors.
* Copyright 2016-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -127,7 +127,7 @@ public class FluxMessageChannelTests {
IntegrationFlow testFlow = f -> f
.<String>split(__ -> Flux.fromStream(IntStream.range(0, 100).boxed()), null)
.channel(flux)
.aggregate(a -> a.releaseStrategy(m -> m.size() == 100))
.aggregate(a -> a.releaseStrategy(m -> m.size() == 100).releaseLockBeforeSend(true))
.handle(__ -> finishLatch.countDown());
IntegrationFlowContext.IntegrationFlowRegistration flowRegistration =