Skip to content

Commit 48c0254

Browse files
committed
Update README.md to clarify Loom JDK requirements and streamline build instructions
1 parent f4d52e3 commit 48c0254

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

example-echo/README.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,29 @@ Prerequisites
1010

1111
How to build and run (minimal)
1212

13-
1) Build (from repository root):
13+
Note: This project requires a Loom-enabled JDK for both building and running because
14+
the code targets a recent Java release with preview features. Set `JAVA_HOME` to your
15+
Loom JDK before running the build and the server.
16+
17+
1) Build (from repository root)
1418

1519
```bash
16-
# build quickly (skip tests)
17-
mvn -DskipTests package
20+
# point to a Loom-enabled JDK first
21+
export JAVA_HOME=/path/to/loom/build/linux-x86_64-server-release/jdk/
22+
23+
# build the example-echo module and produce the shaded (uber) jar
24+
mvn -DskipTests -pl example-echo -am package
1825
```
1926

20-
2) Start the server (adjust `JAVA_HOME`):
27+
The shade plugin in `example-echo/pom.xml` creates an executable jar in
28+
`example-echo/target/` (artifact name: `example-echo-<version>.jar`).
2129

22-
```bash
23-
# compute runtime classpath for example-echo
24-
CP_LINE=$(mvn -q -pl example-echo dependency:build-classpath -DincludeScope=runtime -DskipTests | tail -n1)
25-
CP="core/target/netty-virtualthread-core-1.0-SNAPSHOT.jar:example-echo/target/example-echo-1.0-SNAPSHOT.jar:${CP_LINE}"
30+
2) Start the server (using the same Loom JDK)
2631

27-
# start server in background (use your Loom JDK)
28-
export JAVA_HOME=/path/to/loom/build/linux-x86_64-server-release/jdk/
32+
```bash
2933
"$JAVA_HOME/bin/java" --enable-preview \
3034
-Djdk.virtualThreadScheduler.implClass=io.netty.loom.NettyScheduler \
31-
-Djdk.pollerMode=3 \
32-
--add-opens=java.base/java.lang=ALL-UNNAMED \
33-
-cp "$CP" io.netty.loom.example.EchoServer &
35+
-jar example-echo/target/example-echo-1.0-SNAPSHOT.jar &
3436

3537
# note the PID in $!
3638
```
@@ -47,10 +49,10 @@ curl -v http://localhost:8080/
4749

4850
```bash
4951
# short 5s test
50-
jbang wrk@hyperfoil -t1 -c10 -d5s -R10 --latency http://localhost:8080/
52+
jbang wrk@hyperfoil -t1 -c10 -d5s http://localhost:8080/
5153
```
5254

5355
Notes
54-
- `-Djdk.pollerMode=3` enables per-carrier pollers (useful for blocking I/O tests). Remove or change if you don't need it.
55-
- Use a Loom-enabled JDK and set `JAVA_HOME` accordingly.
56+
- `-Djdk.pollerMode=3` is optional; only add it if you need per-carrier pollers for blocking I/O tests.
57+
- Use a Loom-enabled JDK and set `JAVA_HOME` accordingly before build and run.
5658
- If anything fails, paste the exact output here and I'll help debug.

0 commit comments

Comments
 (0)