[concurrency-interest] Constructors of AtomicXXX and AtomicXXXArray

olivier.dupuy@hrdc-drhc.gc.ca olivier.dupuy@hrdc-drhc.gc.ca
Wed, 7 Jan 2004 18:23:16 -0500


Hi


I have found no reference to these topics in the archive of the mailing list

The AtomicXXXArray classes do not have a constructor taking an array
of XXX (Integer/int or equivalent). I agree that this array could be modified
while the constructor is populating it's 'internal' array by copying/cloning.
Is it why this constructor does not exist even if I see a use for it to avoid
a big loop duplicated in different places ? Moreover, the external loop does
not prevent a modification of the array content during the 'copy' if another
thread has access to it. So why not to add it ?

Your opinion about the usefulness of this ?



AtomicXXX constructors accept only a single primitive argument at this time.
If you look at Number(s) (even if I am not interested in extending Number)
you will see constructors taking a String and parsing it.
This constructor is not difficult to write just calling the XXX constructor
and another AtomicXXX constructor taking a String and a radix could also be useful.
The initial value of the AtomicXXX could come from a Properties/ResourceBundle
and could be in decimal, hexa...

I am not knowledgeable about auto(un)boxing (the link below seems old)
but I see nothing about automated String parsing (String -> some primitive type)
http://www.jcp.org/aboutJava/communityprocess/jsr/tiger/autoboxing.html

Your opinion about the usefulness of this ?


Olivier DUPUY