Skip to Content
안드로이드 멀티스레딩: 비동기 메커니즘으로 날렵하고 안정적인 앱 만들기
book

안드로이드 멀티스레딩: 비동기 메커니즘으로 날렵하고 안정적인 앱 만들기

by 한대희, 안데르스 예란손
April 2016
Beginner to intermediate
308 pages
7h 21m
Korean
Hanbit Media, Inc.
Content preview from 안드로이드 멀티스레딩: 비동기 메커니즘으로 날렵하고 안정적인 앱 만들기
186
2
-
비동기 기법
public void run
()
{
//
변수
alphabet
사용하는
오래
걸리는
동작을
실행
}
});
}
ThreadPoolExecutor executor
=
new ThreadPoolExecutor
(
5
,
10
,
1
,
TimeUnit
.
SECONDS
,
preloadedQueue
);
executor
.
prestartAllCoreThreads
();
0
개의 핵심 스레드의 위험
176
쪽 ‘
ThreadPoolExecutor
설정’에서 설명한 것과 같이, 핵심 풀 크기는 큐가 스레드 생성
에 대한 우선권을 얻기 전에 얼마나 많은 스레드가 시작될 것인지로 결정된다. 핵심 풀 크기에 도
달되자마자 태스크는 새롭게 생성된 스레드에서 실행되는 대신 큐에 들어간다.
int N
=
Runtime
.
getRuntime
().
availableProcessors
();
ThreadPoolExecutor executor
=
new ThreadPoolExecutor
(
0
,
N
*
2
,
60L
,
TimeUnit
.
SECONDS
,
new ArrayBlockingQueue
<
Runnable
>(
10
));
0
개의 핵심 스레드와
10
개 태스크를 보유할 수 있는 제한된 큐에서는, 스레드 생성을 시작하는
11
번째 태스크가 삽입될 때까지 실제로 어떤 태스크도 실행되지 않는다.
9.3
태 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

코드로 인프라 관리하기: 효율적인 인프라 관리를 위한 자동화 방법

코드로 인프라 관리하기: 효율적인 인프라 관리를 위한 자동화 방법

강재준

Publisher Resources

ISBN: 9788968481703