Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #26440

java.util.concurrent.atomic

From markspace <markspace@nospam.nospam>
Newsgroups comp.lang.java.programmer
Subject java.util.concurrent.atomic
Date 2013-10-26 17:25 -0700
Organization A noiseless patient Spider
Message-ID <l4hmhq$282$1@dont-email.me> (permalink)

Show all headers | View raw


Hi all,

In spite of the fact that I think I know the Java API well, I often find 
classes or methods that I was unaware of.  Here's some examples from 
java.util.concurrent.atomic that I was unaware of.

AtomicBoolean
AtomicInteger
AtomicLong

I think most folks are aware of these three basic atomic classes.

AtomicReference

Here's something I forget about: update an object reference atomically. 
  I'm having trouble thinking of a good use case for this class however. 
  Does anyone have an interesting example of its use?

AtomicIntegerArray
AtomicLongArray
AtomicReferenceArray

Holy cow!  Remember when we get questions about "can I make array 
elements with volatile memory semantics"?  I recall us answering "no" to 
that question.  Guess what the three classes above do?  Yup, access 
arrays atomically with volatile memory semantics.  Very useful.

AtomicIntegerFieldUpdateder
AtomicLongFieldUpdater
AtomicReferenceFieldUpdater

These are hella cool.  They update fields within a class atomically. 
Yet I'm having trouble thinking of uses cases for these as well.  Any ideas?

AtomicReferenceFieldUpdater has an worked out code example involving a 
node with left and right sub-nodes, but I don't think I grok it completely.

<http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.html>

AtomicMarkableReference
AtomicStampedRefernce

Ditto with these two classes.  They seem cool, but I'm not sure what I'd 
use them for.


Additional comments and insights on these classes are appreciated!

Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

java.util.concurrent.atomic markspace <markspace@nospam.nospam> - 2013-10-26 17:25 -0700
  Re: java.util.concurrent.atomic Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2013-10-26 19:56 -0700
    Re: java.util.concurrent.atomic Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-10-29 20:35 +0000
      Re: java.util.concurrent.atomic Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-10-29 17:27 -0400
      Re: java.util.concurrent.atomic Marcel Müller <news.5.maazl@spamgourmet.org> - 2013-10-29 22:36 +0100
      Re: java.util.concurrent.atomic Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2013-10-29 21:17 -0700
  Re: java.util.concurrent.atomic Marcel Müller <news.5.maazl@spamgourmet.org> - 2013-10-27 10:09 +0100

csiph-web