M
markspace
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/doc...rrent/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!
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/doc...rrent/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!