Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-18 Thread Jörg Schaible
Renè Glanzer wrote at Mittwoch, 17. Juni 2009 20:09: I only gave it a short test. Then i found the MapIterator in the docs an switched to it. The docs stated that MapIterator is the better way than entrySet. Sorry for this, I'm at home right now so i can test it with an entrySet at the

Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-17 Thread Renè Glanzer
@commons.apache.org Sent: Tuesday, June 16, 2009 6:05:26 AM Subject: Re: [collections] LRUMap Problem ConcurrentModificationException Hey Otis, i found this one: https://issues.apache.org/jira/browse/COLLECTIONS-3 but there is no solutions only an assumption at the end of the thread?? René

Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-17 Thread Jörg Schaible
Hi Renè, Renè Glanzer wrote at Mittwoch, 17. Juni 2009 09:47: OK so my search will continue :-) Meanwhile I'll consider to change my implementation, which i'd like to prevent. I've reopened COLLECTIONS-3, since I was able to write a unit test that reproduces the problem. Maybe somebody of

Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-17 Thread Renè Glanzer
Hi Jörg, that are great news, I'll give it a try. And of course I'll report my experience. René 2009/6/17 Jörg Schaible joerg.schai...@gmx.de Hi Renè, Renè Glanzer wrote at Mittwoch, 17. Juni 2009 09:47: OK so my search will continue :-) Meanwhile I'll consider to change my

Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-17 Thread Jörg Schaible
Renè Glanzer wrote at Mittwoch, 17. Juni 2009 11:48: Hi Jörg, that are great news, I'll give it a try. And of course I'll report my experience. That would be fine. Actually I opened an own JIRA issue for this now (COLLECTION-330), COLLECTION-3 was simply too vague and had a too long history

Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-17 Thread Renè Glanzer
Hi Jörg, it's me again. With a smile on my face :-) I changed my code according to your hint. Now i don't use the keySet but the entrySet. With only to adopt the rest of the method to the entrySet and still calling the remove() method of the iterator in my tests no

Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-17 Thread Renè Glanzer
Hi, it's me again with an update. the LRUMap.mapIterator() still produces the ConcurrentModificationException when a call to MapIterator.remove() occurs. Maybe this info helps René 2009/6/17 Renè Glanzer rene.glan...@gmail.com: Hi Jörg, it's me again. With a smile on my face :-) I changed

Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-17 Thread Leon Rosenberg
why don't you just use softreference + expiration timestamp and save all the trouble? Leon On Wed, Jun 17, 2009 at 4:07 PM, Renè Glanzerrene.glan...@gmail.com wrote: Hi, it's me again with an update. the LRUMap.mapIterator() still produces the ConcurrentModificationException when a call to

Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-17 Thread Leon Rosenberg
Well, I hope your hash function is well thought through :-) otherwise using hashmap for caching might be a mess On Wed, Jun 17, 2009 at 4:30 PM, Renè Glanzerrene.glan...@gmail.com wrote: I was searching for a very lighweight cache systems with not much overhead for my purposes. The LRUMap

Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-17 Thread Jörg Schaible
Renè Glanzer wrote at Mittwoch, 17. Juni 2009 16:07: Hi, it's me again with an update. the LRUMap.mapIterator() still produces the ConcurrentModificationException when a call to MapIterator.remove() occurs. So did you also try with the entrySet? I've not written a unit test for the

Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-17 Thread Renè Glanzer
I only gave it a short test. Then i found the MapIterator in the docs an switched to it. The docs stated that MapIterator is the better way than entrySet. Sorry for this, I'm at home right now so i can test it with an entrySet at the earliest tomorrow. Looking forward to report the result.

Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-16 Thread Renè Glanzer
Hi, I'm using the one from the map package my import looks like this: import org.apache.commons.collections.map.LRUMap; As I've seen the LRUMap outside the map package is deprecated. René 2009/6/15 Leon Rosenberg rosenberg.l...@googlemail.com: weird enough there are two LRUMap classes in

Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-16 Thread Renè Glanzer
] LRUMap Problem ConcurrentModificationException Yes of course, the code with the time based cache systems was set up with an ordniary HashMap. But when rapidly seach requests are generated the time based mechanism fails to delete old entries - cause they are not old enough - and so the cache

Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-16 Thread Otis Gospodnetic
user@commons.apache.org Sent: Tuesday, June 16, 2009 6:05:26 AM Subject: Re: [collections] LRUMap Problem ConcurrentModificationException Hey Otis, i found this one: https://issues.apache.org/jira/browse/COLLECTIONS-3 but there is no solutions only an assumption at the end of the thread

Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-15 Thread Renè Glanzer
Hello, is there still no help for me? Is somebody able to explain me, why i get this java.util.ConcurrentModificationException on iterating and calling remove() on the LRUMap? Please René 2009/6/10 Renè Glanzer rene.glan...@gmail.com: Hello Ted, thanks for the fast response. I understand

Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-15 Thread Renè Glanzer
I'm calling the remove() method on the iterator. I know when i call the remove on the map itself it will cause the problem with my currently running iterator, but i'm aware of that. Here is the code block which should delete old entries: store: is the LRUMap birth: is a long which keeps the

Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-15 Thread Leon Rosenberg
Hello, on a side note, generics make reading of code easier :-) you haven't posted the whole code, but have you (double)checked that all other acesses to store are synchronized? regards Leon On Mon, Jun 15, 2009 at 2:31 PM, Renè Glanzerrene.glan...@gmail.com wrote: I'm calling the remove()

Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-15 Thread Leon Rosenberg
just out of curiosity have you tried the same code with a standard hashmap? Leon On Mon, Jun 15, 2009 at 4:37 PM, Renè Glanzerrene.glan...@gmail.com wrote: Hello, side note accepted :-) In my class I checked the get, put and remove methods. All are synchronized. As you can see also the

Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-15 Thread Otis Gospodnetic
@commons.apache.org Sent: Monday, June 15, 2009 12:00:54 PM Subject: Re: [collections] LRUMap Problem ConcurrentModificationException Yes of course, the code with the time based cache systems was set up with an ordniary HashMap. But when rapidly seach requests are generated the time based mechanism

[collections] LRUMap Problem ConcurrentModificationException

2009-06-09 Thread Renè Glanzer
Hello, I us a LRUMap for caching search results from the database. To limit the maximum number of searches cached i store them in a LRUMap. Also the timestamp when the entry was put to the map is stored. Additionally to the maximum number of the LRUMap i also implemented a thread which periodicly

Re: [collections] LRUMap Problem ConcurrentModificationException

2009-06-09 Thread Ted Dunning
I apologize for not reading your thread with great care, but I think that your problem is pretty clear. The issue is not to do with gets and puts overlapping. The issue is that a put or remove happened during the life of your iterator. One way to avoid this is to synchronize the entire method