[Opensource] DBObject.initialize() now has threadsafe static for
DBObjectDef map
larry hamel
expresso at codeguild.com
Wed Dec 4 14:10:15 PST 2002
hi,
in latest code, DBObject.initialize() had a problem with a static data member (the static map of all DBObjectDef's) being un-thread-safe, which is now fixed. This was causing intermittent errors about field definitions not existing when our site was under load. the new javadoc at bottom explains more.
to reproduce the error, we developed a web-spider test using httpunit. this turns into a load test when several instances of the spider are run concurrently. I'll check this into a new cvs module a little later.
larry
--------------------
/**
* Sets up metadata for the dbobject via call to setupFields().
* it is important within this method to provide STATIC synchronization
* to enable static (meta)data members to be setup by the first
* instantiation of a given class. Two threads
* can simultaneously create the first instance of different classes,
* and so a simple object-level synchronization alone will not suffice here,
* though it is useful to block out calls from the same class.
*
* @author Adam Rossi, PlatinumSolutions
* @author Larry Hamel, CodeGuild.com
* @throws DBException The exception description.
*/
protected synchronized void initialize() throws DBException {
More information about the Opensource
mailing list