Dynamic Class Redefinition in Java Application Servers

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

The existing Java development cycle requires developers to edit, build, and deploy code before testing changes, which is time-consuming and loses non-serializable state data and running Servlets, Filters, and Listeners.

Innovation Solution

The system employs a ClassFileTransformer function that maintains the original shape of redefinable classes by using synthetic methods and fields, allowing dynamic redefinition of class files without altering their behavior or appearance to outside code, and utilizes a metadata structure to index and manage class members across versions.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If developers use traditional Java build and deploy cycle to make changes to deployed application, then code changes can be tested, but development time increases significantly

Engineering Contradiction:
Improvecode change testingVSAvoiddevelopment time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The system dynamically redefines class files at runtime without requiring a redeploy cycle. The ClassFileTransformer dynamically transforms class bytes to incorporate changes, and the redefinable ClassLoader loads and replaces class definitions on-the-fly, enabling continuous operation during development iterations.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The patent introduces intermediary components including the ClassFileTransformer that acts as a mediator between source code changes and the running application, and the metadata structure that mediates between old and new class versions, allowing changes to be applied without full redeployment.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If traditional deploy cycle is used to update class files, then code changes are applied, but non-serializable state data and running Servlets, Filters, and Listeners are lost

Engineering Contradiction:
Improvecode change applicationVSAvoidstate data
Core Design Contradiction:
ReliabilityVSLoss of substance

Solution Approach 1:

The system performs preliminary actions by maintaining metadata about class members before redefinition occurs. The metadata structure pre-identifies fields, methods, and other class elements, allowing the system to preserve state data and maintain running components during the transition from old to new class versions.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent discards only the class definition bytes while recovering and preserving the runtime state data, instantiated objects, and active Servlets, Filters, and Listeners. The metadata structure enables selective discarding of outdated class information while recovering valuable runtime state.

Inventive Principle:
Principle #34Discarding and recovering

3Productivity

If class files are redefined dynamically, then development time is reduced, but Java's class shape requirements must be maintained

Engineering Contradiction:
Improvedevelopment efficiencyVSAvoidclass structure management
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The system creates copies of class definitions in the metadata structure that mirror the original class shape. These copied class member definitions allow the system to manage dynamic redefinition while presenting a stable, unchanging class shape interface to the rest of the application, satisfying Java's requirements.

Inventive Principle:
Principle #26Copying

Data Source

PatentUS8615734B2System and method for dynamically redefining class files in an application server environment
Publication Date: 2013.12.24 ORACLE INT CORP
  • US8615734B2 patent drawing
  • US8615734B2 patent drawing
  • US8615734B2 patent drawing

AI summary

Disclosed herein is a system and method for dynamically redefining class files in a Java-based development environment. The existing development cycle in Java generally requires developers to edit, build, and deploy before they can test changes to the code. This process can be quite time consuming. There is a need for dynamically redefining and testing class files in a development environment without a significant time delay or loss of data. In one embodiment, when a developer modifies the class definition a ClassFileTransformer function is used to maintain the original shape of a redefinable class, i.e. its declared fields and methods, without affecting the redefined class' behavior or appearance to outside code.