From dfe2afa4837b3369d5a1229000f93f68c3889dea Mon Sep 17 00:00:00 2001 From: Foobartender Date: Wed, 1 Feb 2023 03:02:51 +0100 Subject: [PATCH] Remove duplicate notification of SseBroadcaster's onErrorListeners Follow-up to #30686 (cherry picked from commit 5691787d01b917919f44b01bc87f0e72ffa2c9ef) --- .../reactive/server/jaxrs/SseBroadcasterImpl.java | 7 ------- .../reactive/server/jaxrs/SseEventSinkImpl.java | 10 +--------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/SseBroadcasterImpl.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/SseBroadcasterImpl.java index 1700f89b43a93..190ae1c5aa3a8 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/SseBroadcasterImpl.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/SseBroadcasterImpl.java @@ -120,11 +120,4 @@ synchronized void fireClose(SseEventSinkImpl sseEventSink) { listener.accept(sseEventSink); } } - - synchronized void fireException(SseEventSinkImpl sseEventSink, Throwable t) { - for (BiConsumer listener : onErrorListeners) { - listener.accept(sseEventSink, t); - } - } - } diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/SseEventSinkImpl.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/SseEventSinkImpl.java index faed79cdc9788..a86ca5d00ab22 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/SseEventSinkImpl.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/SseEventSinkImpl.java @@ -32,15 +32,7 @@ public CompletionStage send(OutboundSseEvent event) { if (isClosed()) throw new IllegalStateException("Already closed"); // NOTE: we can't cast event to OutboundSseEventImpl because the TCK sends us its own subclass - CompletionStage ret = SseUtil.send(context, event, Collections.emptyList()); - if (broadcaster != null) { - return ret.whenComplete((value, x) -> { - if (x != null) { - broadcaster.fireException(this, x); - } - }); - } - return ret; + return SseUtil.send(context, event, Collections.emptyList()); } @Override