Home » Core Java » util » concurrent » atomic

atomic

java.util.concurrent.atomic.AtomicLongArray Example

In this example we shall show you how to make use of AtomicLongArray class,  AtomicLongArray is a long array in which elements may be updated atomically. In a multithreading concurrent application architecture, we have a few tasks which are parallelized in such a way as to require no coordination between threads. The true problem comes when we need a coordination between ...

Read More »

java.util.concurrent.atomic.AtomicBoolean Example

In this example, we shall be demonstrating the use of java.util.concurrent.atomic.AtomicBoolean Class added in Java 5. The AtomicBoolean class is used to update a boolean value atomically i.e. only one thread can modify the boolean variable at a time. It provides two constructors, a parameterless one with default value as false and a constructor with argument as initial boolean value. ...

Read More »

Java AtomicMarkableReference Example

In this example we shall make use of AtomicMarkableReference class of Java. It is another class under the java.util.concurrent.atomic package, which provides lock-free and thread-safe programming solutions. In a recent example, we have seen how the AtomicReference class can be utilized to provide reference objects that may be atomically updated. Atomic actions are actions performed in an object only by ...

Read More »

Java AtomicReference Example

This is an example of the AtomicReference class of Java. It is another class under the java.util.concurrent.atomic package, which provides an object reference that may be updated atomically. The AtomicReference class provides reference objects that may be read and written atomically, so when multiple threads try to reach them at the same time, only one will be able to do ...

Read More »

Java AtomicIntegerArray Example

In this example we shall talk about the AtomicIntegerArray class of Java. Java provides the java.util.concurrent.atomic package specification for lock-free and thread-safe programming on single variables. The AtomicIntegerArray class is an int array in which elements may be updated atomically. Its difference with an simple AtomicInteger[] is that it creates one object, whereas when using AtomicInteger[], one object per array ...

Read More »

Java AtomicInteger Example

This is an example of how to use the AtomicInteger class of Java. The java.util.concurrent.atomic package provides very useful classes that support lock-free and thread-safe programming on single variables. Among them, the AtomicInteger class is a wrapper class for an int value that allows it to be updated atomically. The class provides useful methods, some of which will be shown ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns