Dynamic code hot replacement system and method based on Java

By introducing a dynamic code hot replacement system in Java development scenarios, the service interruption caused by code changes in traditional development is solved, and the immediate effect of code replacement and the stability of application performance is achieved.

CN119690489APending Publication Date: 2025-03-25SHANGHAI HANSHUO ZHIRONG INFORMATION TECHNOLOGY TECHNOLOGY CO LTD

Patent Information

Application Number
CN202411835580.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

In traditional Java development scenarios, if changes are required to be made to run applications, the conventional process is to stop the application, recompile and deploy the updated code, which is not only time-consuming, but also causes service interruption, especially for services that run 24 hours a day, which is a significant obstacle.

Method used

A dynamic code hot replacement system based on Java is proposed, including code management module, hot replacement engine module, CI/CD module and error handling management module. The system realizes incremental replacement of the code by generating module metadata to guide dependency parsing and conflict detection during the code replacement process, and ensures that the code replacement takes effect immediately after it is replaced through deep integration with the JVM.

Benefits of technology

Support for different versions of JVM is realized, ensuring the stability of application performance during code replacement and simplifying the development process, avoiding service interruptions, and improving development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690489A_ABST
    Figure CN119690489A_ABST
Patent Text Reader

Abstract

The invention discloses a dynamic code hot replacement system and method based on Java. The system comprises a code management module, a hot replacement engine module, a CI / CD module and an error processing management module. The code management module is used for generating module metadata, and the module metadata is used for guiding dependency analysis and conflict detection in the code replacement process; the hot replacement engine module receives module metadata and is used for carrying out incremental replacement on codes, only part of modified codes are replaced, and through deep integration of the hot replacement engine module and the JVM, the codes take effect immediately after being replaced; the CI / CD module is used for managing continuous integration and continuous deployment processes of application programs; and the error processing management module is used for automatically rolling back to the previous version when an error occurs during incremental replacement of the code. According to the dynamic code hot replacement system and method based on Java, support for JVM of different versions is achieved, and meanwhile stability of application performance and simplification of a development process in the code replacement process are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of business processing, and in particular to a Java-based dynamic code hot replacement system and method. Background Art

[0002] With the rapid progress of the software development industry, improving development efficiency and accelerating debugging have become key indicators for evaluating the quality of the development environment. In traditional Java development scenarios, if changes need to be made to a running application, the general process is to stop the application first, then recompile and deploy the updated code. This practice is not only time-consuming, but also causes service interruptions, which is a significant obstacle for services that require 24 hours / 7 days of uninterrupted operation.

[0003] In recent years, the industry has launched a variety of development tools and frameworks, introducing hot replacement functions, which aim to achieve partial or complete updates of code without suspending application execution.

[0004] The invention patent with application number: CN202010216486.8 and name "An automated management method for hot updates of Java classes" discloses an automated management method for hot updates of Java classes, including two parts: class hot update execution and class hot update history query; the class hot update execution includes the following steps: Step 1, select the class to be hot updated, identify the path of the class file, and convert the path into a software package path. At the same time, return the software package path for user confirmation. If the automatically identified path is incorrect, the user modifies it to the correct software package path and then executes step 2, otherwise directly executes step 2; Step 2, clear the compilation directory, copy the class file to be replaced to the compilation directory, and automatically generate a directory structure identical to the software package path; Step 3, first check whether the target process has a hot replacement log, and if so, read the log , determine a new serial number for the class to be updated; if it does not exist, set the serial number of the class to be updated to 0; then modify the source code of the class to be updated according to the serial number to avoid hot update package conflicts; step 4, put the modified source code into the compilation directory, use the javac command to compile the source code one by one, and then package the compiled source code into a hot update jar package; step 5, run the attachment program, which is used to attach the target process of the user-specified pid, and after attachment, send the hot update package to the target process to run and implement class hot update; the specific method of class hot update history query is: step S1, search the log file according to the process pid, modify the log record and serial number of the replaced class in the log file, and write the newly replaced class into the log file; step S2, obtain the pid number selected by the current user, search the log file according to the pid, parse the historical records in the log and present them to the user. However, the above method is relatively complicated and inefficient when used specifically.

