비동기 백그라운드 처리
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
비동기 작업은 지속적인 작업과 함께 백그라운드 작업의 두 번째 구성요소입니다. 지속적인 작업과 비동기 작업이 모두 백그라운드에서 실행되지만 최종적으로는 상당히 다릅니다.
비동기 작업은 다음과 같은 특징이 있습니다.
- 지금 이 순간에 일어납니다.
- 앱을 다시 시작하거나 기기를 재부팅할 때 지속할 필요가 없습니다.
- 기본 스레드에서 발생하거나 기본 스레드를 차단합니다.
이는 향후 실행을 예약할 수 있고 앱 다시 시작 및 기기 재부팅을 통해 예약된 상태로 유지되는 영구 작업과 대조됩니다.
비동기 작업의 예로는 기본 스레드 외부로 HTTP 요청을 전송하여 결과가 도착할 때만 결과를 반환하는 경우를 들 수 있습니다.
Java 및 Kotlin
비동기 작업을 처리하는 방법은 따르는 전체 앱 아키텍처에 따라 다릅니다. 자바 프로그래밍 언어 앱으로 작업하는 경우 Kotlin으로 작업할 때와는 요구사항이 다릅니다.
|
Kotlin |
Java |
해결 방법 |
코루틴. |
Java 스레드 |
추가 자료 |
코루틴의 전체 개요는 코루틴 가이드를 참조하세요. |
자세한 내용은 자바 스레드 페이지를 참고하세요. |
추가 자료
지속적인 작업에 대한 자세한 내용은 지속적인 작업 개요를 참조하세요.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-26(UTC)"],[],[],null,["# Asynchronous background processing\n\nAsynchronous work is the second component of background work, alongside\npersistent work. While both persistent and asynchronous work take place in the\nbackground, they are ultimately quite different.\n\nAsynchronous work is that which:\n\n- Takes place in the moment.\n- Does not need to persist across app restarts or device reboots.\n- Occurs off the main thread, or blocks the main thread.\n\nThis is in contrast to persistent work, which you may schedule for future\nexecution and which remains scheduled through app restarts and device reboots.\nAn example of asynchronous work may be sending an HTTP request off the main\nthread, returning its result only when it arrives.\n\nJava and Kotlin\n---------------\n\nThe way you handle asynchronous work depends on the overall app architecture\nyou follow. If you are working with a Java Programming Language app, your needs\nare different than if you are working with Kotlin.\n\n| | Kotlin | Java |\n| Solution | Coroutines. | Java threads. |\n| Further reading | For a full overview of Coroutines, see the [Coroutines guide](/kotlin/coroutines). | See the [Java Threads](/guide/background/asynchronous/java-threads) page for more information. |\n|-----------------|------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------|\n\nFurther reading\n---------------\n\nFor more information on persistent work, see the [persistent work overview](/guide/background/persistent)."]]