Controlling dynamic updates

Three types of dynamic update can be controlled through configuration: changing the server configuration; adding and removing applications; updating installed applications. For all deployed applications, you can configure whether application monitoring is enabled and how often to check for updates to applications. For the dropins directory, you can also configure the name and location of the directory and choose whether to deploy the applications that are in the directory.

About this task

By default, deployed applications are monitored for updates, and the updates are dynamically applied to the running application. This applies both to applications that are deployed through configuration entries, and those deployed from the dropins directory. You can change these default behaviors by setting the config and applicationMonitor elements in the server.xml configuration file. You can use a text editor to do this, or you can use the developer tools and select Configuration Admin Service or Application Monitor in the server configuration design view.

See also the descriptions of the config and applicationMonitor elements in Enterprise JavaBeans Lite 3.1, Liberty Kernel, Java Servlets 3.0, and OSGi Blueprint.

The default settings for application monitoring are as follows:
<applicationMonitor updateTrigger="polled" pollingRate="500ms" 
                    dropins="dropins" dropinsEnabled="true"/>
The default settings for configuration monitoring are as follows:
<config updateTrigger="polled" monitorInterval="500ms"/>
Notes:
  • The updateTrigger property has three possible values:
    polled
    The runtime environment scans the server.xml file for changes by using the timing interval that is specified by the monitorInterval property.
    mbean
    The runtime environment looks for updates only when it is prompted to do so through a call to an MBean. This mode is used by the developer tools to update the server.xml file, unless you override it. The provided FileNotificationMBean MBean can be called to trigger an application update.
    disabled
    The updates are not dynamically applied.
  • When you specify the pollingRate property or the monitorInterval property, you include the unit of time after the number:
    • ms (milliseconds)
    • s (seconds)
    • m (minutes)
    • h (hours)
  • The dropins property specifies the name of the directory that is used as the dropins directory.
  • The dropinsEnabled property is a boolean property that determines whether the applications in the dropins directory are deployed.

Procedure

  • Configure dynamic changes to the server configuration.
    Changes to the server.xml file, or any files it includes, are detected by the runtime environment and applied to the active configuration. You can disable this behavior by setting the config element in the server.xml file:
    <config updateTrigger="disabled"/>

    You can also control dynamic updates to the server configuration through a provided mbean by setting the config element in the server.xml file:

    <config updateTrigger="mbean"/>

    You can then use the FileNotificationMbean to notify the server which configuration file or files you want to be dynamically reprocessed.

  • Configure dynamic addition and removal of applications.
    As described in Deploying applications in Liberty, applications can be dynamically added to and removed from the server runtime environment through two mechanisms:
    • By adding or removing application entries in the server.xml file.

      If you disable dynamic changes to the server configuration as described in the previous step, then adding or removing application entries has no effect on a running server. Your changes are only applied at the next server restart. The changes are picked up immediately, if you update application entries by using the developer tools.

    • By moving application files into and out of the dropins directory.
      This behavior can be controlled by setting the applicationMonitor element in the server.xml file. For example, to disable dynamic installation of applications from the dropins location, create an entry as follows:
      <applicationMonitor dropinsEnabled="false"/>
  • Configure dynamic updates to installed applications.
    By default, if you add, remove or modify any files within a deployed application, or you replace the whole application with an updated version, the previous version is automatically stopped and the new version is started. This process applies for any deployed application, whether the application is in the dropins directory or at a location that is defined in the server.xml file. You can control this behavior by setting the applicationMonitor element in the server.xml file. For example, to disable dynamic update of all applications, create an entry as follows:
    <applicationMonitor updateTrigger="disabled"/>
  • Configure the name and location of the dropins directory.
    By default, the dropins directory is ${server.config.dir}/dropins. You can change this value by setting the applicationMonitor element in the server.xml file. For the location, you can use any known variable, or a property in the bootstrap.properties file, or an absolute path, or a path relative to the server directory. For example, both the following settings point to the same location:
    <applicationMonitor dropins="${server.config.dir}/applications" />
    <applicationMonitor dropins="applications" />
    Restriction: For web service applications, if the service client and service provider are not in the same application and the WSDL file in the service provider application is changed, you need to restart the web service client application manually to avoid the WSDL definition cache issue.