atomic « concurrency « Java Thread Q&A

Home
Java Thread Q&A
1.concurrency
2.Development
3.Exception
4.Notify
5.Operation
6.Socket
7.State
8.synchronize
9.Thread Safe
10.ThreadPool
Java Thread Q&A » concurrency » atomic 

1. How to safely update a file that has many readers and one writer?    stackoverflow.com

I have a set of files. The set of files is read-only off a NTFS share, thus can have many readers. Each file is updated occasionally by one writer that ...

2. AtomicInteger lazySet and set    stackoverflow.com

May I know what is the difference among lazySet and set method for AtomicInteger. javadoc doesn't talk much about lazySet : Eventually sets to the given value. It seems that AtomicInteger will not ...

3. Java int concurrency ++int equivalent to AtomicInteger.incrementAndGet()?    stackoverflow.com

Are these two equivalent? In other words, are the ++ and -- operators atomic?

int i = 0;
return ++i;

AtomicInteger ai = new AtomicInteger(0);
return ai.incrementAndGet();

4. When to use AtomicReference (Java)? Is it really necessary?    stackoverflow.com

I have used AtomicLong many times but I have never needed to use AtomicReference It seems that AtomicReference does either (I copied this code from another stackoverflow question):

public synchronized boolean compareAndSet(List<Object> oldValue, List<Object> ...

5. Method call and atomicity    stackoverflow.com

I have a method with a single atomic operation, like this one

int value;

public void setValue(int value) {
    this.value = value;
}
then I call it in obvious way, like
foo.setValue(10);
The ...

6. Java: is there no AtomicFloat or AtomicDouble?    stackoverflow.com

I have found AtomicInteger, AtomicLong, but where is AtomicFloat (or AtomicDouble)? Maybe there is some trick?

7. Correct use of AtomicReference.compareAndSet for a stack implementation    stackoverflow.com

I was experimenting with java.util.concurrent and trying to work out how to use AtomicReference.compareAndSet correctly to manage concurrent access to a single unit of shared state. In particular: is the following usage ...

8. atomic question from core java    stackoverflow.com

This is a section from Core Java 8th edition Page 757 CAUTION:

public void flipDone() {
   done = !done;
}
// not atomic I don't understand why it's not atomic. Can any one tell ...

9. ConcurrentSkipListSet and replace remove(key)    stackoverflow.com

I am using ConcurrentSkipListSet, which I fill with 20 keys. I want to replace these keys continuously. However, ConcurrentSkipListSet doesn't seem to have an atomic replace function. This is what I am using ...

10. AtomicXXX.lazySet(...) in terms of happens before edges    stackoverflow.com

What does mean AtomicXXX.lazySet(value) method in terms of happens-before edges, used in most of JMM reasoning? The javadocs is pure on it, and Sun bug 6275329 states:

The ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.