최대 1 분 소요

AtomicLong

AtomicLong 이란?

  • AtomicLong 클래스에 들어가면 이런 설명이 있습니다. ```
  • A {@code long} value that may be updated atomically.
  • See the {@link VarHandle} specification for descriptions of the properties of atomic accesses.
  • An {@code AtomicLong} is used in applications such as atomically incremented sequence numbers, and cannot be used as a replacement for a {@link java.lang.Long}.
  • However, this class does extend {@code Number} to allow uniform access by tools and utilities that deal with numerically-based classes.

@since 1.5 @author Doug Lea ```

  • 한줄한줄씩 해석을 해보자. 구글 번역기로 돌려도 되지만 간단한거여서 대충 해석으로 적었습니다.
    • Long 값이 원자적으로 업데이트될 수 있습니다. (원자적이란 뭘까?… 화학시간때나 본건데…)
    • 원자적 접근의 속성에 대한 설명을 위해 VarHandle 사양을 확인하세요.
    • AtomicLong은 원자적으로 증분되는 시퀀스 번호와 같은 애플리캐이션에서 사용되며 Long을 대체하는데 사용할 수 없습니다.
    • 이 클래스는 Number를 확장하여 수치 기반 클래스를 처리하는 도구 및 유틸리티의 엑세스를 허용합니다.
  • 위 내용들을 보면 일단 Atomic이라고 적힌 원자적이라는 것에 대해 아라보자!

Atomic

Volatile

Synchronized