com.sun.enterprise.v3.admin.listener
Class CombinedJavaConfigSystemPropertyListener

java.lang.Object
  extended by com.sun.enterprise.v3.admin.listener.CombinedJavaConfigSystemPropertyListener
All Implemented Interfaces:
Startup, org.glassfish.hk2.PostConstruct, org.jvnet.hk2.config.ConfigListener

@Service
public final class CombinedJavaConfigSystemPropertyListener
extends Object
implements org.jvnet.hk2.component.PostConstruct, org.jvnet.hk2.config.ConfigListener, Startup

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:

  1. If any of the attributes of the java-config element (JavaConfig) change, this listener flags it as server-restart-required kind of change.
  2. 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.
  3. 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.
  4. 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.

Since:
GlassFish V3
Author:
केदार (km@dev.java.net)
See Also:
JavaConfig

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.glassfish.api.Startup
Startup.Lifecycle
 
Constructor Summary
CombinedJavaConfigSystemPropertyListener()
           
 
Method Summary
 org.jvnet.hk2.config.UnprocessedChangeEvents changed(PropertyChangeEvent[] events)
           
 Startup.Lifecycle getLifecycle()
           
 void postConstruct()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CombinedJavaConfigSystemPropertyListener

public CombinedJavaConfigSystemPropertyListener()
Method Detail

postConstruct

public void postConstruct()
Specified by:
postConstruct in interface org.glassfish.hk2.PostConstruct

getLifecycle

public Startup.Lifecycle getLifecycle()
Specified by:
getLifecycle in interface Startup

changed

public org.jvnet.hk2.config.UnprocessedChangeEvents changed(PropertyChangeEvent[] events)
Specified by:
changed in interface org.jvnet.hk2.config.ConfigListener


Copyright © 2012. All Rights Reserved.