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

From:

Mark Wielaard

Subject:

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

Date:

15 Feb 2002 15:58:55 +0100

Hi,
On Fri, 2002-02-15 at 15:44, Jeff Sturm wrote:
> On 15 Feb 2002, Mark Wielaard wrote:
> > When javadoc puts a synchronized in the javadoc you can be sure that the
> > thread will need to acquire the lock for that object.
>
> Not so. For instance, Java allows overriding a synchronized method with a
> non-sychronized one. Relying on the information from javadoc could be
> misleading.
Jikes. You (and Artur) are right and I was wrong. I have been relying on
this information. Hmmmm. Time to review all my code again... :}
> Also, the inverse doesn't apply: a method not identified as synchronized
> in javadoc may synchronize "this" anyway.
That is true, but as Artur pointed out this should be in the
documentation.
> For these reasons, I believe "synchornized" is part of a method's
> implementation but not its interface, and I am glad javadoc ignores it.
I have to agree now. Lets hope that the synchronization behaviour (and
thread safety) of methods is always described correctly in the
documentation...
Cheers,
Mark