Found it.  Fixed it.  I had actually looked right at it recently, and not
seen it.

Here is the code:

    public Iterator list() {
        // Fix ConcurrentModificationException by cloning
        // the keyset before getting an iterator
        final HashSet clone = new HashSet();
        clone.addAll( keys );
        return clone.iterator();
    }

Well, then you look at the definition of keys:

        keys = Collections.synchronizedSet(new HashSet());

No problem.  Everything is synchronized.

WRONG!  The addAll operation isn't synchronized against the collection
passed as a parameter!  Each atomic operation on it was synchronized, but
not the clone!

        --- Noel

-----Original Message-----
From: Noel J. Bergman [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 08, 2003 2:41
To: James-Dev Mailing List
Cc: Avalon Developers List
Subject: RE: [EXCALIBUR] threads - ConcurrentModificationException


Stephen,

LOL!  Thank you, thank you!

I have been looking for that exception.  It had been previously marked as
"impossible", and the exception was discarded.  I fixed that just the other
day.  Now I can try to find and fix the bugger.

        --- Noel

-----Original Message-----
From: Stephen McConnell [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 08, 2003 2:05
To: Avalon Dev
Subject: [EXCALIBUR] threads - ConcurrentModificationException



A java.util.ConcurrentModificationException is occured while
running James with the excalibur-thread-1.1.jar.
I'm guessing this is a result of recent changes. Any ideas?

Cheers, Steve.


[INFO   ] (container.smtp): Connection from localhost (127.0.0.1)
[ERROR  ] (container.mailstore): CME in spooler - please report to
http://james.apache.org
java.util.ConcurrentModificationException
     at java.util.HashMap$HashIterator.nextEntry(HashMap.java:762)
     at java.util.HashMap$KeyIterator.next(HashMap.java:798)
     at java.util.AbstractCollection.addAll(AbstractCollection.java:315)
     at
org.apache.james.mailrepository.AvalonMailRepository.list(AvalonMailReposito
ry.java:389)
     at
org.apache.james.mailrepository.AvalonSpoolRepository.accept(AvalonSpoolRepo
sitory.java:47)
     at
org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:268)
     at
org.apache.excalibur.thread.impl.ExecutableRunnable.execute(ExecutableRunnab
le.java:90)
[INFO   ] (container.smtp): Successfully spooled mail from
postmaster@localhost for [test@localhost]
[INFO   ] (container.smtp): Successfully spooled mail from
postmaster@localhost for [test@localhost]


--

Stephen J. McConnell
mailto:[EMAIL PROTECTED]
http://www.osm.net


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to