Re: DisplayImpl Simplified: addReferences


>Date: Fri, 25 Jan 2002 11:44:37 -0700
>From: "Simons, Randall W" <rsimons@xxxxxxxxxx>
>Organization: Sandia National Laboratories
>To: "'visad-list@xxxxxxxxxxxxx'" <visad-list@xxxxxxxxxxxxx>
>Subject: DisplayImpl Simplified: addReferences

The above message contained the following:

> Here's a change that speeds up initialization of a VisAD display.  My
> program startup went from 60 sec. to 30 sec. without any apparent negative
> effects.  I had to modify DisplayImpl instead of just extend it, since I
> didn't want to change all the places that instantiate it.  Therefore, I give
> the diff output.  This is based on the VisAD version with a doc/DATE of Thu
> Nov 1 09:21:01 CST 2001.  If you're looking at a different version, look
> near the end of the last addReferences method.
> 1049c1049,1053
> <     synchronized (mapslock) {
> ---
> >     // Don't need to synchronize if only a single thread is involved.
> >     // Since mapslock is declared as a private instance field, it can
> >     // only be accessed by this instance of DisplayImpl.
> >     System.out.println("Running modified DisplayImpl.addReferences");
> >     //synchronized (mapslock) {
> 1051c1055
> <     }
> ---
> >     //}

Because the RendererVector field that was protected by the above
synchronization block is also accessed by other methods as part of their
transactions, removal of the synchronization block runs the risk of
corrupting the invarients of the class.

> What are the situations where mapslock could be accessed by more than one
> thread?  Is synchronization only necessary when doing distributed computing
with RMI?  If so, could we have an option in VisAD to turn off support for
> distributed computing when we don't need it?  Such an option might be useful
> elsewhere as well.

All VisAD Display-s have their own threads.

Steve Emmerson   <>

  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: