사용자 도구

사이트 도구


java:threadlocal

차이

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

차이 보기로 링크

다음 판
이전 판
java:threadlocal [2016/02/27 22:04]
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 
 +  as long as the thread is alive and the ThreadLocal instance is accessible; 
 +  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). 
 +   
 + ===== withInitialValue ===== 
 +  * 초기값을 생성하는 lambda 를 지정해두면 최초에 값이 없을 때에 적절한 초기값을 제공해준다. 
 +  * ''remove()'' 를 호출해서 초기값이 없어진 상태에서 다시 ''get()''을 하면 ''withInitialValue''로 설정했다면 다시 초기값을 생성해서 반환해준다.
  
-  Each thread holds an implicit reference to its copy of a thread-local variable as long as the thread is alive and the ThreadLocal instance is accessible; 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). 
  
 ===== 참조 ===== ===== 참조 =====
java/threadlocal.1456580091.txt.gz · 마지막으로 수정됨: 2016/02/27 22:04 저자 kwon37xi