Skip to content

Commit 73a3f6b

Browse files
committed
Review and move native-netty-plot to archive
1 parent 60905ec commit 73a3f6b

File tree

10 files changed

+36
-41
lines changed

10 files changed

+36
-41
lines changed

.github/workflows/native-netty-plot.yml renamed to .github/workflows/archive-native-netty-plot.yml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,33 @@
1-
name: native-netty-plot
1+
name: archive/native-netty-plot
22
on:
33
push:
44
paths:
5-
- 'native-netty-plot/**'
6-
- '.github/workflows/native-netty-plot.yml'
5+
- 'archive/native-netty-plot/**'
6+
- '.github/workflows/archive-native-netty-plot.yml'
77
pull_request:
88
paths:
9-
- 'native-netty-plot/**'
10-
- '.github/workflows/native-netty-plot.yml'
11-
schedule:
12-
- cron: "0 0 1 * *" # run every month
9+
- 'archive/native-netty-plot/**'
10+
- '.github/workflows/archive-native-netty-plot.yml'
1311
workflow_dispatch:
1412
permissions:
1513
contents: read
1614
jobs:
1715
run:
18-
name: Run 'native-netty-plot'
16+
name: Run 'archive/native-netty-plot'
1917
runs-on: ubuntu-latest
2018
timeout-minutes: 20
21-
strategy:
22-
matrix:
23-
java-version: ['21', 'dev']
2419
steps:
2520
- uses: actions/checkout@v4
2621
- uses: graalvm/setup-graalvm@v1
2722
with:
28-
java-version: ${{ matrix.java-version }}
23+
java-version: '21'
2924
distribution: 'graalvm'
3025
github-token: ${{ secrets.GITHUB_TOKEN }}
3126
cache: 'maven'
3227
native-image-job-reports: 'true'
33-
- name: Run 'native-netty-plot'
28+
- name: Run 'archive/native-netty-plot'
3429
run: |
35-
cd native-netty-plot
30+
cd archive/native-netty-plot
3631
mvn --no-transfer-progress package
3732
java -agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image/com.oracle.substratevm/netty-plot -jar target/netty-plot-0.1-jar-with-dependencies.jar &
3833
pid=$!

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ cd graalvm-demos
5656
<td align="left" width="70%">Demonstrates how you can influence the classes initialization at the image build time<br><strong>Technologies: </strong>Native Image, Maven<br><strong>Reference: </strong><a href="https://medium.com/graalvm/understanding-class-initialization-in-graalvm-native-image-generation-d765b7e4d6ed">Understanding Class Initialization in GraalVM Native Image Generation</a></td>
5757
</tr>
5858
<tr>
59-
<td align="left" width="30%"><a href="/native-netty-plot/">native-netty-plot</a><br><a href="https://github.com/graalvm/graalvm-demos/actions/workflows/native-netty-plot.yml"><img alt="native-netty-plot" src="https://github.com/graalvm/graalvm-demos/actions/workflows/native-netty-plot.yml/badge.svg" /></a></td>
60-
<td align="left" width="70%">A web server application, using the Netty framework, to demonstrate the use of isolates with Native Image<br><strong>Technologies: </strong>Native Image, Maven, Netty<br><strong>Reference: </strong><a href="https://medium.com/graalvm/instant-netty-startup-using-graalvm-native-image-generation-ed6f14ff7692">Instant Netty Startup using GraalVM Native Image Generation</a></td>
59+
<td align="left" width="30%"><a href="/javagdbnative/">javagdbnative</a><br><a href="https://github.com/graalvm/graalvm-demos/actions/workflows/javagdbnative.yml"><img alt="javagdbnative" src="https://github.com/graalvm/graalvm-demos/actions/workflows/javagdbnative.yml/badge.svg" /></a></td>
60+
<td align="left" width="70%">Demonstrates how to debug a Java application, built into a native executable in VS Code<br><strong>Technologies: </strong>Native Image, Maven, GraalVM Tools for Java<br><strong>Reference: </strong><a href="https://medium.com/graalvm/native-image-debugging-in-vs-code-2d5dda1989c1">Native Image Debugging in VS Code</a></td>
6161
</tr>
6262
<tr>
6363
<td align="left" width="30%"><a href="/native-image/add-logging/">native-image/add-logging</a><br><a href="https://github.com/graalvm/graalvm-demos/blob/ni-logging-demo/.github/workflows/native-image-add-logging.yml"><img alt="add-logging" src="https://github.com/graalvm/graalvm-demos/actions/workflows/native-image-add-logging.yml/badge.svg" /></a></td>

