Preloading Gosu classes

PolicyCenter provides a preload mechanism to support preloading of Gosu classes, as well as other primary classes. The intent is to make the system more responsive the first time requests are made for that class. This is meant to improve application performance by preloading some of the necessary application types.

To support this, you can add the following to the preload.txt file in configuration > config > startup:

Static method invocations

Static method invocations dictate some kind of action and have the following syntax:

  type#method

The referenced method must be a static, no-argument method. However, the method can be on either a Java or Gosu type.

In the base configuration, Guidewire includes some actions on the gw.api.startup.PreloadActions class. For example, to cause all Gosu types to be loaded from disk, use the following:

gw.api.startup.PreloadActions#headerCompileAllGosuClasses

You can add additional lines that call static methods.

Type names

Type names can be either Gosu or Java types. You must use the fully-qualified name of the type. For any Java or Gosu type that you list in this file:

  • Java – PolicyCenter loads the associated Java class file.
  • Gosu – PolicyCenter parses and compiles the type to Java byte code, as well as any Gosu blocks and inner classes within that type.
You can specify particular server and environment restrictions for each line using the server and env attributes. For example:
gw.api.startup.PreloadActions#loadRestAPIDefintions env="prod" server="#rest"

The logging category Server.Preload provides DEBUG level logging of all actions and preloaded types.

See also

Populate the list of types

Before you begin

Before populating the list of types, perform whatever actions you need to within PolicyCenter interface.

Procedure

  1. Navigate to the Loaded Gosu Classes page (Server Tools > Info Pages).
  2. Copy and paste the list that you see there into the preload.txt file.

Results

The next time that you start the application server, PolicyCenter compiles those types on startup.