Re: [OpenMap Users] Synchronization on graphic lists

From: Andrew Hnatiw <Andrew_Hnatiw_at_raytheon.com>
Date: Thu, 9 Sep 2004 11:22:13 -0400

I hate to reply to my own post, but after looking at more source code I'd
like to suggest that even GraphicLoader has problems with synchronizing on
the list. My fear is that since the getRectangle() method of any plug-in
will return A POINTER to the same list that the plug-in is working with,
how can there be any guarantee that the list that was returned is not
being modified by the plug-in while the OpenMap layer that called
getRectangle is using it (even if we are using GraphicLoader... the
GraphicLoaderPlugIn still returns a pointer to the list it is using
internally).

If this is indeed a problem, one solution that seems simple would be to
have getRectangle() return a clone of the object... of course, this would
require the OMGraphicList and anything within it to be cloneable (did Sun
ever change it to the correct spelling clonable?), so maybe its not a very
simple solution. It is also very slow, and I feel like I remember reading
that getRectangle() should try to return as fast as possible. The only
other solution that I can think of is for plug-ins to not use their 'list'
member variable, and instead create a new unique list every time it has to
return one in getRectangle() - though this could also be slow.

Any ideas? I'll have to try running a ton of threads all modifying the
graphic list at the same time to see if I get any odd behavior... though
chances are slim. I think that a bug like this showing up in the future
would be hard to even trace back to this as the source.

Thanks,

Andrew Hnatiw, Software Engineer
Andrew_Hnatiw_at_raytheon.com
Raytheon IIS
Falls Church, VA 22042


owner-openmap-users_at_bbn.com wrote on 09/08/2004 05:12:12 PM:

>
> I was wondering how code such as OMGraphicHandlerPlugIn can avoid
> synchronization problems. It does not seem to ever sync on
> the graphics list, so isn't it possible that the thread creating and
> changing the list could access it at the same time that doPrepare,
> getRectangle, or repaint are called? OpenMap does have multiple
> threads initially, correct (?), since it has to have things to
> handle the GUI and redraw the screen all "at the same time"?
>
> I see how the GraphicLoader can help solve these problems, but am I
> correct in thinking that graphics cannot be modified at all without
> fear of synchronization errors when using just the
OMGraphicHandlerPlugIn?
>
> Thanks,
>
> Andrew Hnatiw, Software Engineer
> Andrew_Hnatiw_at_raytheon.com
> Raytheon IIS
> Falls Church, VA 22042

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Sep 09 2004 - 11:24:57 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:06 EDT