CICS® includes a shared class cache facility for the JVM. The shared class cache is created using the JVM's -Xjvmset option. Multiple JVMs can share a single cache of class files that have already been loaded, including some that have been optimized by compilation. The shared class cache replaces the system heap and the application-class system heap for those JVMs, and it can contain middleware and application classes. JVMs that use the shared class cache start up more quickly, and have lower storage requirements, than JVMs that don't.
The shared class cache is initialized by a JVM referred to as the master JVM. The master JVM cannot be used to run Java™ applications; it exists only to initialize and own the shared class cache. The master JVM obtains shared memory in which its system heap is allocated. The system heap contains class files (including those that have been optimized by compilation) which can be shared by all the worker JVMs, and the rest of the shared memory contains other information that is common to the master and worker JVMs, such as the class loading paths needed to load classes into the shared class cache. The master JVM can be defined as a resettable JVM, with the option REUSE=RESET or the older option Xresettable=YES in its JVM profile, or as a continuous JVM, with the option REUSE=YES in its JVM profile. If none of these options is included, CICS assumes that the master JVM is resettable. The master JVM runs on its own open TCB, the JM TCB. JM TCBs are not used for any other purpose. They do not count towards the MAXJVMTCBS limit, and they cannot be reused like the J8 and J9 TCBs in the JVM pool.
The JVMs that share the class cache are referred to as worker JVMs, and they can be used to run Java applications. The worker JVMs use the classes loaded in the shared class cache, instead of having to load these classes from the file system. Although the worker JVMs share the class cache, each worker JVM owns all the working data (objects and static variables) for the applications that run in it. This helps to maintain the isolation between the Java applications being processed in the system.
The worker JVMs in a CICS region all have the same level of reusability as the master JVM. How JVMs are reused explains the levels of reusability for JVMs. If the master JVM is a resettable JVM, the worker JVMs are also resettable, and if the master JVM is a continuous JVM, the worker JVMs are also continuous. (Single-use JVMs cannot use the shared class cache.) If the REUSE or Xresettable options are included in the JVM profile for a worker JVM, they are ignored.
CICS supports one active shared class cache in each region. (A region might also contain old shared class caches that are being phased out.) The shared class cache can support the majority of the JVMs in each region. Some of the JVMs in the region might not be suited to sharing the class cache, because they are debug JVMs used for problem diagnosis, or because they have an inappropriate level of reusability. These JVMs can still run as standalone JVMs, and have their own cache of classes in their storage heaps.
The library path and trusted middleware class path for the shared class cache are defined in the JVM profile for the master JVM, and the shareable application class path for the shared class cache is defined in the JVM properties file for the master JVM. For a worker JVM, CICS ignores these class paths if they are specified in the worker's own JVM profile and JVM properties file, and instead uses the values specified for these class paths in the JVM profile and JVM properties file for the master JVM.
This means that for a worker JVM, items on the library path, middleware classes, and shareable application classes must be included in the class paths in the JVM profile and JVM properties file for the master JVM that initializes the shared class cache, rather than in the JVM profile and JVM properties file for the JVM where the application will run. The library path is defined by the LIBPATH option in the JVM profile, and the trusted middleware class path is defined by the CICS_DIRECTORY, TMPREFIX, and TMSUFFIX options in the JVM profile. The shareable application class path is defined by the ibm.jvm.shareable.application.class.path system property in the JVM properties file.
The standard class path (defined by the CLASSPATH option in the JVM profile) is the only class path that is taken from the profile for the worker JVM itself, rather than from the profile for the master JVM. Classes on this class path are loaded into the individual worker JVMs, and are not cached in the shared class cache. Adding classes to this class path is detrimental to performance for a resettable worker JVM, because the classes are reloaded every time the JVM is reset. For a continuous worker JVM, these classes are kept intact from one JVM reuse to the next, so there is no need to reload them, but having the classes in every JVM uses more storage than having a single copy in the master JVM. For these reasons, you should avoid using the standard class path for worker JVMs in a production environment.
Any worker JVM can modify the shared class cache. When worker JVMs perform just-in-time (JIT) compilation of classes that are in the shared class cache, they write the results of the compilation to the shared class cache, so that other worker JVMs can use the compiled classes. The master JVM that initializes the shared class cache is invoked in user key, so that worker JVMs that were invoked in user key can read and write to the shared class cache. Even if all the worker JVMs that share the class cache are invoked in CICS key, the master JVM and the shared class cache are still in user key.
Setting up the shared class cache tells you how to set up a shared class cache in a CICS region, and how to enable JVMs to use it.
You can manage the shared class cache using CICS commands. You can prevent the shared class cache from starting automatically, start it manually, adjust its size, update the classes or JAR files that it contains, or terminate it. You can also monitor its status. Managing the shared class cache tells you how to operate the shared class cache.