The keycloak project ended with four open questions that design could not
settle. A two-VM lab was built to answer them by measurement, and this is
that material: 26 experiments, 125 raw command outputs, 22 browser captures.
Follows the import procedure in README.md.
source/ the originating repository verbatim — 78 documents, 28 SVGs,
8 manifests, plus .source-revision recording the commit
final/ the SSOT
document.md 729 lines written from the 29 experiment documents, not
concatenated: what was predicted, what was measured, and
where the measurement itself was wrong
evidence/raw 125 outputs, flattened to <experiment>__<file> because
the originals collided (01-baseline.txt appeared three
times) and the audit only globs the top level
evidence/meta one per raw file; command and exitCode are null and the
README says why rather than inventing them
evidence/browser 22 captures
assets/ three diagrams through techviz
.techviz/ their VizSpecs
A separate project rather than an addition to keycloak: the B-layer answers
that project's four questions, but the A, C and D layers are about cluster
failure, SSO and operations, and one document.md should hold one subject.
The four question records there can point here through 관계.
Recorded rather than papered over: only three of the 28 diagrams were
remade. The repository forbids hand-drawn SVG and forbids titles inside the
canvas; all 28 originals carry both, so converting them is redrawing, not
reformatting. They stay in source/ and the gap is written into the document.
verify-pipeline.py passes. audit-records.py reports no issues.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
51 lines
2.7 KiB
Markdown
51 lines
2.7 KiB
Markdown
---
|
|
kind: CONCEPT
|
|
slug: messaging-testkit-c07
|
|
title: 가변인데 공유되지 않아서 안전한 것들
|
|
topic: state-machines-and-ownership
|
|
project: clean-architecture-backend-template
|
|
status: 게시 전
|
|
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
|
|
rootTreeNode: concept:messaging-testkit-c07
|
|
evidenceCapturedOn: 2026-09-01
|
|
assets:
|
|
- key: messaging-testkit-c07
|
|
file: ../../../final/evidence/rendered/messaging-testkit-c07.svg
|
|
evidence:
|
|
- ../../../final/evidence/raw/messaging-testkit-c07.txt
|
|
source:
|
|
- 원본 분석 절은 analysis/messaging/messaging-testkit.md#L539 이다.
|
|
module: messaging-testkit
|
|
---
|
|
|
|
# 가변인데 공유되지 않아서 안전한 것들
|
|
|
|
트랜잭션이 없고 동시성 관련해서 세 가지를 확인했다. 가변 타입이 둘 있지만 실제 사용 패턴에서 공유되지 않는다.
|
|
|
|
## 본문
|
|
|
|
<!-- body:start -->
|
|
|
|
트랜잭션 없음. 동시성 관련해서 세 가지를 확인했다.
|
|
|
|
**`CertifiedEvidence.RECORDED` 는 `static final` 이며 클래스 초기화 시 1회 로드된다**(`:34`). JVM 클래스 초기화 락이 스레드 안전을 보장하고, 반환되는 `List` 는 `Stream.toList()` 결과라 불변이다. 테스트가 병렬로 돌아도 안전하다.
|
|
|
|
## CertifiedEvidence 참조 위치
|
|
|
|
:::evidence key="messaging-testkit-c07" alt="코드베이스에서 CertifiedEvidence 를 검색한 출력 21줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="CertifiedEvidence 코드베이스 검색 — 21줄 · exit 0" zoom="true"
|
|
:::
|
|
|
|
## 가변인데 공유되지 않는다
|
|
|
|
**`BrokerFailureMatrix` 는 가변이고 동기화가 없다**(`LinkedHashMap`, `:23`). 그러나 `from(...)` 이 매번 새 인스턴스를 만들고 그 안에서만 `record(...)` 를 호출한 뒤 반환하므로, 실제 사용 패턴에서 공유되는 인스턴스가 없다. `CrossBrokerContractSuite` 는 필드 하나(`:34`)를 갖지만 JUnit5 기본 생명주기가 메서드당 인스턴스라 매 테스트가 자기 행렬을 만든다. `public BrokerFailureMatrix record(...)` 가 노출되어 있어 원리상 외부에서 공유·변형할 수 있으나, 실제 그런 호출부는 0건이다.
|
|
|
|
## 결정론이 목적인 비동기화
|
|
|
|
**`InMemoryMessagingHarness` 는 전부 비동기화 컬렉션**(`ArrayDeque`, `ArrayList`, `LinkedHashSet`)이고 `CompletableFuture.completedFuture(...)` 로 즉시 완료한다. 결정론이 목적이므로 옳다 — 실제 스레드 전환이 하나도 없다.
|
|
|
|
## 플래그만 바꾸는 구현을 통과시키지 않는다
|
|
|
|
수명주기는 `MessagingAdapterHarness` 의 두 메서드에 압축되어 있다. `stopsAcceptingNewWorkDuringShutdown` 이 `beginShutdown()` 후 `isAcceptingWork()==false` 와 발행 로컬 거절 둘 다를 요구한다.
|
|
|
|
<!-- body:end -->
|