CAMEL-10612: fix mono publisher issue on recursive calls
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/dd25dcca Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/dd25dcca Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/dd25dcca Branch: refs/heads/master Commit: dd25dcca6108ad17ccde9e1cc485d16ca805837a Parents: 18b0c49 Author: Nicola Ferraro <ni.ferr...@gmail.com> Authored: Fri Feb 3 17:04:55 2017 +0100 Committer: Nicola Ferraro <ni.ferr...@gmail.com> Committed: Fri Feb 3 18:41:41 2017 +0100 ---------------------------------------------------------------------- .../camel/component/reactive/streams/util/MonoPublisher.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/dd25dcca/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/util/MonoPublisher.java ---------------------------------------------------------------------- diff --git a/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/util/MonoPublisher.java b/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/util/MonoPublisher.java index d0be491..3631a71 100644 --- a/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/util/MonoPublisher.java +++ b/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/util/MonoPublisher.java @@ -43,8 +43,10 @@ public class MonoPublisher<T> implements Publisher<T> { @Override public void request(long l) { if (terminated) { - throw new IllegalStateException("The subscription is terminated"); + // subscription is terminated, ignore + return; } + terminated = true; if (l <= 0) { subscriber.onError(new IllegalArgumentException("3.9")); @@ -52,7 +54,6 @@ public class MonoPublisher<T> implements Publisher<T> { subscriber.onNext(item); subscriber.onComplete(); } - terminated = true; } @Override