From f9b912baf02eb2dad76e3ab4dfb00f3eeeb8aff7 Mon Sep 17 00:00:00 2001 From: Yashashree Chopada Date: Thu, 22 Aug 2024 00:53:41 +0530 Subject: [PATCH] ARTEMIS-4972 Use Lock in start() for Binding Variables --- .../core/server/group/impl/LocalGroupingHandler.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java index d34f587dd8..6fbdbbb508 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java @@ -322,9 +322,15 @@ public final class LocalGroupingHandler extends GroupHandlingAbstract { if (started) return; - if (expectedBindings == null) { - // just in case the component is restarted - expectedBindings = new LinkedList<>(); + lock.lock(); + + try { + if (expectedBindings == null) { + // just in case the component is restarted + expectedBindings = new LinkedList<>(); + } + } finally { + lock.unlock(); } if (reaperPeriod > 0 && groupTimeout > 0) {