Java Class Reloading via State and Behavior Segmentation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing Java Virtual Machine (JVM) technologies do not efficiently reload changed classes without re-loading unchanged classes, leading to long startup times and resource consumption during application development and testing.
Innovation Solution
A method and system that split the original class into a state class and a behavior class, with the state class simulating the original class's signature through proxying and redirecting method calls to the latest version of the behavior class using reflection, allowing for efficient reloading of changed classes without re-loading other unchanged classes.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If standard JVM reloads class loaders along with all their classes, then class reloading is supported, but all current class instances are lost and reloading time is long
Solution Approach 1:
The patent segments the class reloading process by introducing a state preservation mechanism that separates instance state from class definition. The state class captures the runtime state of instances before reloading, allowing the class to be reloaded without losing instance data. This segmentation enables selective reloading of only the modified class rather than the entire class loader hierarchy.
Solution Approach 2:
The patent performs preliminary actions by serializing and storing the state of class instances before the reload operation. The state class is created and populated with instance data in advance, so that when the class is reloaded, the state can be quickly restored without requiring full instance reconstruction. This preliminary state capture eliminates the time penalty associated with traditional reloads.
2Adaptability or versatility
If standard JVM reloads class loaders along with all their classes, then class reloading is supported, but all current class instances are lost
Solution Approach 1:
The patent creates a copy of the instance state through the state class mechanism. Before reloading, the current instance state is copied into a state class object that persists across the reload boundary. This copy allows the original instances to be reconstructed after reloading with their original state intact, preventing information loss while enabling class reloading.
3Productivity
If HotSwap is used to reload classes, then method bodies can be changed, but method signatures, classes and fields cannot be updated
Solution Approach 1:
The patent segments class modification into multiple independent dimensions: method bodies, method signatures, fields, and class structure. By using the state class pattern and reflective instantiation, each component can be modified independently without requiring full class reload. This segmentation enables comprehensive class adaptability while maintaining development efficiency.
Solution Approach 2:
The patent introduces dynamic class modification capabilities through reflective instantiation and state class manipulation. Classes can be dynamically updated at runtime with new method signatures, fields, and structures without static compilation constraints. The system dynamically adapts class definitions while preserving instance state, enabling versatile class evolution during execution.
4Reliability
If all classes are re-loaded for testing, then application can be re-tested, but startup time and resource consumption increase
Solution Approach 1:
The patent applies partial action by reloading only the specific modified class rather than the entire application class set. The state class mechanism enables selective reloading of individual classes while preserving the rest of the application state. This partial reload approach maintains testing accuracy for modified components while avoiding the overhead of full application restart.
5Reliability
If all classes are re-loaded for testing, then application can be re-tested, but resource consumption increases
Solution Approach 1:
The patent segments the resource-intensive class loading process into isolated units. By using state classes to preserve instance state, only the specific modified class needs to be loaded into memory, rather than the entire application. This segmentation reduces memory consumption and processing resources while maintaining testing reliability through state preservation.
Data Source
AI summary
The method is for deploying an input class in a computer readable memory. A state class is created that has at least one field and at least one proxy method and a behavior class version that includes at least one method on the basis of the input class. At least one method call of the state class is redirected to the behavior class version. Also, an arrangement and a computer-software are disclosed.


