[ 
https://issues.apache.org/jira/browse/ARTEMIS-4923?focusedWorklogId=925697&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-925697
 ]

ASF GitHub Bot logged work on ARTEMIS-4923:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 12/Jul/24 19:44
            Start Date: 12/Jul/24 19:44
    Worklog Time Spent: 10m 
      Work Description: tabish121 commented on code in PR #5087:
URL: https://github.com/apache/activemq-artemis/pull/5087#discussion_r1676384995


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java:
##########
@@ -719,10 +671,18 @@ public void activated() {
             }
          }
       });
+
+      started = true;
    }
 
    @Override
    public synchronized void stop() throws Exception {
+      if (!started) {

Review Comment:
   Similar to above this doesn't really prevent concurrent calls to stop for 
overlapping so this also needs to be idempotent.  There is also the concern 
that start / stop calls can run concurrently now which could leave this in an 
odd state if not handled.  



##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java:
##########
@@ -692,16 +644,16 @@ public SimpleString getManagementNotificationAddress() {
       return managementNotificationAddress;
    }
 
-   // ActiveMQComponent implementation -----------------------------
-
    @Override
-   public void start() throws Exception {
+   public synchronized void start() throws Exception {
+      if (started) {

Review Comment:
   This is a lot less protection than before for concurrent calls to start 
since you aren't using an atomic operation to compare and set so you can get 
two concurrent start calls competing in here.  Would depend a lot on whether 
the call is idempotent.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 925697)
    Time Spent: 20m  (was: 10m)

> Reduce synchronization in ManagementServiceImpl
> -----------------------------------------------
>
>                 Key: ARTEMIS-4923
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-4923
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>            Reporter: Justin Bertram
>            Assignee: Justin Bertram
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> The {{ManagementService}} is used by the broker to register and unregister 
> components for management as well as send notifications. When the broker is 
> busy dealing with new sessions and auto-creating queues, addresses, etc. 
> there is a lot of contention in this service. However, much of the 
> synchronization can be removed completely or replaced with more efficient 
> thread-safe underlying data structures.



--
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


Reply via email to