--- kind: CONCEPT slug: adapter-outbound-notification-c02 title: 같은 종료 절차를 쓰지만 대상이 다르다 topic: composition-and-lifecycle-models project: clean-architecture-backend-template status: 게시 전 sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916 rootTreeNode: concept:adapter-outbound-notification-c02 evidenceCapturedOn: 2026-09-01 assets: - key: adapter-outbound-notification-c02 file: ../../../final/evidence/rendered/adapter-outbound-notification-c02.svg evidence: - ../../../final/evidence/raw/adapter-outbound-notification-c02.txt source: - 원본 분석 절은 final/document.md#a13#L306 이다. module: adapter-outbound-notification --- # 같은 종료 절차를 쓰지만 대상이 다르다 `NotificationSchedulerWorker.close`와 `NotificationBackgroundWorkers.close` 둘 다 취소 → shutdown → awaitTermination(grace) → shutdownNow를 수행한다. 형태는 같지만 대상이 다르다. ## 본문 `NotificationSchedulerWorker.close`와 `NotificationBackgroundWorkers.close` 둘 다 "취소 → shutdown → awaitTermination(grace) → shutdownNow"를 수행한다. 형태는 같지만 대상이 다르다(폴링 스레드 + virtual-thread executor 대 단일 데몬 scheduler). 중복 아님. ## NotificationSchedulerWorker 참조 위치 :::evidence key="adapter-outbound-notification-c02" alt="코드베이스에서 NotificationSchedulerWorker 를 검색한 출력 7줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="NotificationSchedulerWorker 코드베이스 검색 — 7줄 · exit 0" zoom="true" ::: ## 인터럽트가 닿지 않는 한 지점 스케줄러의 `close()`는 폴링 스레드를 `interrupt()`하지만(`:173`), `runOnce`의 `globalConcurrency.acquireUninterruptibly()`(`:90`)는 인터럽트에 반응하지 않는다. 주석(`:169`)은 "인터럽트가 poll-interval sleep을 깬다"고만 말하고 그 점은 정확하다. ## 그래도 결함으로 보지 않은 이유 세마포어는 in-flight 작업이 `finally`에서 반납하므로 결국 풀리고, 최악의 경우 `join(shutdownGrace)`가 만료된 뒤 종료가 계속된다. 결함 아님.