INT-4510: Test no memory leak in FluxMessageCh

JIRA: https://jira.spring.io/browse/INT-4510

Related to https://github.com/reactor/reactor-core/issues/1290

The `Flux.publish()` and subsequent `connect()` doesn't fuse a subscriber
for the hooks flow is interrupted (complete, or error, or disconnect).
In this case the `FluxMessageChannel.publishers` store is not cleared
from the finished publishers

* Add test-case to check the `FluxMessageChannel.publishers` store after
finishing the stream
* Add `hide()` operator with TODO to remove when an appropriate Reactor
version is ready

**Cherry-pick to 5.0.x**
This commit is contained in:
Artem Bilan
2018-07-26 20:12:12 -04:00
committed by Gary Russell
parent 8b13b2861d
commit 8c03d72e2d
2 changed files with 38 additions and 2 deletions

View File

@@ -84,6 +84,7 @@ public class FluxMessageChannel extends AbstractMessageChannel
.handle((message, sink) -> sink.next(send(message)))
.errorStrategyContinue()
.doOnComplete(() -> this.publishers.remove(publisher))
.hide() // TODO remove after upgrade to Reactor 3.1.9.RELEASE or later
.publish();
this.publishers.put(publisher, connectableFlux);