[ 
https://issues.apache.org/jira/browse/AMQ-9376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17784445#comment-17784445
 ] 

ASF subversion and git services commented on AMQ-9376:
------------------------------------------------------

Commit f9e28b916a5e8b3ad78672d538c08a2cb1f9304a in activemq's branch 
refs/heads/activemq-5.18.x from Matt Pavlovich
[ https://gitbox.apache.org/repos/asf?p=activemq.git;h=f9e28b916 ]

[AMQ-9376] Fix ConcurrentModificationException during a destroy()

(cherry picked from commit 19696254dddf169fa62d502a53fa0351bad3d080)


> Fix concurrent modification in ActiveMQServiceFactory
> -----------------------------------------------------
>
>                 Key: AMQ-9376
>                 URL: https://issues.apache.org/jira/browse/AMQ-9376
>             Project: ActiveMQ
>          Issue Type: Bug
>            Reporter: Matt Pavlovich
>            Assignee: Matt Pavlovich
>            Priority: Minor
>             Fix For: 6.0.0, 5.18.4, 5.17.7
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Need a class instance level lock or duplicate list around the broker map when 
> doing a .destroy() caused by bundle refesh
> Calling .destroy() loops over a map which calls deleted.. which fails when 
> there is more than one bundle and the bundle is shutdown first (not a 
> service(s) removed via .cfg delete or osgi service shutdown lifecycle).
> #1. OSGi calls.. 
> {noformat}
>     synchronized public void destroy() {
>         for (String broker : brokers.keySet()) {
>             deleted(broker);
>         }
>     }
> {noformat}
> #2. Which blows up here.. due to concurrent modification on the _brokers_ 
> collection
> {noformat}
>     @Override
>     synchronized public void deleted(String pid) {
>         ServiceRegistration<BrokerService> reg = brokerRegs.remove(pid);
>         if (reg != null) {
>             reg.unregister();
>         }
>         BrokerService broker = brokers.remove(pid);
>         if (broker != null) {
>             stop(pid, broker);
>         }
>     }
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to