[0005] Therefore, it is necessary to provide a Java-based dynamic code hot replacement system and method to solve the above problems. Summary of the invention

[0006] The purpose of the embodiments of the present application is to propose a Java-based dynamic code hot replacement system and method, which supports different versions of JVM and ensures the stability of application performance and the simplification of development process during code replacement.

[0007] According to one aspect of the present invention, there is provided a Java-based dynamic code hot replacement system, the system comprising a code management module, a hot replacement engine module, a CI / CD module and an error handling management module; The code management module is used to generate module metadata, and the module metadata is used to guide dependency parsing and conflict detection during code replacement; The hot replacement engine module receives the module metadata, and the hot replacement engine module is used to incrementally replace the code, replacing only the modified part of the code, and realizing immediate effect after the code replacement through deep integration with the JVM; The CI / CD module is used to manage the continuous integration and continuous deployment process of applications, including automated building, testing, packaging, and deployment; The error handling management module is used to automatically roll back to the previous version when an error occurs during the incremental replacement of the code.

[0008] Preferably, the code management module includes: a code module management unit, a metadata generation unit, a dependency management unit and a version management unit; The code module management unit is used to load, unload and update code modules, and when a new code version is detected, deploy it to the operating environment; The metadata generation unit is used to generate metadata describing the structure and behavior of the code module management unit, wherein the structure includes classes, methods and properties, and the behavior includes entry points and callback mechanisms; The dependency management unit is used to automatically parse the dependency relationship of the module, and pass the dependency relationship to the hot replacement engine module, and the hot replacement engine module automatically updates the related dependency modules according to the dependency relationship to ensure the consistency of the dependency relationship; The version management unit is used to track different versions of the code, provide version rollback capabilities, and support the coexistence of parallel versions.

[0009] Preferably, the hot replacement engine module includes: a bytecode operation library, a class loader management unit, an event monitoring unit and a notification mechanism unit; The bytecode operation library is used to read, modify and generate Java bytecode; The class loader management unit is used to manage and coordinate the behavior of the class loader to ensure that the new version of the class can be correctly loaded and replace the old version. The class loader management unit is also used to handle class unloading to avoid memory leaks; The event monitoring unit is used to monitor class loading, unloading and other key events that may affect the hot replacement process. It can register a listener and call the corresponding callback function when a specific event occurs; The notification mechanism unit is used to report information during the hot replacement process, including successful updates, errors, and rollback operations. The information is recorded in logs, sent by email, or sent via instant messaging.

[0010] Preferably, the CI / CD module includes: a construction automation unit, an automation deployment unit and a dynamic code hot replacement unit; The build automation unit is used to automatically compile source code, run unit tests, integration tests, and package to generate deployable artifacts, and the deployable artifacts include JAR files and WAR files; The automated deployment unit is used to manage the deployment process of the application, including uploading the build product to the target server, configuring environment variables, and starting or restarting the service; The dynamic code hot replacement unit is used to update the code when the application is running, and the code update includes class loader management, bytecode operation, event monitoring and notification mechanism.

[0011] Preferably, the error handling management module includes: an error detection unit, an error reporting notification unit and a rollback mechanism unit; The error detection unit is used to monitor the running status of the application in real time, identify and capture exceptions and errors, and the identification and capture of exceptions and errors includes analysis of log files, capture of exception stack traces, and monitoring of performance indicators; The error report notification unit is used to generate a detailed error report when an abnormal situation is found, and send a notification through multiple channels, wherein the error report includes an error description, occurrence time, impact scope and preliminary diagnostic information, and the multiple channels include email, instant messaging and log records; The rollback mechanism unit is used to restore the application to a previous stable version when a serious error or hot replacement failure is detected. Restoring the application to the previous stable version includes unloading the new version class, reloading the old version class, and performing a cleanup operation. The cleanup operation includes clearing the cache and resetting the database connection.

[0012] Preferably, a log monitoring module is also included, which is used to capture, filter and analyze the log information of the application in real time. The log information includes log files, log levels and keywords. The log monitoring module is ELK Stack, Splunk, Graylog, Log4j2 or SLF4J.

[0013] Preferably, it also includes an input interface module, which is provided with a React unit, a Vue unit, an Echarts unit, a Material-UI unit, a CSS unit and an HTML unit; The React unit is used to build a user interface and provides a declarative programming approach; The Vue unit is used to build user interfaces, providing a progressive JavaScript framework; The Echarts unit is used for data visualization, providing chart types and configuration options; The Material-UI unit is used to quickly build a user interface that complies with the Google Material Design specification; The CSS unit is used to define and manage style rules; The HTML unit is used to define the layout and content of the page and provide semantic tags.

[0014] Preferably, automatically updating the related dependent modules according to the dependency relationship specifically includes: When the dependency relationship is the first dependency relationship, downloading the first application package to update the related dependency module; When the dependency relationship is the second dependency relationship, downloading the second application package to update the related dependency module; The first dependency relationship and the second dependency relationship are stored in a first tree structure and a second tree structure respectively.

[0015] Preferably, a signature file is added to the first application package or the second application package, the signature file is calculated using a first hash algorithm, the hash value of the signature file is calculated using a second hash algorithm, and the hash value is mapped to a hash ring virtual node connected end to end, the first hash algorithm is a static hash algorithm, and the second hash algorithm is an elastic hash algorithm.

[0016] According to another aspect of the present invention, a Java-based dynamic code hot replacement method is provided, the method comprising: Guide dependency resolution and conflict detection during code replacement; Incremental replacement of code, replacing only the modified part of the code. Through deep integration with JVM, code replacement takes effect immediately. Manage the continuous integration and continuous deployment process of applications, including automated building, testing, packaging, and deployment; When an error occurs during the incremental replacement of the code, it can automatically roll back to the previous version.

[0017] The present application discloses a Java-based dynamic code hot replacement system and method, the system includes a code management module, a hot replacement engine module, a CI / CD module and an error handling management module; the code management module is used to generate module metadata, and the module metadata is used to guide dependency parsing and conflict detection in the code replacement process; the hot replacement engine module receives the module metadata, and the hot replacement engine module is used to incrementally replace the code, only replacing the modified part of the code, and through deep integration with the JVM, the code replacement takes effect immediately; the CI / CD module is used to manage the continuous integration and continuous deployment process of the application, including automated building, testing, packaging and deployment; the error handling management module is used to automatically roll back to the previous version when an error occurs during the incremental replacement of the code, thereby supporting different versions of JVM and ensuring the stability of application performance and the simplification of the development process during the code replacement process; Further, when the dependency is a first dependency, the first application package is downloaded to update the related dependency module; when the dependency is a second dependency, the second application package is downloaded to update the related dependency module; the first dependency and the second dependency are stored in a first tree structure and a second tree structure respectively, and the first application package or the second application package is downloaded by using the first dependency and the second dependency, thereby improving the update efficiency of the application package; Furthermore, a signature file is added to the first application package or the second application package, the signature file is calculated using a first hash algorithm, the hash value of the signature file is calculated using a second hash algorithm, the hash value is mapped to a hash ring virtual node connected end to end, the first hash algorithm is a static hash algorithm, and the second hash algorithm is an elastic hash algorithm, and the signature file is verified by using the first hash algorithm and the second hash algorithm to ensure the security update of the first application package or the second application package. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are some embodiments of the present invention, not all embodiments. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor.

[0019] Figure 1 It is a module schematic diagram of a Java-based dynamic code hot replacement system according to an embodiment of the present invention; Figure 2 The figure is a flowchart of a Java-based dynamic code hot replacement method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0020] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. According to the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0021] The technical solution of the present invention is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0022] In view of the problems existing in the prior art, an embodiment of the present invention provides a Java-based dynamic code hot replacement system and method, which realizes support for different versions of JVM, while ensuring the stability of application performance and simplification of development process during code replacement.

[0023] Figure 1 is a module diagram of a Java-based dynamic code hot replacement system according to an embodiment of the present invention, such as Figure 1 As shown, an embodiment of the present invention provides a Java-based dynamic code hot replacement system, the system includes a code management module, a hot replacement engine module, a CI / CD module and an error handling management module; The code management module is used to generate module metadata, and the module metadata is used to guide dependency parsing and conflict detection during code replacement; The hot replacement engine module receives the module metadata, and the hot replacement engine module is used to incrementally replace the code, replacing only the modified part of the code, and realizing immediate effect after the code replacement through deep integration with the JVM; The CI / CD module is used to manage the continuous integration and continuous deployment process of applications, including automated building, testing, packaging, and deployment; The error handling management module is used to automatically roll back to the previous version when an error occurs during the incremental replacement of the code.

[0024] Preferably, the code management module includes: a code module management unit, a metadata generation unit, a dependency management unit and a version management unit; The code module management unit is used to load, unload and update code modules, and when a new code version is detected, deploy it to the operating environment; The metadata generation unit is used to generate metadata describing the structure and behavior of the code module management unit, wherein the structure includes classes, methods and properties, and the behavior includes entry points and callback mechanisms; The dependency management unit is used to automatically parse the dependency relationship of the module, and pass the dependency relationship to the hot replacement engine module, and the hot replacement engine module automatically updates the related dependency modules according to the dependency relationship to ensure the consistency of the dependency relationship; The version management unit is used to track different versions of the code, provide version rollback capabilities, and support the coexistence of parallel versions.

[0025] In a specific implementation, the hot replacement engine module includes: a bytecode operation library, a class loader management unit, an event monitoring unit and a notification mechanism unit; The bytecode operation library is used to read, modify and generate Java bytecode; The class loader management unit is used to manage and coordinate the behavior of the class loader to ensure that the new version of the class can be correctly loaded and replace the old version. The class loader management unit is also used to handle class unloading to avoid memory leaks; The event monitoring unit is used to monitor class loading, unloading and other key events that may affect the hot replacement process. It can register a listener and call the corresponding callback function when a specific event occurs; The notification mechanism unit is used to report information during the hot replacement process, including successful updates, errors, and rollback operations. The information is recorded in logs, sent by email, or sent via instant messaging.

[0026] In a specific implementation, the CI / CD module includes: a construction automation unit, an automation deployment unit, and a dynamic code hot replacement unit; The build automation unit is used to automatically compile source code, run unit tests, integration tests, and package to generate deployable artifacts, and the deployable artifacts include JAR files and WAR files; The automated deployment unit is used to manage the deployment process of the application, including uploading the build product to the target server, configuring environment variables, and starting or restarting the service; The dynamic code hot replacement unit is used to update the code when the application is running, and the code update includes class loader management, bytecode operation, event monitoring and notification mechanism.

[0027] In a specific implementation, the error handling management module includes: an error detection unit, an error reporting notification unit, and a rollback mechanism unit; The error detection unit is used to monitor the running status of the application in real time, identify and capture exceptions and errors, and the identification and capture of exceptions and errors includes analysis of log files, capture of exception stack traces, and monitoring of performance indicators; The error report notification unit is used to generate a detailed error report when an abnormal situation is found, and send a notification through multiple channels, wherein the error report includes an error description, occurrence time, impact scope and preliminary diagnostic information, and the multiple channels include email, instant messaging and log records; The rollback mechanism unit is used to restore the application to a previous stable version when a serious error or hot replacement failure is detected. Restoring the application to the previous stable version includes unloading the new version class, reloading the old version class, and performing a cleanup operation. The cleanup operation includes clearing the cache and resetting the database connection.

