Sunday, 12 August 2012

Atomic Classes in Java

From Java 5 onwards Java has added multiple thread safe atomic classes in 'java.util.concurrent' package which can be categories in followings:
1. Atomic class for atomic access to primitive types
  • AtomicBoolean
  • AtomicInteger
  • AtomicLong
  • AtomicReference
2. Atomic access to different arrays:
  • AtomicIntegerArray
  • AtomicLongArray
  • AtomicReferenceArray
3. Atomic Field Updaters:  These classes are used to wrap up atomic access, via reflection, to volatile fields of another class.
  • AtomicIntegerFieldUpdater
  • AtomicLongFieldUpdater 
  • AtomicReferenceFieldUpdater 
4.  Atomically integrate a boolean or integer with a reference field:
  • AtomicMarkableReference 
  • AtomicStampedReference

No comments:

Post a Comment