-
Sub-task
-
Resolution: Delivered
-
P4
-
13
-
Verified
JEP 350 extends application class-data sharing ([AppCDS](https://openjdk.java.net/jeps/310)) to allow the dynamic archiving
of classes as a Java application is exiting. It also improves the usability of AppCDS by
eliminating the need for users to do trial runs to create a class list for each application. The existing
static archiving enabled by the `-Xshare:dump` option, using a class list, continues work as is.
The dynamically-generated archive is created on top of the default system archive packaged with the
running JDK image. A separate top-layer archive file is generated for each application. The user can
specify the filename of the dynamic archive name as the argument to the `-XX:ArchiveClassesAtExit`
option. For example, the following command creates `hello.jsa`:
```
% bin/java -XX:ArchiveClassesAtExit=hello.jsa -cp hello.jar Hello
```
To run the same application using this dynamic archive:
```
% bin/java -XX:SharedArchiveFile=hello.jsa -cp hello.jar Hello
```
The user could also specify both the base and the dynamic archives in the `-XX:SharedArchiveFile` option such as:
```
-XX:SharedArchiveFile=<base archive>:<dynamic archive>
```
[CSRJDK-8221706](https://bugs.openjdk.java.net/browse/JDK-8221706) has more details on the command line option.
of classes as a Java application is exiting. It also improves the usability of AppCDS by
eliminating the need for users to do trial runs to create a class list for each application. The existing
static archiving enabled by the `-Xshare:dump` option, using a class list, continues work as is.
The dynamically-generated archive is created on top of the default system archive packaged with the
running JDK image. A separate top-layer archive file is generated for each application. The user can
specify the filename of the dynamic archive name as the argument to the `-XX:ArchiveClassesAtExit`
option. For example, the following command creates `hello.jsa`:
```
% bin/java -XX:ArchiveClassesAtExit=hello.jsa -cp hello.jar Hello
```
To run the same application using this dynamic archive:
```
% bin/java -XX:SharedArchiveFile=hello.jsa -cp hello.jar Hello
```
The user could also specify both the base and the dynamic archives in the `-XX:SharedArchiveFile` option such as:
```
-XX:SharedArchiveFile=<base archive>:<dynamic archive>
```
[CSR