Example usage for java.util.concurrent.atomic AtomicInteger weakCompareAndSet

List of usage examples for java.util.concurrent.atomic AtomicInteger weakCompareAndSet

Introduction

In this page you can find the example usage for java.util.concurrent.atomic AtomicInteger weakCompareAndSet.

Prototype

@Deprecated(since = "9")
public final boolean weakCompareAndSet(int expectedValue, int newValue) 

Source Link

Document

Possibly atomically sets the value to newValue if the current value == expectedValue , with memory effects as specified by VarHandle#weakCompareAndSetPlain .

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    AtomicInteger atomicInteger = new AtomicInteger();

    atomicInteger.weakCompareAndSet(1, 2);

    System.out.println(atomicInteger);
}