Nuxeo Core Developer Guide

Supporting Hot Reload

Updated: March 11, 2019 Page Information Edit on GitHub

Hot reload has been partially supported over Nuxeo versions. The following instructions apply since Nuxeo 5.6 version (some of them were available in earlier version).

Hot reload involves a lot of layers, each one handling different kinds of caches. Server tries to keep contextual information which are not persisted and reload every services to take into account changes in Java code.

Setting up the Dev Mode

Hot reload is currently mainly interesting to ease up development. Enabling it means re-building part of the application, resetting caches that are needed for the application to work efficiently, etc. For this reason, using hot reload may not be suitable for production.

Hot reload support is controlled by the Nuxeo development mode. This mode can be activated by setting a runtime property in nuxeo.conf file (you'll need to restart your Nuxeo server):

  org.nuxeo.dev=true

The development mode should not be activated on a server in production.

Understanding Layers Involved in Hot Reload

When contributing a JAR to the Nuxeo application, what's a stake?

  • The JAR should be detected by the application.
  • Its contributions to Nuxeo extension points should be loaded.
  • Its contributions to other resources (XHTML files, message bundles, etc...) should be detected.
  • Some caches should be reset.

Hot Reloading Nuxeo Runtime Components

For this you need the java.io.File of your bundle, and you can call:

  Framework.getLocalService(ReloadService.class).reloadBundles(new ReloadContext().deploy(file));

Undeploy and deploy to the runtime framework were already possible as of Nuxeo 5.4.1: you can take example on what the ReloadService is doing to make it work in your version.

For more information, check out the ReloadService API. Note that Scripting Commands used by Marketplace packages already call ReloadService methods.

Note that reloading a bundle is working correctly only if the extension point registries it holds are correctly handling the contributions merging and removal. This can be easily set up by extending the Descriptor interface and implementing the merge method.

Hot Reloading the WAR

The WAR is rebuilt after each reload, taking care of changes to JARs/bundles deployed in the application:

When the WAR is up-to-date, it's a matter of forcing the application to detect changes.

a month ago manonlumeau NXDOC-204: Review hot reload sections
a month ago manonlumeau Review format
2 months ago manonlumeau NXDOC-1871: update Nuxeo sources retrieval
4 years ago Manon Lumeau 14
6 years ago Anahide Tchertchian 13 | rephrase first sentence to make it clear that this is supported since 5.6
6 years ago Solen Guitter 12 | NXDOC-242: Updated WebEngine paragraph to reflect NXP-12749 changes in 5.8
6 years ago Solen Guitter 11 | Added TOC
7 years ago Anahide Tchertchian 9
7 years ago Anahide Tchertchian 10 | Migrated to Confluence 4.0
7 years ago Anahide Tchertchian 8
7 years ago Anahide Tchertchian 7
7 years ago Anahide Tchertchian 6
7 years ago Anahide Tchertchian 5
7 years ago Anahide Tchertchian 4
7 years ago Anahide Tchertchian 3
7 years ago Anahide Tchertchian 2
7 years ago Anahide Tchertchian 1
History: Created by Anahide Tchertchian

We'd love to hear your thoughts!

All fields required