« Return to Thread: ConcurrentModificationException, Cannot begin a new event ... - reproducible

Re: ConcurrentModificationException, Cannot begin a new event ... - reproducible

by Holger Brands :: Rate this Message:

Reply to Author | View in Thread

 > Is this the expected behavior?

Yes, with the current implementation, that's expected.
If you dive into the implementation you'll see this:

    public E set(int index, E element) {
        // create the change event
        updates.beginEvent();
        // do the actual set
        E previous = data.set(index, element);
        // fire the event
        updates.elementUpdated(index, previous);
        updates.commitEvent();
        return previous;
    }

Event delivery is guarded by calls to
ListEventAssembler.beginEvent() - start recording changes
and
ListEventAssembler.commitEvent() - propagate recorded changes

When an uncaught exception is thrown inbetween, commitEvent()
is never called and no change events are fired.
With the next call to beginEvent() the ListEventAssembler detects,
that an event delivery is in progress leading to the ConcurrentModificationExceptions
you observed.

Holger
__________________________________________________________________________
Verschicken Sie SMS direkt vom Postfach aus - in alle deutschen und viele
ausländische Netze zum gleichen Preis!
https://produkte.web.de/webde_sms/sms




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

 « Return to Thread: ConcurrentModificationException, Cannot begin a new event ... - reproducible