Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nicolai Parlog
committed
Oct 12, 2018
1 parent
28a0d27
commit ece5eac
Showing
5 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,7 @@ | |
# Maven | ||
|
||
/target | ||
|
||
# Demos | ||
|
||
/app-cds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
set -e | ||
source executables.sh | ||
|
||
rm -rf app-cds | ||
mkdir app-cds | ||
|
||
if ! [ -e target/java-x.jar ] | ||
then | ||
printf "Building Maven project, so JAR is available...\n" | ||
mvn clean install | ||
fi | ||
|
||
printf "\n--- RUN WITHOUT CDS ---\n\n" | ||
time $java -jar target/java-x.jar | ||
|
||
printf "\n--- RUN WITH CDS ---\n" | ||
printf "\n > create archive for default JDK classes\n" | ||
sudo $java -Xshare:dump | ||
printf "\n > use default archive\n" | ||
time $java -Xshare:on -jar target/java-x.jar | ||
printf "\n > non-archived classes\n" | ||
$java -Xshare:on \ | ||
-Xlog:class+load \ | ||
-jar target/java-x.jar \ | ||
| grep -v "shared objects file" | ||
|
||
printf "\n--- RUN WITH APPLICATION CDS ---\n" | ||
printf "\n > record used classes\n" | ||
$java \ | ||
-XX:DumpLoadedClassList=app-cds/classes.lst \ | ||
-jar target/java-x.jar | ||
|
||
printf "\n > create archive for recorded classes\n" | ||
$java \ | ||
-Xshare:dump \ | ||
-XX:+UnlockDiagnosticVMOptions \ | ||
-XX:SharedClassListFile=app-cds/classes.lst \ | ||
-XX:SharedArchiveFile=app-cds/app.jsa \ | ||
--class-path target/java-x.jar | ||
|
||
printf "\n > use created archive\n" | ||
time $java \ | ||
-Xshare:on \ | ||
-XX:+UnlockDiagnosticVMOptions \ | ||
-XX:SharedArchiveFile=app-cds/app.jsa \ | ||
-jar target/java-x.jar \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/java/org/codefx/demo/java10/jvm/acds/HelloAppCDS.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.codefx.demo.java10.jvm.acds; | ||
|
||
public class HelloAppCDS { | ||
|
||
public static void main(String[] args) { | ||
System.out.println("Hello, application class-data sharing!"); | ||
} | ||
|
||
} |