Listens for the changes to the configuration of JVM and Java system properties (including the Java VM options). Most of the effort involves the jvm-options list, but restart is also required for any changes to the java-config.
This class is implemented so that the server restart is NOT required if a deployer wants to deploy an application and the application depends on a particular Java system property (-D) to be specified. As of now, the deployer specifies the system property and deploys the application and the application should find it when it does System.getProperty("property-name"). Here is the complete algorithm:
- If any of the attributes of the java-config element (JavaConfig) change, this listener flags it as server-restart-required kind of change.
- If a system property is being defined and it is NOT one that starts with "-Djava." or "-Djavax.", it will be immediately set in the System using System.setProperty() call. A server restart won't be needed.
- If any other JVM option is defined that does not start with "-D" (excluding the cases covered above), it is deemed to be a JVM option resulting in server-restart-required flag set.
- If a System Property (with above distinctions) is removed, System.clearProperty() is called and server-restart-required flag is set accordingly.
Change in the value of a particular system property level is not handled explicitly. User interfaces should take a note of it. e.g. CLI does not make -Dfoo=bar and -Dfoo=bar1 as same properties being set to two different values since it is hard to distinguish it in general case. Users should delete -Dfoo=bar and add -Dfoo=bar1explicitly in this case.
@author केदार (km@dev.java.net)
@since GlassFish V3
@see com.sun.enterprise.config.serverbeans.JavaConfig