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

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

by 한대희, 안데르스 예란손
April 2016
Beginner to intermediate
308 pages
7h 21m
Korean
Hanbit Media, Inc.
Content preview from 안드로이드 멀티스레딩: 비동기 메커니즘으로 날렵하고 안정적인 앱 만들기
120
1
-
기초
서비스는 메시지를 받고 액티비티로 새로운 메시지를 보낸다.
public void run
()
{
Looper
.
prepare
();
mWorkerHandler
=
new Handler
()
{
@
Override
public void handleMessage
(
Message msg
)
{
switch
(
msg
.
what
)
{
case 1
:
try
{
msg
.
replyTo
.
send
(
Message
.
obtain
(
null
,
msg
.
what
,
0
,
0
));
}
catch
(
RemoteException e
)
{
Log
.
e
(
TAG
,
e
.
getMessage
());
}
break
;
case 2
:
Log
.
d
(
TAG
,
"
Message received
");
break
;
}
}
};
onWorkerPrepared
();
Looper
.
loop
();
}
NOTE
_
메신저는 그것이 소유한 스레드에서 메시지를 처리하는 핸들러와 연결된다. 따라서 바인더 스레드
에서 동시에 태스크를 실행할 수 있는
AIDL
과는 달리, 메신저는 설계상 차례대로 태스크를 실행한다.
5.4
마치며
응용프로그램에서 프로세스 간 통신 대부분은 고수준의 구성요소에 의해 내부적으로 처리된다.
그러나 필요한 경우, 바인더의 저수준 메커니즘(
RPC
Messenger
)으로 내려갈 수 있다. 동시
에 들어오는 요청을
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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

자바로 배우는 핵심 자료구조와 알고리즘: 기술 면접에 필요한 실용주의 자료구조와 알고리즘

자바로 배우는 핵심 자료구조와 알고리즘: 기술 면접에 필요한 실용주의 자료구조와 알고리즘

유동환, 앨런 B. 다우니

Publisher Resources

ISBN: 9788968481703