Atomic Variables Flashcards Preview

OCP > Atomic Variables > Flashcards

Flashcards in Atomic Variables Deck (20):
1

Atomically updatable boolean value.

java.util.concurrent.atomic.AtomicBoolean

2

Atomically updatable int value, extends Number class

java.util.concurrent.atomic.AtomicInteger

3

An int array in which elements can be updated atomically.

java.util.concurrent.atomic.AtomicIntegerArray

4

Atomically updatable long value, extends Number class.

java.util.concurrent.atomic.AtomicLong

5

A long array in which elements can be updated atomically.

java.util.concurrent.atomic.AtomicLongArray

6

An atomically updatable object reference of type V

java.util.concurrent.atomic.AtomicReference

7

An atomically updatabale object array that can hold references of type E.

java.util.concurrent.atomic.AtomicReferenceArray

8

Constructor that creates an instance of AtomicInteger with initial value 0.

AtomicInteger()

9

Overloaded constructor of AtomicInteger that creates it with an initial value set by initVal

AtomicInteger(int initVal)

10

Returns the value held by the object.

int get()

11

Resets the integer value held in this object to newVal.

void set(int newVal)

12

Returns the current int value held in this object and sets the value held in this object to newVal.

int getAndSet(int newValue)

13

Compares the int value of this object to the expect value, and if they are equal, sets the int value of this object to the update value.

boolean compareAndSet(int expect, int update)

14

Returns the current value of the integer value in this object and increments the integer value in this object. Atomic version of i++.

int getAndIncrement()

15

Returns the current value of the integer value in this object and decrements the integer value in this object. Atomic version of i--

int getAndDecrement()

16

Returns the integer value held in this object and adds given delta value to the integer value.

int getAndAdd(int delta)

17

Increments the current value of the integer value in this object and returns that value. Atomic version of ++i.

int incrementAndGet()

18

Decrements the current integer value in this object and returns that value. Atomic version of --i.

int decrementAndGet()

19

Adds the delta value to the current value of integer in this object and returns that value.

int addAndGet(int delta)

20

Casts the current int value of the object and returns it as int, long, float or double values.

int XXXvalue() where XXX is int, float, long or double.