Hey Paul,
Thank you for doing this, but PLEASE follow the coding conventions on the
site...most specific: no tabs, 4 space indention.
<http://java.apache.org/turbine/code-standards.html>
thanks,
-jon
+ synchronized(mapBuilders)
+ {
+ mb = (MapBuilder)mapBuilders.get(name);
+ if (mb == null)
+ {
+ mb =
(MapBuilder)Class.forName(name).newInstance();
+ // Cache the MapBuilder before it is built.
+ mapBuilders.put(name, mb);
+ }
+ }
+ }
+
+ // Build the MapBuilder in its own synchronized block to
+ // avoid locking up the whole Hashtable while doing so.
+ // Note that *all* threads need to do a sync check on
isBuilt()
+ // to avoid grabing an uninitialized MapBuilder. This,
however,
+ // is a relatively fast operation.
+ synchronized(mb)
+ {
+ if (!mb.isBuilt())
+ {
+ try
+ {
+ mb.doBuild();
+ }
+ catch ( Exception e )
+ {
+ // need to think about whether we'd want to
remove
+ // the MapBuilder from the cache if it can't be
+ // built correctly...? pgo
+ throw e;
+ }
+ }
+ }
return mb;
}
catch(Exception e)
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]