-재진입성 (reentrant): 동기화 메서드는 스레드 단위로 진입한다. 요청 단위가 아니다
- volatile 키워드 : 이 변수는 공유변수이며 재배치되서는 안된다는 뜻. 캐싱되지않는다
가시성만 보장한다
연산의 단일성은 보장하지 않음(약하다)
- 락은 연산의 단일성 및 가시성 둘다 보장
Situations when constructors are not thread safe are for example :
- modifying
staticvariable from within a constructor without proper synchronization mechanism - publishing
thisreference from within constructor before the object is fully initialized and can be accessed by other threads.
https://www.baeldung.com/java-thread-constructor
- 완전히 생성된 후에 그 객체를 다룰수있도록 해야한다
댓글 없음:
댓글 쓰기