[concurrency-interest] Constructors of AtomicXXX and AtomicXXXArray

olivier.dupuy@hrdc-drhc.gc.ca olivier.dupuy@hrdc-drhc.gc.ca
Wed, 7 Jan 2004 19:37:28 -0500

>> The AtomicXXXArray classes do not have a constructor taking an array
>> of XXX (Integer/int or equivalent).
>I have not encountered a context where there is a need to initialize
>an atomic "array" from an existing array. That's not to say it doesn't
>exist, but there are no use cases that highlighted the need for it. Do
>you have an actual use case for this?


No I don't have a use case at this time but why would you like to create an
AtomicIntegerArray if you don't populate it after with ints, shortly or not.
This is my point. Who would populate this array ? Multiple threads would mean
that they would have to know where they are storing their
value. It makes certainly more sense to initialize this from the start.

A possible example of an Atomic array could be some kind of 
exchange array between 2 systems, like the MIB used in SNMP. 
The client and the server can both modify and read the value and 
these operations are atomic.
Not sure that it's the best example but the array in this case
would be populated by the 'server' at initialization time.

For the constructors with the String, I confess that it's just a convenience
method to keep the code more compact but this can be managed with the
existing classes.

Olivier Dupuy