[0028] In a specific implementation, a log monitoring module is also included, which is used to capture, filter and analyze the log information of the application in real time. The log information includes log files, log levels and keywords. The log monitoring module is ELKStack, Splunk, Graylog, Log4j2 or SLF4J.

[0029] In a specific implementation, it also includes an input interface module, which is provided with a React unit, a Vue unit, an Echarts unit, a Material-UI unit, a CSS unit and an HTML unit; The React unit is used to build a user interface and provides a declarative programming approach; The Vue unit is used to build user interfaces, providing a progressive JavaScript framework; The Echarts unit is used for data visualization, providing chart types and configuration options; The Material-UI unit is used to quickly build a user interface that complies with the Google Material Design specification; The CSS unit is used to define and manage style rules; The HTML unit is used to define the layout and content of the page and provide semantic tags.

[0030] In a specific implementation, automatically updating the related dependent modules according to the dependency relationship specifically includes: When the dependency relationship is the first dependency relationship, downloading the first application package to update the related dependency module; When the dependency relationship is the second dependency relationship, downloading the second application package to update the related dependency module; The first dependency relationship and the second dependency relationship are stored in a first tree structure and a second tree structure respectively.

[0031] In a specific implementation, a signature file is added to the first application package or the second application package, the signature file is calculated using a first hash algorithm, the hash value of the signature file is calculated using a second hash algorithm, and the hash value is mapped to a hash ring virtual node connected end to end. The first hash algorithm is a static hash algorithm, and the second hash algorithm is an elastic hash algorithm.

[0032] Figure 2 FIG. 1 is a flow chart of a Java-based dynamic code hot replacement method according to an embodiment of the present invention. Figure 2 As shown, an embodiment of the present invention provides a Java-based dynamic code hot replacement method, the method comprising: Step S201: guiding dependency parsing and conflict detection during code replacement; Step S202: incrementally replace the code, replacing only the modified part of the code, and achieving immediate effect after code replacement through deep integration with JVM; Step S203: managing the continuous integration and continuous deployment process of the application, including automated building, testing, packaging and deployment; Step S204: When an error occurs during the incremental replacement of the code, the code can be automatically rolled back to the previous version.

[0033] The following is a specific example of the above Java-based dynamic code hot replacement method: 1. User request: Users access the system's front-end interface through a browser and load pages containing React, Vue, Echarts, Material-UI, CSS, and HTML.

[0034] 2. Initialization: After the page is loaded, the React or Vue framework is initialized and the initial user interface is rendered. The Material-UI component library is used to build interface elements, and the Echarts chart is rendered based on the initial data.

[0035] 3. User Interaction The user interacts with the interface, such as clicking buttons, selecting options, entering text, etc. React or Vue components capture these events and update local state or send requests to the backend as needed.

[0036] 4. Data acquisition and update: If data needs to be obtained from the backend, the React or Vue component will initiate an API request. After receiving the response, the component will update the state and re-render the relevant parts. For Echarts charts, data updates will trigger the redrawing of the chart.

[0037] 5. Error handling: If an error occurs during the interaction, the error detection unit will capture the exception, the error reporting notification unit will generate a detailed error report, and the log monitoring module will record relevant information. Friendly error prompts can be displayed on the user interface.

[0038] 6. Hot replacement feedback: When dynamic code hot replacement occurs, the front-end interface can receive update notifications through WebSocket or other real-time communication mechanisms. React or Vue components can be reloaded according to the new code version without refreshing the entire page. Echarts charts can be automatically updated according to new data sources.

[0039] 7. Rollback and recovery: If the hot replacement fails or a problem occurs, the rollback mechanism unit will trigger a rollback operation. The front-end interface will receive a rollback notification and update the status and view accordingly to ensure that users always see the latest stable version.

