Hi Roman,

On Mon, 2006-02-06 at 14:54 +0100, Roman Kennke wrote:
> > But maybe it can be made a little more efficient by not using
> > the old Vector and Hashtable classes all the time which seem to double
> > the synchronization in that class, but use an List and Map for that and
> > only synchronize on those when really needed.
> 
> Thinking about it, I am not sure if we can change this. At least the
> Hashtable is in the serialization spec for this class and changing this
> would cause serialization incompatibilities.

Serialization is already handled specially for this class. See the
readObject() and writeObject() methods. When you keep the
serialVersionUID field value the same you can replace the
ObjectInputStream.defaultReadObject() and
ObjectOutputStream.defaultWriteObject() calls with specific readFields()
and putFields()/writeFields() calls that "translate" between the
expected and actual fields. See java/util/PropertyPermission.java for an
example.

> OTOH, maybe we should leave the
> fields as they are, and remove the superfluous synchronization
> altogether from the class. Should also avoid redundant synchronization.
> Does that sound ok?

I am not sure that works in all cases (although I admit to have not
looked very carefully yet). It seems that some methods iterate over all
elements and at least such actions need to be synchronized as a whole.

Cheers,

Mark

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to