Toivo Lainevool tlainevool at
Wed Dec 15 17:48:47 GMT 1999

--- Miles Sabin <msabin at> wrote:
> David Megginson wrote,
> > I'm attaching a copy of the Java source code for the (short) 
> > NSUtils class that I described in the last message.  I'd be 
> > very grateful if the Java specialists on the list could look 
> > this over, paying special attention to synchronization 
> > problems.
> I fear there are some big problems here. In particular,
... snip ...
> 	String name = (String)joinNameTable.get(qName);
... snip ...
> Is rather nastily thread-unsafe: the shared qName could be
> read/written by multiple threads in joinName(). You should
> either synchronize this method, or create a new QName locally.

Hashtable get() and put() are synchronized, so the read/write operations are
thread safe.  No need to have separate synchronized blocks.

The only problem I saw was the incrCounter method.  It increments and resests
the counter field.  This needs to be synchronized.  The easiest way would be to
make the incrCounter() method synchronized.

Toivo Lainevool
Do You Yahoo!?
Thousands of Stores.  Millions of Products.  All in one place.
Yahoo! Shopping:

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as: and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list