DisplayImpl Simplified: addReferences

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
<     }
---
>     //}

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.

Randall W. Simons
Sandia National Laboratories




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