[
https://issues.apache.org/jira/browse/ARTEMIS-4972?focusedWorklogId=930601&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-930601
]
ASF GitHub Bot logged work on ARTEMIS-4972:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 16/Aug/24 13:28
Start Date: 16/Aug/24 13:28
Worklog Time Spent: 10m
Work Description: tabish121 commented on code in PR #5152:
URL: https://github.com/apache/activemq-artemis/pull/5152#discussion_r1719843024
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java:
##########
@@ -322,11 +322,19 @@ public synchronized void start() throws Exception {
if (started)
return;
- if (expectedBindings == null) {
- // just in case the component is restarted
- expectedBindings = new LinkedList<>();
+ try
+ {
+ lock.lock();
Review Comment:
The attempt to lock is normally placed outside the try as you don't want the
finally to attempt to unlock a lock if the caller fails to acquire the lock in
the first place.
Issue Time Tracking
-------------------
Worklog Id: (was: 930601)
Time Spent: 20m (was: 10m)
> The start() method should use a lock to access the expected binding variables.
> ------------------------------------------------------------------------------
>
> Key: ARTEMIS-4972
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4972
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Reporter: Suhov Roman
> Priority: Major
> Time Spent: 20m
> Remaining Estimate: 0h
>
> File:
> [https://github.com/apache/activemq-artemis/blob/2.36.0/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java]
> Line: 325 - 327
>
> The start() method should use a lock to access the expectedBindings variable
> to ensure thread safety, since other methods use the lock and interact with
> expectedBindings at the same time.
> Using the lock in the start() method ensures that access to the
> expectedBindings variable is safe in a multi-threaded environment, preventing
> potential thread contention issues.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact