Chapter 9. Reloading Classes at Runtime

Table of Contents

9.1. Overview
9.2. Basic Configurations and Operation
9.2.1. Configuring Servers
9.2.2. Configuring Applications
9.2.3. Configuration Results
9.2.4. Applications and Modifications Supported by JEUS HotSwap
9.2.5. JEUS HotSwap Constraints

This chapter describes servlet auto reloading that helps reduce the web application development time.

In general, the Java EE development life cycle consists of the following steps.

  1. Edit

  2. Build

  3. Deploy

  4. Test

Servlet classes are often modified when developing Java EE applications, especially web applications. Much effort has been made to shorten the development process, and WebLogic 10.3 provides functions that reduce the redeployment process through FastSwap.

Java EE 5 introduced a function that can redefine classes without terminating the class loader or instances while applications are running, but declared fields and methods cannot be modified.

Up to JEUS 6, to reload a modified class, the application must be redeployed or a new class loader must be created using automatic reloading to replace the existing class loader. Automatic reloading can be executed at a fixed interval or on demand.

However, if the application is too big, it takes a long time to redeploy the application and automatic reloading uses as much overhead as redeployment because it recreates the class loader.

JEUS 7 provides a function that can reload modified Java classes dynamically without reloading them(Automatic reloading) by using the JDK instrumentation package. This function is called JEUS HotSwap. It can currently only be used for web application classes.

Warning

The automatic reloading (JEUS HotSwap activated/inactivated)function can generate unexpected system overhead in a production environment, so it is recommended to only use it in a development environment.

This section describes how to configure and operate automatic reloading.

JEUS HotSwap supports POJOs and web application classes in exploded directories.

The following modifications are supported by JEUS HotSwap.

  • Adding and deleting static class constructors

  • Adding and deleting regular class constructors

  • Changing static method bodies

  • Changing regular method bodies

The following list of class modifications are supported by JEUS HotSwap.