From 0ab5620c3ebdeb312cd70e88d0c84acda9573655 Mon Sep 17 00:00:00 2001 From: Alex Tymchenko Date: Sat, 31 Aug 2019 15:29:08 +0300 Subject: [PATCH] Notify the batch delivery listener in any case. --- .../java/io/spine/server/delivery/TargetDelivery.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/io/spine/server/delivery/TargetDelivery.java b/server/src/main/java/io/spine/server/delivery/TargetDelivery.java index 2ff8d34f6a1..082ca453ff6 100644 --- a/server/src/main/java/io/spine/server/delivery/TargetDelivery.java +++ b/server/src/main/java/io/spine/server/delivery/TargetDelivery.java @@ -160,10 +160,13 @@ private void deliverVia(BatchDeliveryListener dispatcher, @SuppressWarnings("unchecked") // Only IDs of type `I` are stored. I id = (I) Identifier.unpack(packedId); dispatcher.onStart(id); - for (InboxMessage message : messages) { - doDeliver(cmdDispatcher, eventDispatcher, message); + try { + for (InboxMessage message : messages) { + doDeliver(cmdDispatcher, eventDispatcher, message); + } + } finally { + dispatcher.onEnd(id); } - dispatcher.onEnd(id); } else { doDeliver(cmdDispatcher, eventDispatcher, messages.get(0)); }