Atomicinteger, a class that provides an integer for atomic manipulation. In the Java language, ++i and i++ operations are not thread-safe and, when used, will inevitably use the Synchronized keyword. The Atomicinteger is a thread-safe plus-minus operation interface.
Java.util.concurrent.atomic.AtomicInteger class, concurrent package belonging to Java
The class method is as follows:
/** to see the interfaces provided by Atomicinteger. *//Get current value public final int get ()//Take current value and set new value public final int getandset (int newvalue)//Get current value and increment public final int Getandincrement ()//Gets the current value and subtract public final int getanddecrement ()//Gets the current value, plus the expected value public final int getandadd (int delt A
This article is from the architect's path blog, so be sure to keep this source http://lizhuquan0769.blog.51cto.com/2591147/1787174
"Java multithreaded" thread-safe Integer,automicinteger