자바(java)/Socket(TCP-IP)통신
Java.Thread-1. Thread Method 목록
농부지기
2017. 2. 17. 18:04
[ Java.Thread-1. Thread Method 목록 ]
1. 정의
- 쓰레드 관련 Class와 Method목록을 기술하고
이 목록을 기준으로 각각 설명 및 예제를 작성해서 게시한다.
2. Extends, Implements Class
- Extends : Thread
- Implements : Runnable
3. 기능 Class
- ExecutorService : Thread Pool 기능을 사용
4. Class별 메소드
1. Thread
getName() |
thread name 얻기 | |
Thread.currentThread().getName() |
thread name 얻기 | |
setName() |
thread name 정의 (setting) | |
Thread.sleep() |
thread를 일정시간 pause 시킴 | |
|
|
2. Runnable
|
|
|
|
|
|
|
|
|
3. ExecutorService
|
newFixedThreadPool() |
Thread Pool 개수 지정 |
|
newCachedThreadPool() |
쓰레드 수의 제한을 두지 않은 방식의 쓰레드풀 방식으로, 새로운 쓰레드 시작 요청이 들어올때마다 하나씩 쓰레드를 생성 |
|
newSingleThreadExecutor() |
단하나의 쓰레드를 생성 |
|
newScheduledThreadPool() |
일정시간마다 주기적으로 반복해야 하는 스타일의 동시작업을 위한 쓰레드풀. Timer 클래스를 대체할수 있는 쓰레드 풀방식이다. |
ForkJoinPool() |
큰 업무에 대해 분할정복과 CPU최대이용방식을 적용한 독특한 쓰레드 풀이다. |