Shared class cache

Shared class cache provides a mechanism for multiple JVMs to share Java™ application classes stored in a single cache. The IBM® SDK for z/OS® supports shared class cache. Class cache can be used with OSGi JVM servers, and with non-OSGi JVM servers such as Apache Axis2.

Java 7, not CICS®, provides support for using the class cache function with JVM servers. Therefore, you cannot use CICS SPI or CEMT commands to enable or disable a JVM server class cache. To enable or disable a JVM server class cache, you use JVM command line parameters. You also use a JVM command line parameter to set the class cache size.

The following components (files, objects, variables, and compiled classes) are not loaded into class cache:
  • Native C DLL files specified on the JVM profile library path. These are not loaded because a single copy of each DLL file is used by all JVMs that require access to the file.
  • Application objects and variables. These are not loaded because working data is stored in the JVMs.
  • Just-in-time (JIT) compiled classes. These are not loaded but are stored in the JVMs because the compilation process for different workloads can vary.

Enabling the cache

By default, class cache is disabled in the JVM. To enable class cache you use a JVM command line parameter, for example:
-Xshareclasses:name=cics.&APPLID;

Specifying cache size

To specify class cache size, you use a JVM command line parameter. For example, the following parameter sets the size to 20M:
-Xscmx20M
Important: If your cache was created using a different compressedRefs setting than that currently in effect within the JVM, you will receive a message indicating you should use the correct JVM level. In such situations, you should check that the compressedRefs settings in effect when you created your cache, are the same as those in effect when your JVM was created.

For more information about Java class data sharing see Class data sharing between JVMs.