[jboss-jira] [JBoss JIRA] Updated: (JBAS-3972) incorrect synchronization in JmsServerSessionPool

Adrian Brock (JIRA) jira-events at jboss.com
Wed Jan 10 09:30:27 EST 2007


     [ http://jira.jboss.com/jira/browse/JBAS-3972?page=all ]

Adrian Brock updated JBAS-3972:
-------------------------------

           Component/s: JCA service
                            (was: JMS service)
              Assignee: Weston Price  (was: Adrian Brock)
     Original Estimate:     (was: 1 hour)
    Remaining Estimate:     (was: 1 hour)

This is a bug, the fix above is described by the diff

-JmsServerSession session = (JmsServerSession) serverSessions.get(i);
+JmsServerSession session = (JmsServerSession) clonedSessions.get(i);

However, it would probably be better to just use a CopyOnWriteArrayList
(which will do the cloning internally)?
All this code is doing is avoiding a ConcurrentModificationException on the iterator
if somebody decides to undeploy/shutdown the MDB while it is still being deployed/initalised.

In fact, this situation is most likely to occur if the ExceptionListener is invoked by the JMS provider
during deployment.

> incorrect synchronization in JmsServerSessionPool
> -------------------------------------------------
>
>                 Key: JBAS-3972
>                 URL: http://jira.jboss.com/jira/browse/JBAS-3972
>             Project: JBoss Application Server
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: JCA service
>    Affects Versions: JBossAS-4.0.5.GA
>            Reporter: james ahlborn
>         Assigned To: Weston Price
>            Priority: Minor
>
> the code within connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsServerSessionPool.java setupSessions() incorrectly synchronizes on the serverSessions (serverSessions is used on lines 202 and 205 outside the synch block).  the method should look like (starting at line 190):
>       // Create the sessions
>       ArrayList clonedSessions = null;
>       synchronized (serverSessions)
>       {
>          for (int i = 0; i < spec.getMaxSessionInt(); ++i)
>          {
>             JmsServerSession session = new JmsServerSession(this);
>             serverSessions.add(session);
>          }
>          sessionCount = serverSessions.size();
>          clonedSessions = (ArrayList) serverSessions.clone();
>       }
>       // Start the sessions
>       for (int i = 0; i < clonedSessions.size(); ++ i)
>       {
>          JmsServerSession session = (JmsServerSession) clonedSessions.get(i);
>          session.setup();
>       }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list