archive/native-netty-plot/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
target/
2+
netty-plot

native-netty-plot/README.md renamed to archive/native-netty-plot/README.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Isolates for GraalVM Native Images
1+
# Use of Isolates with Native Image
22

33
This application demonstrates the use of _isolates_ with [GraalVM Native Image](https://www.graalvm.org/latest/reference-manual/native-image/).
44
The code implements a web service that renders plots of mathematical functions, such as _sin(x)_.
@@ -22,33 +22,34 @@ There is also the [Maven plugin for GraalVM Native Image building](https://graal
2222
git clone https://github.com/graalvm/graalvm-demos
2323
```
2424
```bash
25-
cd graalvm-demos/native-netty-plot
25+
cd graalvm-demos/archive/native-netty-plot
2626
```
27+
2728
For compilation, the `native-image` depends on the local toolchain.
28-
Please make sure that `glibc-devel`, `zlib-devel` (header files for the C library and zlib), and `gcc` are available on your system. Some Linux distributions may additionally require `libstdc++-static`.
29+
Make sure that `glibc-devel`, `zlib-devel` (header files for the C library and zlib), and `gcc` are available on your system. Some Linux distributions may additionally require `libstdc++-static`.
2930
See [Prerequisites for Native Image](https://www.graalvm.org/latest/reference-manual/native-image/#prerequisites).
3031

31-
## Build the Project
32+
## Build the Application
3233

3334
The example is built with Maven:
3435
```bash
3536
mvn package
3637
```
3738

38-
This creates a JAR file with all dependencies embedded: `target/netty-plot-0.1-jar-with-dependencies.jar`.
39+
This creates a JAR file with all dependencies embedded in the _target/_ directory.
3940

4041
## Generate a Native Executable
4142

4243
If the application is expected to use some dynamic features at run time (e.g., Reflection, Java Native Interface, class path resources), they have to be provided to the `native-image` tool in the form of configuration files.
4344
To avoid writing the configuration file yourself, apply the [tracing agent](https://www.graalvm.org/latest/reference-manual/native-image/metadata/AutomaticMetadataCollection/) when running on the Java HotSpot VM.
4445
It will observe the application behavior and create configuration files (_jni-config.json_, _reflect-config.json_, _proxy-config.json_ and _resource-config.json_) in the _META-INF/native-image_ directory on the class path.
45-
The _reflect-config.json_ file specifies classes which must be available via Java reflection at runtime.
46+
The _reflect-config.json_ file specifies classes which must be available via Java reflection at run time.
4647

47-
1. Run the application on GraalVM JDK applying the tracing agent:
48+
1. Run the application on the GraalVM JDK applying the tracing agent:
4849
```bash
4950
java -agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image -jar target/netty-plot-0.1-jar-with-dependencies.jar
5051
```
51-
The server is started. Open _http://127.0.0.1:8080/?useIsolate=false_ in the browser to see the output.
52+
The server is started. Open [http://127.0.0.1:8080/?useIsolate=false](http://127.0.0.1:8080/?useIsolate=false) in the browser to see the output.
5253

5354
2. Terminate the application, `CTRL+C`.
5455

@@ -58,33 +59,34 @@ The _reflect-config.json_ file specifies classes which must be available via Jav
5859
```
5960
The result is an executable file that is around 22 MByte in size:
6061
```bash
61-
du -h netty-plot
62-
22M netty-plot
62+
du -h target/netty-plot
6363
```
6464

6565
4. You can now run the executable:
6666
```bash
6767
./netty-plot
6868
```
69-
Open your web browser and navigate to http://127.0.0.1:8080/
69+
Open your web browser and navigate to [http://127.0.0.1:8080/](http://127.0.0.1:8080/)
7070

71-
5. Finally, you can open your browser and request rendering of a function, for example, by browsing to `http://127.0.0.1:8080/?function=abs((x-31.4)sin(x-pi/2))&xmin=0&xmax=31.4`.
71+
5. Finally, you can open your browser and request rendering of a function, for example, by browsing to [http://127.0.0.1:8080/?function=abs((x-31.4)sin(x-pi/2))&xmin=0&xmax=31.4](http://127.0.0.1:8080/?function=abs((x-31.4)sin(x-pi/2))&xmin=0&xmax=31.4).
7272

7373
### Background Information
7474

7575
Instead of specifying any additional parameters on the command line, they may provided in a properties file in the input JAR file.
76-
The `native-image` builder automatically looks for files named `native-image.properties` and for any other configuration file under `META-INF/native-image` including subdirectories, and processes their contents.
76+
The `native-image` builder automatically looks for files named _native-image.properties_ and for any other configuration file under _META-INF/native-image_ including subdirectories, and processes their contents.
7777
The tracing agent writes the _reflect-config.json_ file specifying classes which must be available via Java reflection at run time.
7878

79-
With Maven projects, the path convention is `META-INF/native-image/${groupId}/${artifactId}/native-image.properties`.
80-
In this example, the `META-INF/native-image/com.oracle.substratevm/netty-plot/native-image.properties` file contains the following:
79+
With Maven projects, the path convention is _META-INF/native-image/${groupId}/${artifactId}/native-image.properties_.
80+
In this example, the _META-INF/native-image/com.oracle.substratevm/netty-plot/native-image.properties_ file contains the following:
8181
```bash
8282
ImageName = netty-plot
8383
Args = --link-at-build-time
8484
```
8585
The `ImageName` property specifies the name of the resulting executable, while `Args` are treated like additional command-line arguments.
8686

87-
### A note about the application
87+
#### A note about the application
8888

89-
This example cannot run as a regular Java application (on the JVM) and it cannot be profiled.
89+
This example cannot run as a regular Java application (on HotSpot) and it cannot be profiled.
9090
It will fail because the program tries to create an [isolate which is a Native Image specific feature](https://medium.com/graalvm/isolates-and-compressed-references-more-flexible-and-efficient-memory-management-for-graalvm-a044cc50b67e).
91+
92+
Read more in the blog post [Instant Netty Startup using GraalVM Native Image Generation](https://medium.com/graalvm/instant-netty-startup-using-graalvm-native-image-generation-ed6f14ff7692).

native-netty-plot/pom.xml renamed to archive/native-netty-plot/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<properties>
1010
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1111
<java.version>21</java.version>
12-
<native.maven.plugin.version>0.9.28</native.maven.plugin.version>
12+
<native.maven.plugin.version>0.10.4</native.maven.plugin.version>
1313
<maven.compiler.source>${java.specification.version}</maven.compiler.source>
1414
<maven.compiler.target>${java.specification.version}</maven.compiler.target>
1515
</properties>
@@ -60,7 +60,7 @@
6060
<imageName>${imageName}</imageName>
6161
<fallback>false</fallback>
6262
<buildArgs>
63-
--no-fallback
63+
<buildArg>--no-fallback</buildArg>
6464
</buildArgs>
6565
<agent>
6666
<enabled>true</enabled>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ImageName = netty-plot
2+
Args = --link-at-build-time=com.oracle.svm.nettyplot

native-netty-plot/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

native-netty-plot/src/main/resources/META-INF/native-image/com.oracle.substratevm/netty-plot/native-image.properties

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)