classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: java.util.Properties -- make it thread-safe?


From: Bryce McKinlay
Subject: Re: java.util.Properties -- make it thread-safe?
Date: Sat, 16 Feb 2002 10:23:34 +1300
User-agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:0.9.7) Gecko/20011221

Sascha Brawer wrote:

Sun's current JavaDoc (J2SE 1.4) does not mention whether
java.util.Properties is supposed to be usable from multiple threads
without additional synchronization.  However, one might be able to infer
it from the fact that it is a subclass of java.util.Hashtable.


My approach is to assume that _nothing_ is synchronized unless the (current) specs explicitly say so, or it is obvious that it is not reasonable to implement something any other way. My reasoning is:

1. It is slow. In fact the overuse of synchronization is responsible for a great many of Java's performance problems. 2. A programmer has no reason to assume that something is synchronized if the specification does not say it is. 3. It could potentially cause deadlock issues if a progammer assumes something does not synchronize internally, but it does.

regards

Bryce.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]