SQL/MX Guide to Stored Procedures in Java (G06.24+, H06.03+)

Introduction
HP NonStop SQL/MX Guide to Stored Procedures in Java523727-004
1-18
Maintaining Class and JAR Files in an SPJ
Environment
During the execution of a CALL statement, if an SPJ method refers to an application
class, an SPJ class loader first searches the external path for the class and, if the class
is not found, it searches the class path.
For more information, see Setting the Class Path on page 2-22.
Maintaining Class and JAR Files in an SPJ Environment
You should not modify class and JAR files that are used by SPJs while active SPJ
environments exist. If you update the SPJ classes or referenced application classes on
disk, those changes might not be reflected in currently active SPJ environments,
leading to unpredictable and undesirable behavior of CALL statements.
Consider the maintenance implications described next.
Updating the Java Class Files of an SPJ Method
Suppose that you change an SPJ class while an SPJ environment remains active.
After you change the Java class, subsequent calls to the SPJ in the same SPJ
environment will cause NonStop SQL/MX to try to execute the old SPJ method, usually
resulting in an error. Although you changed the Java class file on disk, the old class of
the SPJ method remains cached in the JVM of the SPJ environment. After a class
loader loads a class file, it does not reload the same class file unless garbage
collection occurs.
Before installing an updated class file, or a JAR file that contains an updated class file,
and before issuing a CREATE PROCEDURE statement, always stop the calling
application, which ends the active SQL/MX UDR server process. For more information,
see Altering an SPJ and Its Java Class on page 4-13.
Updating the Java Class Files of a Referenced Application
Class
Suppose that two SPJs, each with a different external path location, depend on the
same application class outside the external path but within the class path. Because the
SPJ class loaders for each external path operate independently and do not share
information, each loads its own copy of the application class at different times in the
SPJ environment. Each time one of the SPJ class loaders loads an application class,
the class loader creates and manages a new copy of the application class and its static
variables. For an example, see Figure 1-8 on page 1-19.
Caution. To prevent unpredictable and undesirable behavior of CALL statements, do not
change SPJ classes or referenced application classes while SPJ environments are active. To
update a class file or a JAR file that contains classes, stop the calling application, which ends
the active SQL/MX UDR server process, install the updated class or JAR file, and then restart
the application.