We can take advantage of this to allow sharing of data between instances of an applet. Usually this sharing takes the form of an object cache for objects of a given type.
Hashtable documentCache;
synchronized DVIDocument getDocument( URL documentURL ) {
if( documentCache == NULL )
documentCache = new Hashtable( );
DVIDocument result = documentCache.get( documentURL );
if( result == NULL ) {
result = new DVIDocument( documentURL );
documentCache.put( documentURL, result );
}
return result;
}