commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Baltz, Kenneth" <Kba...@firstam.com>
Subject RE: CursorableLinkedList ConcurrentModificationException
Date Fri, 28 Feb 2003 20:44:42 GMT
I don't know anything about your specific situation, but I do know that
ConcurrentModificationExceptions can happen even in single-threaded
environments.  The biggest culprit is changing the collection the iter is
based on while you're iterating.  Remove(), add(), these are generally
forbidden and will cause this exception the next time next() is called.  

Hope that helps.

K.C.

> -----Original Message-----
> From: Lee Breisacher [mailto:LBreisacher@seagullsw.com]
> Sent: Friday, February 28, 2003 9:32 AM
> To: commons-user@jakarta.apache.org
> Subject: CursorableLinkedList ConcurrentModificationException
> 
> 
> I just ran into this error:
> 
> java.util.ConcurrentModificationException
>  	at
> java.util.AbstractList$Itr.checkForComodification(AbstractList
.java:444)
>  	at java.util.AbstractList$Itr.next(AbstractList.java:421)
> 	at
> org.apache.commons.collections.CursorableLinkedList.broadcastL
> istableInserte
> d(Unknown Source)
>  	at
> org.apache.commons.collections.CursorableLinkedList.insertList
> able(Unknown
> Source)
>  	at
> org.apache.commons.collections.CursorableLinkedList.addFirst(U
> nknown Source)
>  	at
> org.apache.commons.pool.impl.GenericObjectPool.returnObject(Un
> known Source)
> 
> Unfortunately, I do not have stack traces for the other 
> threads that were
> running, so I don't know what some other thread must have 
> been doing to
> cause this. But, looking at GenericObjectPool, it appears to 
> be properly
> synchronized at all the places that operate on the 
> CursorableLinkedList (its
> _pool variable), so I don't quite understand how this error can occur.
> Anyway, does this look like a bug in CursorableLinkedList?  
> Has anyone seen
> this before and know of a fix/workaround?
> 
> Thanks,
> 
> Lee
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message