Commit d9a6a83
committed
Fix ArchUnit violations from the new server code (layering + no-sleep)
Two LlamaArchitectureTest rules failed on PR #293 because of this branch's server
additions:
- layeredArchitecture (12 violations): the branch adds two legitimate new edges
out of the Server layer -- Server -> Args (OpenAiServerCli maps -ctk/-ctv to the
args.CacheType enum) and Server -> Loader (NativeServer.start() calls
LlamaLoader.initialize() before launching the embedded native server). The rule
documents itself as the EXACT set of accessors today, to be updated when a new
dependency is intended, so Server is added to the Loader and Args
mayOnlyBeAccessedByLayers lists (+ a doc note). Server remains the only layer
allowed to reach the Api root and stays mayNotBeAccessedByAnyLayer.
- noThreadSleep (1 violation): NativeServer.main() kept the JVM alive with a
while(isRunning()) Thread.sleep(200) poll loop. The rule bans Thread.sleep and has
no suppression seam (it prefers Condition.await/poll), so main() now blocks on a
bounded CountDownLatch.await(200ms) signalled by the shutdown hook. This is also a
behavioural improvement: Ctrl-C/SIGTERM wakes the wait immediately instead of after
up to a 200 ms tick, while the timeout still re-checks isRunning() to catch a
self-terminated native worker.
Verified: LlamaArchitectureTest 12/12 pass; server-package tests 44/44 pass
(ServerLauncher, OpenAiServerCli, NativeServerSmoke); javadoc + spotless clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HL7d4uQ3cKR5HwYFPvZvv71 parent 5664957 commit d9a6a83
2 files changed
Lines changed: 18 additions & 7 deletions
File tree
- llama/src
- main/java/net/ladenthin/llama/server
- test/java/net/ladenthin/llama
Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
198 | 200 | | |
199 | 201 | | |
200 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
201 | 207 | | |
202 | 208 | | |
203 | 209 | | |
204 | 210 | | |
205 | 211 | | |
206 | 212 | | |
207 | 213 | | |
| 214 | + | |
208 | 215 | | |
209 | 216 | | |
210 | 217 | | |
211 | 218 | | |
212 | | - | |
213 | | - | |
214 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
215 | 224 | | |
216 | 225 | | |
217 | 226 | | |
| |||
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
98 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
| |||
121 | 123 | | |
122 | 124 | | |
123 | 125 | | |
124 | | - | |
| 126 | + | |
125 | 127 | | |
126 | 128 | | |
127 | 129 | | |
| |||
133 | 135 | | |
134 | 136 | | |
135 | 137 | | |
136 | | - | |
| 138 | + | |
137 | 139 | | |
138 | 140 | | |
139 | 141 | | |
| |||
0 commit comments