Java AtomicLong lazySet() MethodThe lazySet() method of Java AtomicLong class sets the value to newValue. It has the memory effects of writing (assigning) a volatile variable except that it permits reorderings with subsequent (but not previous) memory actions that do not themselves impose reordering constraints with ordinary non-volatile writes. Among other usage contexts, lazySet may apply when nulling out, for the sake of garbage collection, a reference that is never accessed again. SyntaxParametersnewValue - the new value Example 1Test it NowOutput: 5 Example 2Test it NowOutput: 9 Example 3Test it NowOutput: -20 Next TopicJava AtomicLong Class |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India