Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,18 @@ public void clientCloseConnection(@Context SseEventSink sink, @PathParam("id") f
Thread.sleep(500);
localBroadcaster.broadcast(createEvent(builder.name("book"), id + 4))
.whenComplete((r, ex) -> {
// we expect the sink to be closed at this point
if (ex != null || !sink.isClosed()) {
// Count only an unexpected successful delivery after client close.
if (ex == null && !sink.isClosed()) {
stats.inc();
}
});

stats.setWasClosed(sink.isClosed());
phaser.arriveAndDeregister();

sink.close();
try {
sink.close();
} finally {
stats.setWasClosed(sink.isClosed());
phaser.arriveAndDeregister();
}
} catch (final InterruptedException ex) {
LOG.error("Communication error", ex);
} catch (final IOException ex) {
Expand Down
Loading