[
Lists Home |
Date Index |
Thread Index
]
- From: Toivo Lainevool <tlainevool@yahoo.com>
- To: Miles Sabin <msabin@cromwellmedia.co.uk>, David Megginson <david@megginson.com>, XMLDev list <xml-dev@ic.ac.uk>
- Date: Wed, 15 Dec 1999 09:48:43 -0800 (PST)
--- Miles Sabin <msabin@cromwellmedia.co.uk> 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: http://shopping.yahoo.com
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)
|