[0040] 8. Performance monitoring: The log monitoring module not only monitors the backend logs, but also collects frontend performance indicators such as loading time and response time. These data can help optimize frontend performance and ensure a smooth user experience.

[0041] In summary, the present application discloses a Java-based dynamic code hot replacement system and method, the system includes a code management module, a hot replacement engine module, a CI / CD module and an error handling management module; the code management module is used to generate module metadata, and the module metadata is used to guide dependency resolution and conflict detection in the code replacement process; the hot replacement engine module receives the module metadata, and the hot replacement engine module is used to incrementally replace the code, only replacing the modified part of the code, and through deep integration with the JVM, the code replacement takes effect immediately; the CI / CD module is used to manage the continuous integration and continuous deployment process of the application, including automated building, testing, packaging and deployment; the error handling management module is used to automatically roll back to the previous version when an error occurs during the incremental replacement of the code, thereby supporting different versions of JVM and ensuring the stability of application performance and the simplification of the development process during the code replacement process; Further, when the dependency is a first dependency, the first application package is downloaded to update the related dependency module; when the dependency is a second dependency, the second application package is downloaded to update the related dependency module; the first dependency and the second dependency are stored in a first tree structure and a second tree structure respectively, and the first application package or the second application package is downloaded by using the first dependency and the second dependency, thereby improving the update efficiency of the application package; Furthermore, a signature file is added to the first application package or the second application package, the signature file is calculated using a first hash algorithm, the hash value of the signature file is calculated using a second hash algorithm, the hash value is mapped to a hash ring virtual node connected end to end, the first hash algorithm is a static hash algorithm, and the second hash algorithm is an elastic hash algorithm, and the signature file is verified by using the first hash algorithm and the second hash algorithm to ensure the security update of the first application package or the second application package.

[0042] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A Java-based dynamic code hot replacement system, characterized in that: The system includes a code management module, a hot replacement engine module, a CI / CD module and an error handling management module; The code management module is used to generate module metadata, and the module metadata is used to guide dependency parsing and conflict detection during code replacement; The hot replacement engine module receives the module metadata, and the hot replacement engine module is used to incrementally replace the code, replacing only the modified part of the code, and realizing immediate effect after the code replacement through deep integration with the JVM; The CI / CD module is used to manage the continuous integration and continuous deployment process of applications, including automated building, testing, packaging, and deployment; The error handling management module is used to automatically roll back to the previous version when an error occurs during the incremental replacement of the code.

2. The Java-based dynamic code hot replacement system according to claim 1, characterized in that: The code management module includes: a code module management unit, a metadata generation unit, a dependency management unit and a version management unit; The code module management unit is used to load, unload and update code modules, and when a new code version is detected, deploy it to the operating environment; The metadata generation unit is used to generate metadata describing the structure and behavior of the code module management unit, wherein the structure includes classes, methods and properties, and the behavior includes entry points and callback mechanisms; The dependency management unit is used to automatically parse the dependency relationship of the module, and pass the dependency relationship to the hot replacement engine module, and the hot replacement engine module automatically updates the related dependency modules according to the dependency relationship to ensure the consistency of the dependency relationship; The version management unit is used to track different versions of the code, provide version rollback capabilities, and support the coexistence of parallel versions.

3. The Java-based dynamic code hot replacement system according to claim 1 is characterized in that: The hot replacement engine module includes: a bytecode operation library, a class loader management unit, an event monitoring unit and a notification mechanism unit; The bytecode operation library is used to read, modify and generate Java bytecode; The class loader management unit is used to manage and coordinate the behavior of the class loader to ensure that the new version of the class can be correctly loaded and replace the old version. The class loader management unit is also used to handle class unloading to avoid memory leaks; The event monitoring unit is used to monitor class loading, unloading and other key events that may affect the hot replacement process. It can register a listener and call the corresponding callback function when a specific event occurs; The notification mechanism unit is used to report information during the hot replacement process, including successful updates, errors, and rollback operations. The information is recorded in logs, sent by email, or sent via instant messaging.

