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

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

Introduction

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

Prototype

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

Source Link

Document

Possibly atomically sets the element at index i to newValue if the element's 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 {
    AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1L, 2L, 3L, 4L });
    atomicLongArray.weakCompareAndSet(2, 10L, 20L);
    System.out.println(atomicLongArray);
}