Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsfeed.datemas.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: markspace Newsgroups: comp.lang.java.programmer Subject: java.util.concurrent.atomic Date: Sat, 26 Oct 2013 17:25:26 -0700 Organization: A noiseless patient Spider Lines: 48 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 27 Oct 2013 00:25:30 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="9185b88a2b5381a82810209530bb8295"; logging-data="2306"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/S3tTIUNVwH240u91K0o6PXRLAI0SGts0=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 Cancel-Lock: sha1:YYCk1n54TEP8tU1ogTpCThewBiw= Xref: csiph.com comp.lang.java.programmer:26440 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. 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!