It's easier just to not use an iterator -- get the keys as an array and run
through them. I'll work on it tonight.

On Tue, Sep 7, 2010 at 12:58 PM, Nicolas Vervelle <nverve...@gmail.com>wrote:

> Hi  Bob,
>
> I have just looked into the code involved, and I believe it's not a
> multithread problem.
> It's simply that we're iterating over a Map and incorrectly removing
> elements from it.
>
> The Map.remove() shouldn't be called when iterating over the keySet.
> The javadoc for keySet() says the results are undefined.
>
> Maybe replacing (twice) :
>
>       Iterator<String> e = messageQueue.keySet().iterator();
>       while (e.hasNext()) {
>         String statusName = e.next();
>         List<List<Object>> record = messageQueue.remove(statusName);
>         msgList.add(record);
>       }
>
> by something like (not tested) :
>
>       Iterator<Entry<String, List<List<Object>>>> e =
> messageQueue.entrySet().iterator();
>       while (e.hasNext()) {
>         Entry<String, List<List<Object>>> record = e.next();
>         e.remove();
>         msgList.add(record.getValue());
>       }
>
> I don't know how to test the modification, so I haven't done it.
>
> Nico
>
>
> On Tue, Sep 7, 2010 at 6:26 PM, Robert Hanson <hans...@stolaf.edu> wrote:
>
>> Oh, interesting! ConcurrentModificationException. Yes, (Nico) we might
>> need to look into that. That means that two independent threads are trying
>> to update the same Java object and have collided. It would indeed be unique
>> to Jmol 12.1, I think.
>>
>> I'll look into it this evening if Nico hasn't tracked it down by then.
>> Nico, do we need to synchronize that?
>>
>> Bob
>>
>> On Tue, Sep 7, 2010 at 9:52 AM, Alexander Rose <
>> alexander.r...@weirdbyte.de> wrote:
>>
>>> Hi,
>>>
>>>
>>> In the 12.1 development branch (starting with 12.1.2), the applet throws
>>> an exception upon calling jmolScriptWait( ... ).
>>>
>>> http://weirdbyte.de/jmol-test/html/security.html
>>>
>>> The exception occurs on both, the signed and the unsigned applet.
>>>
>>>
>>>
>>>
>>>
>>> Firefox on Ubuntu 10.04, Java 1.6.0_18
>>>
>>> java.lang.reflect.InvocationTargetException
>>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>        at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>        at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>        at java.lang.reflect.Method.invoke(Method.java:616)
>>>        at
>>> sun.applet.PluginAppletSecurityContext$4.run(PluginAppletSecurityContext.java:699)
>>>        at java.security.AccessController.doPrivileged(Native Method)
>>>        at
>>> sun.applet.PluginAppletSecurityContext.handleMessage(PluginAppletSecurityContext.java:696)
>>>        at
>>> sun.applet.AppletSecurityContextManager.handleMessage(AppletSecurityContextManager.java:69)
>>>        at
>>> sun.applet.PluginStreamHandler.handleMessage(PluginStreamHandler.java:273)
>>>        at
>>> sun.applet.PluginMessageHandlerWorker.run(PluginMessageHandlerWorker.java:82)
>>> Caused by: java.util.ConcurrentModificationException
>>>        at java.util.Hashtable$Enumerator.next(Hashtable.java:1048)
>>>        at org.jmol.viewer.StatusManager.getStatusChanged(Unknown Source)
>>>        at org.jmol.viewer.Viewer.getStatusChanged(Unknown Source)
>>>        at org.jmol.viewer.PropertyManager.getPropertyAsObject(Unknown
>>> Source)
>>>        at org.jmol.viewer.PropertyManager.getProperty(Unknown Source)
>>>        at org.jmol.viewer.Viewer.getProperty(Unknown Source)
>>>        at org.jmol.viewer.Viewer.getProperty(Unknown Source)
>>>        at org.jmol.viewer.Viewer.evalStringWaitStatus(Unknown Source)
>>>        at org.jmol.viewer.Viewer.scriptWait(Unknown Source)
>>>        at org.jmol.applet.Jmol.scriptProcessor(Unknown Source)
>>>        at org.jmol.applet.Jmol.scriptWait(Unknown Source)
>>>        at JmolApplet.scriptWait(Unknown Source)
>>>        ... 10 more
>>> Error on Java side: null
>>>
>>>
>>>
>>> Firefox 3.6 on Mac OSX 10.6, Java 1.6.0_20
>>>
>>> java.util.ConcurrentModificationException
>>>        at java.util.Hashtable$Enumerator.next(Hashtable.java:1031)
>>>        at org.jmol.viewer.StatusManager.getStatusChanged(Unknown Source)
>>>        at org.jmol.viewer.Viewer.getStatusChanged(Unknown Source)
>>>        at org.jmol.viewer.PropertyManager.getPropertyAsObject(Unknown
>>> Source)
>>>        at org.jmol.viewer.PropertyManager.getProperty(Unknown Source)
>>>        at org.jmol.viewer.Viewer.getProperty(Unknown Source)
>>>        at org.jmol.viewer.Viewer.getProperty(Unknown Source)
>>>        at org.jmol.viewer.Viewer.evalStringWaitStatus(Unknown Source)
>>>        at org.jmol.viewer.Viewer.scriptWait(Unknown Source)
>>>        at org.jmol.applet.Jmol.scriptProcessor(Unknown Source)
>>>        at org.jmol.applet.Jmol.scriptWait(Unknown Source)
>>>        at JmolApplet.scriptWait(Unknown Source)
>>>        at netscape.oji.JNIRunnable.run(Native Method)
>>>        at netscape.oji.LiveConnectProxy.run(LiveConnectProxy.java:48)
>>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>        at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>        at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>>        at jep.LiveConnect$DoProxy.run(Unknown Source)
>>>        at
>>> java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
>>>        at java.awt.EventQueue.dispatchEvent(EventQueue.java:633)
>>>        at
>>> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
>>>        at
>>> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
>>>        at
>>> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
>>>        at
>>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
>>>        at
>>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
>>>        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
>>>
>>>
>>>
>>> Safari 5 on Mac OSX 10.6, Java 1.6.0_20
>>>
>>> Ignored exception: java.security.PrivilegedActionException:
>>> java.lang.reflect.InvocationTargetException
>>>
>>>
>>>
>>>
>>> Best
>>> Alex
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> This SF.net Dev2Dev email is sponsored by:
>>>
>>> Show off your parallel programming skills.
>>> Enter the Intel(R) Threading Challenge 2010.
>>> http://p.sf.net/sfu/intel-thread-sfd
>>> _______________________________________________
>>> Jmol-users mailing list
>>> jmol-us...@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/jmol-users
>>>
>>
>>
>>
>> --
>> Robert M. Hanson
>> Professor of Chemistry
>> St. Olaf College
>> 1520 St. Olaf Ave.
>> Northfield, MN 55057
>> http://www.stolaf.edu/people/hansonr
>> phone: 507-786-3107
>>
>>
>> If nature does not answer first what we want,
>> it is better to take what answer we get.
>>
>> -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
>>
>>
>> ------------------------------------------------------------------------------
>> This SF.net Dev2Dev email is sponsored by:
>>
>> Show off your parallel programming skills.
>> Enter the Intel(R) Threading Challenge 2010.
>> http://p.sf.net/sfu/intel-thread-sfd
>> _______________________________________________
>> Jmol-users mailing list
>> jmol-us...@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jmol-users
>>
>>
>
>
> ------------------------------------------------------------------------------
> This SF.net Dev2Dev email is sponsored by:
>
> Show off your parallel programming skills.
> Enter the Intel(R) Threading Challenge 2010.
> http://p.sf.net/sfu/intel-thread-sfd
> _______________________________________________
> Jmol-users mailing list
> jmol-us...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>


-- 
Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
http://www.stolaf.edu/people/hansonr
phone: 507-786-3107


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to