4. The Java-based dynamic code hot replacement system according to claim 1, characterized in that: The CI / CD module includes: a construction automation unit, an automation deployment unit and a dynamic code hot replacement unit; The build automation unit is used to automatically compile source code, run unit tests, integration tests, and package to generate deployable artifacts, and the deployable artifacts include JAR files and WAR files; The automated deployment unit is used to manage the deployment process of the application, including uploading the build product to the target server, configuring environment variables, and starting or restarting the service; The dynamic code hot replacement unit is used to update the code when the application is running, and the code update includes class loader management, bytecode operation, event monitoring and notification mechanism.

5. The Java-based dynamic code hot replacement system according to claim 1, characterized in that: The error handling management module includes: an error detection unit, an error reporting notification unit and a rollback mechanism unit; The error detection unit is used to monitor the running status of the application in real time, identify and capture exceptions and errors, and the identification and capture of exceptions and errors includes analysis of log files, capture of exception stack traces, and monitoring of performance indicators; The error report notification unit is used to generate a detailed error report when an abnormal situation is found, and send a notification through multiple channels, wherein the error report includes an error description, occurrence time, impact scope and preliminary diagnostic information, and the multiple channels include email, instant messaging and log records; The rollback mechanism unit is used to restore the application to a previous stable version when a serious error or hot replacement failure is detected. Restoring the application to the previous stable version includes unloading the new version class, reloading the old version class, and performing a cleanup operation. The cleanup operation includes clearing the cache and resetting the database connection.

6. The Java-based dynamic code hot replacement system according to claim 1, characterized in that: It also includes a log monitoring module, which is used to capture, filter and analyze the log information of the application in real time. The log information includes log files, log levels and keywords. The log monitoring module is ELK Stack, Splunk, Graylog, Log4j2 or SLF4J.

7. The Java-based dynamic code hot replacement system according to claim 1, characterized in that: It also includes an input interface module, which is provided with a React unit, a Vue unit, an Echarts unit, a Material-UI unit, a CSS unit and an HTML unit; The React unit is used to build a user interface and provides a declarative programming approach; The Vue unit is used to build user interfaces, providing a progressive JavaScript framework; The Echarts unit is used for data visualization, providing chart types and configuration options; The Material-UI unit is used to quickly build a user interface that complies with the Google Material Design specification; The CSS unit is used to define and manage style rules; The HTML unit is used to define the layout and content of the page and provide semantic tags.

8. The Java-based dynamic code hot replacement system according to claim 2, characterized in that: Automatically updating related dependent modules according to the dependency relationship specifically includes: When the dependency relationship is the first dependency relationship, downloading the first application package to update the related dependency module; When the dependency relationship is the second dependency relationship, downloading the second application package to update the related dependency module; The first dependency relationship and the second dependency relationship are stored in a first tree structure and a second tree structure respectively.

9. The Java-based dynamic code hot replacement system according to claim 8, characterized in that: Add a signature file to the first application package or the second application package, use a first hash algorithm to calculate the signature file, use a second hash algorithm to calculate the hash value of the signature file, map the hash value to a hash ring virtual node connected end to end, the first hash algorithm is a static hash algorithm, and the second hash algorithm is an elastic hash algorithm.

10. A Java-based dynamic code hot replacement method, characterized in that: The method comprises: Guide dependency resolution and conflict detection during code replacement; Incremental replacement of code, replacing only the modified part of the code. Through deep integration with JVM, code replacement takes effect immediately. Manage the continuous integration and continuous deployment process of applications, including automated building, testing, packaging, and deployment; When an error occurs during the incremental replacement of the code, it can automatically roll back to the previous version.

Citation Information

Patent Citations

  • Class hot update automatic management method for Java

    CN111580813A

Cited By

  • System and method for real-time hot loading and dynamic recombination of micro-service component

    CN122053377A