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
ConcurrentModificationException occured!!

Additionally now I'm using the LURMap.mapIterator() which also performs well
and according to the docu should be prefered over the entrySet or keySet.

Now the new an well working code looks like this:

public void removeAllExpiredItems()
  {
    synchronized(this.store)
    {
      MapIterator it=this.store.mapIterator(); //Here I'm using the new
MapIterator
      while(it.hasNext())
      {
        m_catLog.debug("Reading object");
        Object key=it.next();
        Item currentItem=(Item)it.getValue();
        if(currentItem.birth==0)
        {
          m_catLog.debug("0 birth found for key "+key+" calling
Iterator.remove");
          it.remove();
        }
      }
      this.setLastCleanDate(new Date());
    }
  }

Thousand Thanks for your help Jörg
this fixed my Problem and maybe also fixes the problems from the other
people who suffered the same problem.
Furthermore I'm pleased to see that the JIRA issue COLLECTION-330 is
handling the problem with the keySet call.

2009/6/17 Jörg Schaible <[email protected]>

> 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 of different symptoms.
>
> - Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to