On 14 Mar 2008, at 06:49, David Jencks wrote:

While fixing https://issues.apache.org/activemq/browse/AMQ-1618 I noticed that although there are some half-hearted attempts to look like there's thread safety in this method (use of CopyOnWriteArrayList) actually its completely unsafe.

For instance

       if (idleSessions.size() > 0) {
ServerSessionImpl ss = idleSessions.remove(idleSessions.size() - 1);

executed by 2 threads can easily result in one getting an index out of bounds error or one trying to remove a server session from an empty list.

Before I look at fixing it could anyone confirm that in fact this method should be thread safe?

thanks
david jencks

Hi David,

yes - this class should be thread safe - If I remember correctly this class was subject to alot of contention - often resulting in deadlocks - will attempt to fix - and let you verify ;)


cheers,

Rob

http://open.iona.com/ -Enterprise Open Integration
http://rajdavies.blogspot.com/



Reply via email to