I read sometime ago that there is new java feature to increment a long
as atomic operation so threads can safely add one to the long. I cannot
find name for such object, I think "AtomicLongIncrement" or something.
Maybe someone can remember.
I have been searching java doc, but cannot find it.
Arne Vajhøj - 27 Aug 2006 02:47 GMT
> I read sometime ago that there is new java feature to increment a long
> as atomic operation so threads can safely add one to the long. I cannot
> find name for such object, I think "AtomicLongIncrement" or something.
> Maybe someone can remember.
>
> I have been searching java doc, but cannot find it.
Is it java.util.concurrent.atomic.AtomicLong you are looking
for ?
Arne
dimitrik107@hotmail.com - 27 Aug 2006 22:44 GMT
Yes! Thank you. My javadoc were older than compiler. I got newer
javadoc now.
> > I read sometime ago that there is new java feature to increment a long
> > as atomic operation so threads can safely add one to the long. I cannot
[quoted text clipped - 7 lines]
>
> Arne
hiwa - 27 Aug 2006 02:49 GMT
dimitrik...@hotmail.com のメッセージ:
> I read sometime ago that there is new java feature to increment a long
> as atomic operation so threads can safely add one to the long. I cannot
> find name for such object, I think "AtomicLongIncrement" or something.
> Maybe someone can remember.
>
> I have been searching java doc, but cannot find it.
Use a synchronized method, or block, for Java primitive type long.
Or, since Java 1.5, you could use
java.util.concurrent.atomic.AtomicLong and its method.