사용자 도구

사이트 도구


java:threadlocal

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
java:threadlocal [2016/02/27 22:05]
kwon37xi
java:threadlocal [2024/12/11 20:05] (현재)
kwon37xi [Java ThreadLocal]
줄 1: 줄 1:
 ====== Java ThreadLocal ====== ====== Java ThreadLocal ======
-  * [[http://docs.oracle.com/javase/7/docs/api/java/lang/ThreadLocal.html|ThreadLocal]]+  * [[https://docs.oracle.com/javase/8/docs/api/java/lang/ThreadLocal.html|ThreadLocal]]
  
   Each thread holds an implicit reference to its copy of a thread-local variable   Each thread holds an implicit reference to its copy of a thread-local variable
줄 6: 줄 6:
   after a thread goes away, all of its copies of thread-local instances are subject    after a thread goes away, all of its copies of thread-local instances are subject 
   to garbage collection (unless other references to these copies exist).   to garbage collection (unless other references to these copies exist).
 +  
 + ===== withInitialValue =====
 +  * 초기값을 생성하는 lambda 를 지정해두면 최초에 값이 없을 때에 적절한 초기값을 제공해준다.
 +  * ''remove()'' 를 호출해서 초기값이 없어진 상태에서 다시 ''get()''을 하면 ''withInitialValue''로 설정했다면 다시 초기값을 생성해서 반환해준다.
 +
  
 ===== 참조 ===== ===== 참조 =====
java/threadlocal.1456580105.txt.gz · 마지막으로 수정됨: 2016/02/27 22:05 저자 kwon37xi