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

james ahlborn (JIRA) jira-events at jboss.com
Wed Jan 10 22:39:27 EST 2007


    [ http://jira.jboss.com/jira/browse/JBAS-3972?page=comments#action_12350510 ] 
            
james ahlborn commented on JBAS-3972:
-------------------------------------

actually, that is not the only bug fix in the code.  the second bug was the incorrect synchronization.  the "serverSession.clone()" call needs to be made within the synchronized() block otherwise you could be reading the list while another thread is modifying it.

> 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