[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjms-developer
Subject:    [openjms-developer] [ openjms-Bugs-1144026 ] ConcurrentModificationException in TopicDestinationCach
From:       "SourceForge.net" <noreply () sourceforge ! net>
Date:       2005-02-18 20:02:08
Message-ID: E1D2EKG-0003pN-Lh () sc8-sf-web2 ! sourceforge ! net
[Download RAW message or body]

Bugs item #1144026, was opened at 2005-02-18 15:02
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=1144026&group_id=54559

Category: server
Group: v0.7.6.1
Status: Open
Resolution: None
Priority: 5
Submitted By: pbezi (pbezi)
Assigned to: Nobody/Anonymous (nobody)
Summary: ConcurrentModificationException in TopicDestinationCache

Initial Comment:
SYMPTOMS:

A java.util.ConcurrentModificationException (see below 
for the stack trace) is being thrown in the 
resolveExpiredMessage(MessageHandle handle) method 
of the 
org.exolab.jms.messagemgr.TopicDestinationCache class.

FOUND CAUSE:

The exception is thrown because the _consumers 
java.util.List object is being accessed in the 
multithreaded environment via the iterator in an 
unsynchronized block.
The protected _consumers member variable is declared 
in the parent class of 
org.exolab.jms.messagemgr.TopicDestinationCache - 
org.exolab.jms.messagemgr.DestinationCache as follows:

protected List _consumers =
        Collections.synchronizedList(new LinkedList());

This does not guarantee a thread safe access to the 
_consumers List object via the iterator obtained from 
the List.

RESOLUTION:

Modify the source code of the resolveExpiredMessage
(MessageHandle handle) method of the 
TopicDestinationCache class to include the iteration 
code in the synchronization block, synchronized on the 
list object:

synchronized (_consumers) {
// ..... iterate over _consumers

}

EXCEPTION STACK TRACE:
==========================================
java.util.ConcurrentModificationException

        at 
java.util.LinkedList$ListItr.checkForComodification
(LinkedList.java:548)

        at java.util.LinkedList$ListItr.next
(LinkedList.java:484)

        at 
org.exolab.jms.messagemgr.TopicDestinationCache.resolv
eExpiredMessage(TopicDestinationCache.java:381)

        at 
org.exolab.jms.messagemgr.DestinationCache.onLeaseExp
ired(DestinationCache.java:398)

        at 
org.exolab.jms.messagemgr.MessageLeaseHelper.onLease
Expired(MessageLeaseHelper.java:266)

        at 
org.exolab.jms.lease.BaseLease.notifyLeaseExpired
(BaseLease.java:161)

        at org.exolab.jms.lease.LeaseManager.expire
(LeaseManager.java:291)

        at org.exolab.jms.lease.LeaseManager.run
(LeaseManager.java:246)

        at java.lang.Thread.run(Thread.java:536)
==========================================

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=1144026&group_id=54559


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
openjms-developer mailing list
openjms-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openjms-developer
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic