|
From: Jan H. <jh...@sc...> - 2007-09-11 06:47:26
|
The simpleApplicationEventMulticaster has a TaskExecutor property which
handles the event casting. You can opt to use a SyncTaskExecutor here to
have your events handled synchronously.
Besides this, the concurrentModificationException might have nothing to
do with threading. It's possible that while events are cast, one of the
listeners is changing(adding/removing) the listener list of the
multicaster.
As for the gui updating, I'm guessing your different threads do gui
updating on the EDT (as it should be). So these are already
synchronized.
Kind Regards,
Jan
On Mon, 2007-09-10 at 16:12 +0100, Benoit Xhenseval wrote:
> Hi *,
>
>
>
> First of all, many thanks for considering the Readony interceptor!
> That is super to have an official implementation.
>
>
>
> I have just experienced the following problem a couple of times:
>
>
>
> java.util.ConcurrentModificationException
> java.util.ConcurrentModificationException
> at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(LinkedHashMap.java:365)
> at java.util.LinkedHashMap$KeyIterator.next(LinkedHashMap.java:376)
> at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:74)
> at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:246)
> at net.xxxxx.gui.domain.BusinessEventConsumer$2.run(BusinessEventConsumer.java:207)
> at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
> at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
> at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
> at sun.reflect.GeneratedMethodAccessor125.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at foxtrot.pumps.ConditionalEventPump.pumpEvents(ConditionalEventPump.java:98)
> at foxtrot.AbstractSyncWorker.post(AbstractSyncWorker.java:98)
> at foxtrot.AbstractSyncWorker.post(AbstractSyncWorker.java:124)
> at foxtrot.Worker.post(Worker.java:139)
> at net.xxxxxx.gui.dao.AbstractRemoteDao.executeBlockingJobInBackground(AbstractRemoteDao.java:89)
>
>
>
> My application may have more than 1 thread updating the GUI. As far as
> I can see, there is a scenario in my app where the server triggers a
> refresh on the GUI and the dispatching thread also tries to send an
> event.
>
>
>
> Is there any reason why the
> SimpleApplicationEventMulticaster.multicastEvent is not synchronized?
> Should it be?
>
> Should the synchronization be done via the
> AbstractApplicationContext.publishEvent?
>
>
>
> I believe that some form of synchronization is required and that it
> should be done on either classes and not on the caller since there may
> be many…
>
>
>
> These 2 classes are in spring-context…
>
>
>
> The BusinessEventConsumer line 207 is like this:
>
> if(shouldTriggerScreenRefresh(event)) {
>
> SwingUtilities.invokeLater(new Runnable() {
>
> public void run() {
>
>
> Application.instance().getApplicationContext().publishEvent(newClientAppEvent(event));
>
> }
>
> });
>
> }
>
>
>
> Suggestions welcomed…
>
>
>
> Thanks
>
>
>
> Benoit.
>
>
>
>
>
>
>
> -------------------------------
>
> IMPORTANT NOTICE This communication contains information that is
> considered confidential and may also be privileged . It is for the
> exclusive use of the intended recipient(s). If you are not the
> intended recipient(s) please note that any form of distribution,
> copying or use of this communication or the information in it is
> strictly prohibited and may be unlawful. If you have received this
> communication in error please return it to the sender and delete the
> original.
>
>
>
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.485 / Virus Database: 269.13.12/997 - Release Date:
> 09/09/2007 10:17
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________ Springframework-rcp-dev mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-rcp-dev
**** DISCLAIMER ****
http://www.schaubroeck.be/maildisclaimer.htm
|