hg: lambda/lambda/jdk: Summary: add ThreadLocal(Factory<T>) and compareAndSet methods
Mike Duigou
mike.duigou at oracle.com
Mon Jul 30 08:07:34 PDT 2012
I like your name suggestions. I too was uncomfortable with the "compare" naming but didn't have good suggestions. At this point the naming is definitely not final but only exploratory.
This work was done by Jim Gish, a new OpenJDK contributor. I am only responsible for helping with a pre-commit review and pushing the change to the repo.
Mike
On Jul 30 2012, at 04:16 , Aleksey Shipilev wrote:
> I think these method names are bad:
> int compareAndSet(IntUnaryOperator op);
>
> Admittedly, these are not the CAS-family operations. Compare with what?
> Set to what? Is this method one-shot, or it runs until successful
> (method name implies it is one-shot, but JavaDoc says otherwise)?
>
> I think then names should be coherent with other high-level methods,
> like incrementAndGet, etc., i.e.:
> int updateAndGet(IntUnaryOperator updater);
> int getAndUpdate(IntUnaryOperator updater);
>
> -Aleksey.
>
> On 07/27/2012 11:29 PM, mike.duigou at oracle.com wrote:
>> Changeset: 2fd2a7092fe1
>> Author: jgish
>> Date: 2012-07-27 15:04 -0400
>> URL: http://hg.openjdk.java.net/lambda/lambda/jdk/rev/2fd2a7092fe1
>>
>> Summary: add ThreadLocal(Factory<T>) and compareAndSet methods
>> Reviewed-by: briangoetz,smarks,mduigo
>> Contributed-by: Jim Gish <jim.gish at oracle.com>
>>
>> ! make/java/java/FILES_java.gmk
>> ! src/share/classes/java/lang/ThreadLocal.java
>> ! src/share/classes/java/util/concurrent/atomic/AtomicInteger.java
>> ! src/share/classes/java/util/concurrent/atomic/AtomicLong.java
>> + src/share/classes/java/util/functions/DoubleUnaryOperator.java
>> + src/share/classes/java/util/functions/IntUnaryOperator.java
>> + src/share/classes/java/util/functions/LongUnaryOperator.java
>> + src/share/classes/java/util/functions/UnaryOperator.java
>> + test-ng/tests/org/openjdk/tests/java/lang/ThreadLocalFactoryTest.java
>> + test-ng/tests/org/openjdk/tests/java/lang/ThreadLocalTest.java
>> + test-ng/tests/org/openjdk/tests/java/util/functions/DoubleUnaryOperatorTest.java
>> + test-ng/tests/org/openjdk/tests/java/util/functions/IntUnaryOperatorTest.java
>> + test-ng/tests/org/openjdk/tests/java/util/functions/LongUnaryOperatorTest.java
>> + test-ng/tests/org/openjdk/tests/java/util/functions/UnaryOperatorTest.java
>> ! test/java/lang/ThreadLocal/Basic.java
>> ! test/java/lang/ThreadLocal/ImmutableLocal.java
>> ! test/java/lang/ThreadLocal/InitialValue.java
>> ! test/java/lang/ThreadLocal/TLRemoveTest.java
>> ! test/java/lang/ThreadLocal/TestThreadId.java
>>
>>
>
More information about the lambda-dev
mailing list