Plug-in dynamic loading method and device, electronic equipment and storage medium

Through the plug-in dynamic loading method, JAR file packages are monitored and processed, traffic loss during software system upgrade is avoided, automated upgrades and higher operation and maintenance efficiency are achieved, and traffic loss caused by restart during upgrades in the existing technology is solved.

CN119201188AInactive Publication Date: 2024-12-27BEIJING PACTERA JINXIN TECH LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411288953.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-13
Publication Date
2024-12-27
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing technology requires restart when software system is upgraded, resulting in traffic loss. Especially for important software systems, restarting is not allowed, because losing requested traffic will lead to transaction exceptions.

Method used

Through the plug-in dynamic loading method, when the software system monitors the JAR file package sent by the user, it conducts real-time detection based on the monitoring program. If the file package is upgraded for JAR, at least two different plug-in loaders and shared cache areas are used to perform bean program. Process and complete Spring container updates to avoid traffic loss caused by system restart.

Benefits of technology

It realizes that the software system upgrade is carried out more securely, avoids traffic loss, improves the work efficiency of operation and maintenance personnel, and reduces the difficulty of system online, and realizes the automated upgrade of the unified gateway system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201188A_ABST
    Figure CN119201188A_ABST
Patent Text Reader

Abstract

The invention provides a plug-in dynamic loading method and device, electronic equipment and a storage medium, and the method comprises the steps: when a software system monitors that a JAR file package sent by a user side is located at a target position, carrying out the real-time detection of the JAR file package based on a soft monitoring program, and determining whether the JAR file package is a JAR upgrade file package; if yes, processing the JAR upgrade file package based on at least two different plug-in loaders and the shared cache regions corresponding to the plug-in loaders, and determining the bean programs in the different shared cache regions; and performing Spring container updating processing on the bean programs in the different cache regions so as to complete updating of the bean programs. According to the method, the situation of flow loss caused by system upgrading and restarting in the software system upgrading process is avoided, automatic upgrading of the unified gateway system is realized, the working efficiency of operation and maintenance personnel is improved, and the system online difficulty is greatly reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for dynamic loading of a plug-in. Background Art

[0002] With the development of the information age, the development of software systems has been rapid. Now most software system upgrades or bug fixes require the upgraded software system to be restarted, which requires taking the risks brought by the software system restart (failure to start, loss of request traffic caused by startup, manual adjustment of traffic load, etc.). However, for important software systems, restarting is not allowed to lose request traffic, because losing request traffic is equivalent to transaction abnormality. In the existing technology, plug-in (SPI) design is supported. When the software system is upgraded or bug fixes are performed, the software system needs to be restarted, which will lead to the problem of traffic loss caused by system upgrade restart during the software system upgrade process. Summary of the invention

[0003] In view of this, the purpose of the present application is to provide a method, device, electronic device and storage medium for dynamic loading of plug-ins, which makes software system upgrades safer by dynamically loading plug-ins, avoids traffic loss caused by system upgrade restart during software system upgrade, and realizes automatic upgrade of the unified gateway system, improves the work efficiency of operation and maintenance personnel, and greatly reduces the difficulty of system launch.

[0004] The present application provides a method for dynamically loading a plug-in, and the method for dynamically loading a plug-in includes:

[0005] When the software system detects that the JAR file package sent by the user end is located at the target location, the software system performs real-time detection on the JAR file package based on the monitoring program to determine whether the JAR file package is a JAR upgrade file package;

[0006] If yes, the bean program in the JAR upgrade file package is processed based on at least two different plug-in loaders and the shared cache areas corresponding to the different plug-in loaders, and the bean programs in the different shared cache areas are determined;

[0007] The bean programs in different cache areas are updated by Spring containers to complete the update of the bean programs.

[0008] In a possible implementation manner, the processing of the bean program in the JAR upgrade file package based on at least two different plug-in loaders and the shared cache areas corresponding to the different plug-in loaders to determine the bean programs in the different shared cache areas includes:

[0009] Performing bean parsing processing on the JAR upgrade file package based on at least two different plug-in loaders to determine the bean program corresponding to each plug-in loader;

[0010] Based on the shared cache area corresponding to the plug-in loader, the corresponding bean program is loaded and cached.

[0011] In a possible implementation manner, performing bean parsing processing on the JAR upgrade file package based on at least two different plug-in loaders to determine the bean program corresponding to each plug-in loader includes:

[0012] Based on the class plug-in loader, bean parsing is performed on the JAR upgrade file package to obtain the bean program corresponding to the class plug-in loader;

[0013] Based on the SPI plug-in loader, bean parsing processing is performed on the JAR upgrade file package to obtain the bean program corresponding to the SPI plug-in loader.

[0014] In a possible implementation manner, caching the corresponding bean program based on the shared cache areas corresponding to different plug-in loaders includes:

[0015] If the plug-in loader is a class plug-in loader, determining that the shared cache area is a Class shared cache area, and loading the bean program corresponding to the plug-in loader into the Class shared cache area;

[0016] If the plug-in loader is an SPI plug-in loader, it is determined that the shared cache area is an SPI shared cache area, and the bean program corresponding to the plug-in loader is loaded into the SPI shared cache area.

[0017] In a possible implementation manner, the processing of the bean programs in different cache areas to complete the update of the bean programs includes:

[0018] Detect whether there is a historically registered bean program with a name consistent with the bean program in the cache area;

[0019] If it does not exist, register the bean program based on the Spring container;

[0020] If so, it is determined whether there is program update information in the bean program. If so, the Spring container updates the bean program on the node where the historically registered bean program is located based on the bean program.

[0021] In a possible implementation manner, after detecting whether there is a historically registered bean program with a name consistent with the bean program in the cache area, the plug-in dynamic loading method further includes:

[0022] If it exists, then detect whether the bean program carries program uninstallation information;

[0023] If so, the Spring container uninstalls the bean program.

[0024] In a possible implementation manner, the real-time detection of the JAR file package based on the monitoring program to determine whether the JAR file package is a JAR upgrade file package includes:

[0025] Check whether the information in the JAR file package is consistent with the information in the historical JAR file package;

[0026] If they are consistent, the JAR file package is not the JAR upgrade file package;

[0027] If they are inconsistent, the JAR file package is the JAR upgrade file package.

[0028] The embodiment of the present application also provides a plug-in dynamic loading device, the plug-in dynamic loading device comprising:

[0029] A timing monitoring module is used for performing real-time detection of the JAR file package sent by the user end based on a monitoring program when the software system detects that the JAR file package is located at the target location, and determining whether the JAR file package is a JAR upgrade file package;

[0030] A loading cache module is used to process the bean program in the JAR upgrade file package based on at least two different plug-in loaders and the shared cache areas corresponding to the different plug-in loaders, and determine the bean program in the different shared cache areas;

[0031] The program update module is used to perform Spring container update processing on the bean programs in different cache areas to complete the update of the bean programs.

[0032] An embodiment of the present application also provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the steps of the above-mentioned plug-in dynamic loading method are performed.

[0033] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned method for dynamic loading of plug-ins are executed.

[0034] The embodiment of the present application provides a method, device, electronic device and storage medium for dynamic loading of plug-ins, and the method for dynamic loading of plug-ins includes: when the software system detects that the JAR file package sent by the user end is located at the target location, the JAR file package is detected in real time based on the monitoring program to determine whether the JAR file package is a JAR upgrade file package; if so, the bean program in the JAR upgrade file package is processed based on at least two different plug-in loaders and the shared cache areas corresponding to the different plug-in loaders to determine the bean programs in different shared cache areas; the bean programs in different cache areas are updated by the Spring container to complete the update of the bean program. The software system upgrade is safer, and the traffic loss caused by the system upgrade restart during the software system upgrade process is avoided, and the automatic upgrade of the unified gateway system is realized, the work efficiency of the operation and maintenance personnel is improved, and the difficulty of system online is greatly reduced.

[0035] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0037] Figure 1 A flowchart of a method for dynamic loading of a plug-in provided in an embodiment of the present application;

[0038] Figure 2 A schematic diagram of cache loading of the plug-in dynamic loading method provided in an embodiment of the present application;

[0039] Figure 3A schematic diagram of a method for dynamically loading a plug-in provided in an embodiment of the present application;

[0040] Figure 4 A schematic diagram of the structure of a plug-in dynamic loading device provided in an embodiment of the present application;

[0041] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art, under the guidance of the content of the present application, can add one or more other operations to the flowchart, or remove one or more operations from the flowchart.

[0043] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0044] In order to enable those skilled in the art to use the contents of this application, the following implementation is provided in combination with the specific application scenario of "dynamically loading plug-ins". For those skilled in the art, the general principles defined herein can be applied to other embodiments and application scenarios without departing from the spirit and scope of this application.

[0045] The following methods, devices, electronic devices or computer-readable storage media of the embodiments of the present application can be applied to any scenario where dynamic loading of plug-ins is required. The embodiments of the present application are not limited to specific application scenarios. Any scheme using a method, device, electronic device and storage medium for dynamic loading of plug-ins provided by the embodiments of the present application is within the protection scope of the present application.

[0046] First, the application scenarios to which the present application is applicable are introduced. The present application can be applied in the field of computer technology.

[0047] According to research, with the development of the information age, the development of software systems has been rapid. Now most software system upgrades or bug fixes require the upgraded software system to be restarted, which requires taking risks brought by the software system restart (failure to start, loss of request traffic caused by startup, manual adjustment of traffic load, etc.). However, for important software systems, restarting is not allowed to lose request traffic, because losing request traffic is equivalent to transaction abnormality. In the existing technology, plug-in (SPI) design is supported. When the software system is upgraded or bug fixes are performed, the software system needs to be restarted, which will lead to the problem of traffic loss caused by system upgrade restart during the software system upgrade process.

[0048] Based on this, an embodiment of the present application provides a method for dynamic loading of plug-ins, which makes software system upgrades safer, avoids traffic loss caused by system upgrade restart during software system upgrades, and realizes automatic upgrades of the unified gateway system, improves the work efficiency of operation and maintenance personnel, and greatly reduces the difficulty of system launch.

[0049] See also Figure 1 , Figure 1 A flowchart of a method for dynamically loading a plug-in provided in an embodiment of the present application. Figure 1 As shown in , the plug-in dynamic loading method provided by the embodiment of the present application includes:

[0050] S101: When the software system detects that the JAR file package sent by the user end is located at the target location, the software system performs real-time detection on the JAR file package based on the monitoring program to determine whether the JAR file package is a JAR upgrade file package.

[0051] In this step, when the software system detects that the user pushes the JAR file package to the monitored target location, the software system's monitoring program performs real-time detection on the JAR file package to determine whether the JAR file package is a JAR upgrade file package.

[0052] Here, the user pushes the JAR file package to the SPI-JAR / jar / directory monitored by the software system and performs real-time detection on the JAR file package.

[0053] In a possible implementation manner, the software system-based real-time detection of the JAR file package to determine whether the JAR file package is a JAR upgrade file package includes:

[0054] Check whether the information in the JAR file package is consistent with the information in the historical JAR file package; if they are consistent, the JAR file package is not the JAR upgrade file package; if they are inconsistent, the JAR file package is the JAR upgrade file package.

[0055] Here, it is detected whether the information in the JAR file package is consistent with the information of the historical JAR file package; if they are consistent, the JAR file package is not a JAR upgrade file package; if they are inconsistent, the JAR file package is a JAR upgrade file package.

[0056] S102: If yes, the bean program in the JAR upgrade file package is processed based on at least two different plug-in loaders and the shared cache areas corresponding to the different plug-in loaders, and the bean programs in the different shared cache areas are determined.

[0057] In this step, if yes, the JAR upgrade file package is processed according to at least two different plug-in loaders and the shared cache areas corresponding to the different plug-in loaders to determine the bean programs in different shared cache areas.

[0058] Among them, the plug-in loader includes a class plug-in loader and an SPI plug-in loader, the shared cache area includes a cache area corresponding to the class plug-in loader and a cache area corresponding to the SPI plug-in loader, and the shared cache areas corresponding to different plug-in loaders are different. Using multiple plug-in loaders to process the JAR upgrade file package at the same time can make the program parsing more comprehensive.

[0059] In a possible implementation manner, the processing of the bean program in the JAR upgrade file package based on at least two different plug-in loaders and the shared cache areas corresponding to the different plug-in loaders to determine the bean programs in the different shared cache areas includes:

[0060] A: Perform bean parsing on the JAR upgrade file package based on at least two different plug-in loaders to determine the bean program corresponding to each plug-in loader.

[0061] Here, the JAR upgrade file package is subjected to bean parsing processing according to at least two different plug-in loaders to determine the bean program corresponding to each plug-in loader.

[0062] In a possible implementation manner, performing bean parsing processing on the JAR upgrade file package based on at least two different plug-in loaders to determine the bean program corresponding to each plug-in loader includes:

[0063] (1): Based on the class plug-in loader, the JAR upgrade file package is subjected to bean parsing processing to obtain the bean program corresponding to the class plug-in loader.

[0064] Here, the JAR upgrade file package is subjected to bean parsing processing according to the class plug-in loader to obtain the bean program corresponding to the class plug-in loader.

[0065] (2): Based on the SPI plug-in loader, the JAR upgrade file package is subjected to bean parsing processing to obtain the bean program corresponding to the SPI plug-in loader.

[0066] Here, the JAR upgrade file package is subjected to bean parsing processing according to the SPI plug-in loader to obtain the bean program corresponding to the SPI plug-in loader.

[0067] Among them, using different plug-in loaders to perform bean parsing processing on the JAR upgrade file package can make the parsing of the JAR upgrade file package more comprehensive.

[0068] B: Based on the shared cache area corresponding to the plug-in loader, the corresponding bean program is loaded and cached.

[0069] In a possible implementation manner, caching the corresponding bean program based on the shared cache areas corresponding to different plug-in loaders includes:

[0070] a: If the plug-in loader is a class plug-in loader, determine that the shared cache area is a Class shared cache area, and load the bean program corresponding to the plug-in loader into the Class shared cache area.

[0071] Here, if the plug-in loader is a class plug-in loader, the bean program corresponding to the plug-in loader is loaded and cached using the Class shared cache area.

[0072] b: If the plug-in loader is an SPI plug-in loader, determine that the shared cache area is an SPI shared cache area, and load the bean program corresponding to the plug-in loader into the SPI shared cache area.

[0073] Here, if the plug-in loader is an SPI plug-in loader, the SPI shared cache area is used to load and cache the bean program corresponding to the plug-in loader.

[0074] For further information, see Figure 2 , Figure 2 This is a schematic diagram of cache loading of the plug-in dynamic loading method provided in the embodiment of the present application. Figure 2As shown in the figure, SPI-JAR / jar / monitors the upgraded Jars and loads them into their respective shared cache areas (Class shared cache area and SPI shared cache area) through different plug-in loaders. First, the shared cache is implemented using a thread-safe cache, providing a class unique version cache data loading solution; class elements are uniformly managed by the jvm, and old version elements are uniformly managed and monitored by the jvm. The garbage collection of beans is cleaned up by the memory monitoring tool.

[0075] S103: Perform Spring container update processing on the bean programs in different cache areas to complete the update of the bean programs.

[0076] In this step, the Spring container update process is performed on the bean programs in different cache areas to complete the update of the bean programs.

[0077] Here, the bean program updates include newly added beans, uninstalled beans, and updated beans.

[0078] Among them, the loading of data in the Spring container depends on the bean registration center. The bean is registered using the beanName of the BeanDefinitionRegistry and the bean definition object. At the same time, the bean registration center can be used to implement dynamic loading functions such as bean registration, update, and unloading.

[0079] In a possible implementation manner, the processing of the bean programs in different cache areas to complete the update of the bean programs includes:

[0080] I: Detect whether there is a historically registered bean program with a name consistent with the bean program in the cache area.

[0081] Here, check whether there is a historically registered bean program with the same name as the bean program in the cache area.

[0082] II: If it does not exist, register the bean program based on the Spring container.

[0083] Here, if it does not exist, the Spring container is used to register the bean program.

[0084] III: If it exists, it is determined whether there is program update information in the bean program. If so, the Spring container updates the bean program on the node where the historically registered bean program is located based on the bean program.

[0085] Here, if it exists, it is determined whether there is program update information in the bean program. If so, the Spring container updates the bean program on the node where the historically registered bean program is located according to the bean program.

[0086] In a possible implementation manner, after detecting whether there is a historically registered bean program with a name consistent with the bean program in the cache area, the plug-in dynamic loading method further includes:

[0087] If it exists, it detects whether the bean program carries program uninstallation information; if so, the Spring container uninstalls the bean program.

[0088] Here, if there is a historically registered bean program with the same name as the bean program in the cache area, it is detected whether the bean program carries program uninstallation information. If so, the Spring container uninstalls the bean program.

[0089] For further information, see Figure 3 , Figure 3 A schematic diagram of a method for dynamically loading a plug-in provided in an embodiment of the present application. Figure 3 As shown in , the operation and maintenance personnel push the online upgrade package to the SPI-JAR / jar / directory monitored by the software system. The monitoring program reads the online upgrade package and performs bean resolution according to different loaders (class loaders, SPI loaders), caches the bean programs resolved by different loaders in the memory according to the shared cache area corresponding to the loader, updates the bean programs in different shared cache areas, and corresponds to the container for newly added beans, deleted beans, and updated beans to implement bean registration, bean uninstallation, and bean update.

[0090] The embodiment of the present application provides a method for dynamic loading of plug-ins, and the method includes: when the software system detects that the JAR file package sent by the user end is located at the target location, the JAR file package is detected in real time based on the monitoring program to determine whether the JAR file package is a JAR upgrade file package; if so, the bean program in the JAR upgrade file package is processed based on at least two different plug-in loaders and the shared cache areas corresponding to the different plug-in loaders to determine the bean programs in different shared cache areas; the bean programs in different cache areas are updated by the Spring container to complete the update of the bean program. By dynamically loading the plug-in, the software system upgrade is safer, the traffic loss caused by the system upgrade restart during the software system upgrade process is avoided, and the automatic upgrade of the unified gateway system is realized, the work efficiency of the operation and maintenance personnel is improved, and the difficulty of system online is greatly reduced.

[0091] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of a plug-in dynamic loading device provided in an embodiment of the present application. Figure 4 As shown in , the plug-in dynamic loading device 400 includes:

[0092] The timing monitoring module 410 is used for performing real-time detection on the JAR file package based on the monitoring program to determine whether the JAR file package is a JAR upgrade file package when the software system detects that the JAR file package sent by the user end is located at the target location;

[0093] A loading cache module 420 is used to process the bean program in the JAR upgrade file package based on at least two different plug-in loaders and the shared cache areas corresponding to the different plug-in loaders, and determine the bean program in the different shared cache areas;

[0094] The program update module 430 is used to perform Spring container update processing on the bean programs in different cache areas to complete the update of the bean programs.

[0095] Further, when the loading cache module 420 is used to process the bean program in the JAR upgrade file package based on at least two different plug-in loaders and the shared cache areas corresponding to the different plug-in loaders, and determines the bean program in the different shared cache areas, the loading cache module 420 is specifically used to:

[0096] Performing bean parsing processing on the JAR upgrade file package based on at least two different plug-in loaders to determine the bean program corresponding to each plug-in loader;

[0097] Based on the shared cache area corresponding to the plug-in loader, the corresponding bean program is loaded and cached.

[0098] Further, when the loading cache module 420 is used to perform bean parsing processing on the JAR upgrade file package based on at least two different plug-in loaders to determine the bean program corresponding to each plug-in loader, the loading cache module 420 is specifically used to:

[0099] Based on the class plug-in loader, bean parsing is performed on the JAR upgrade file package to obtain the bean program corresponding to the class plug-in loader;

[0100] Based on the SPI plug-in loader, bean parsing processing is performed on the JAR upgrade file package to obtain the bean program corresponding to the SPI plug-in loader.

[0101] Further, when the loading cache module 420 is used to cache the corresponding bean program based on the shared cache area corresponding to different plug-in loaders, the loading cache module 420 is specifically used to:

[0102] If the plug-in loader is a class plug-in loader, determining that the shared cache area is a Class shared cache area, and loading the bean program corresponding to the plug-in loader into the Class shared cache area;

[0103] If the plug-in loader is an SPI plug-in loader, it is determined that the shared cache area is an SPI shared cache area, and the bean program corresponding to the plug-in loader is loaded into the SPI shared cache area.

[0104] Further, when the program update module 430 is used to process the bean programs in different cache areas to complete the update of the bean programs, the program update module 430 is specifically used to:

[0105] Detect whether there is a historically registered bean program with a name consistent with the bean program in the cache area;

[0106] If it does not exist, register the bean program based on the Spring container;

[0107] If so, it is determined whether there is program update information in the bean program. If so, the Spring container updates the bean program on the node where the historically registered bean program is located based on the bean program.

[0108] Furthermore, the program update module 430 is also used for:

[0109] If it exists, then detect whether the bean program carries program uninstallation information;

[0110] If so, the Spring container uninstalls the bean program.

[0111] Furthermore, when the timing monitoring module 410 is used to perform real-time detection on the JAR file package based on the monitoring program to determine whether the JAR file package is a JAR upgrade file package, the timing monitoring module 410 is specifically used to:

[0112] Check whether the information in the JAR file package is consistent with the information in the historical JAR file package;

[0113] If they are consistent, the JAR file package is not the JAR upgrade file package;

[0114] If they are inconsistent, the JAR file package is the JAR upgrade file package.

[0115] The embodiment of the present application provides a plug-in dynamic loading device, the plug-in dynamic loading device includes: a timing monitoring module, which is used for the software system to detect the JAR file package sent by the user end at the target location, based on the monitoring program to perform real-time detection on the JAR file package to determine whether the JAR file package is a JAR upgrade file package; determine whether the JAR file package is a JAR upgrade file package; a loading cache module, which is used to process the bean program in the JAR upgrade file package based on at least two different plug-in loaders and the shared cache areas corresponding to the different plug-in loaders, and determine the bean programs in different shared cache areas; a program update module, which is used to perform Spring container update processing on the bean program in different cache areas, so as to complete the update of the bean program. By dynamically loading the plug-in, the software system upgrade is safer, avoiding the loss of traffic caused by the system upgrade restart during the software system upgrade process, and realizing the automatic upgrade of the unified gateway system, improving the work efficiency of the operation and maintenance personnel, and greatly reducing the difficulty of system online.

[0116] See also Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 5As shown in , the electronic device 500 includes a processor 510 , a memory 520 and a bus 530 .

[0117] The memory 520 stores machine-readable instructions executable by the processor 510. When the electronic device 500 is running, the processor 510 communicates with the memory 520 via the bus 530. When the machine-readable instructions are executed by the processor 510, the above-mentioned Figure 1 as well as Figure 3 The steps of the plug-in dynamic loading method in the method embodiment shown are specifically implemented in the method embodiment and will not be described in detail here.

[0118] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the computer program can execute the above-mentioned Figure 1 as well as Figure 3 The steps of the plug-in dynamic loading method in the method embodiment shown are specifically implemented in the method embodiment and will not be described in detail here.

[0119] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0120] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0121] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0122] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0123] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product, or in other words, the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0124] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A method for dynamic loading of a plug-in, characterized in that: The plug-in dynamic loading method comprises: When the software system detects that the JAR file package sent by the user end is located at the target location, the software system performs real-time detection on the JAR file package based on the monitoring program to determine whether the JAR file package is a JAR upgrade file package; If yes, the bean program in the JAR upgrade file package is processed based on at least two different plug-in loaders and the shared cache areas corresponding to the different plug-in loaders, and the bean programs in the different shared cache areas are determined; The bean programs in different cache areas are updated by Spring containers to complete the update of the bean programs.

2. The method for dynamic loading of plug-ins according to claim 1, characterized in that: The processing of the bean program in the JAR upgrade file package based on at least two different plug-in loaders and the shared cache areas corresponding to the different plug-in loaders to determine the bean programs in the different shared cache areas includes: Performing bean parsing processing on the JAR upgrade file package based on at least two different plug-in loaders to determine the bean program corresponding to each plug-in loader; Based on the shared cache area corresponding to the plug-in loader, the corresponding bean program is loaded and cached.

3. The method for dynamic loading of plug-ins according to claim 2, characterized in that: The performing bean parsing processing on the JAR upgrade file package based on at least two different plug-in loaders to determine the bean program corresponding to each plug-in loader includes: Based on the class plug-in loader, bean parsing is performed on the JAR upgrade file package to obtain the bean program corresponding to the class plug-in loader; Based on the SPI plug-in loader, bean parsing processing is performed on the JAR upgrade file package to obtain the bean program corresponding to the SPI plug-in loader.

4. The method for dynamic loading of plug-ins according to claim 2, characterized in that: The corresponding bean program is cached based on the shared cache area corresponding to different plug-in loaders, including: If the plug-in loader is a class plug-in loader, determining that the shared cache area is a Class shared cache area, and loading the bean program corresponding to the plug-in loader into the Class shared cache area; If the plug-in loader is an SPI plug-in loader, it is determined that the shared cache area is an SPI shared cache area, and the bean program corresponding to the plug-in loader is loaded into the SPI shared cache area.

5. The method for dynamic loading of plug-ins according to claim 1, characterized in that: The processing of the bean programs in different cache areas to complete the updating of the bean programs includes: Detect whether there is a historically registered bean program with a name consistent with the bean program in the cache area; If it does not exist, register the bean program based on the Spring container; If so, it is determined whether there is program update information in the bean program. If so, the Spring container updates the bean program on the node where the historically registered bean program is located based on the bean program.

6. The method for dynamic loading of plug-ins according to claim 5, characterized in that: After detecting whether there is a historically registered bean program with a name consistent with the bean program in the cache area, the plug-in dynamic loading method further includes: If it exists, then detect whether the bean program carries program uninstallation information; If so, the Spring container uninstalls the bean program.

7. The method for dynamic loading of plug-ins according to claim 1, characterized in that: The real-time detection of the JAR file package based on the monitoring program to determine whether the JAR file package is a JAR upgrade file package includes: Check whether the information in the JAR file package is consistent with the information in the historical JAR file package; If they are consistent, the JAR file package is not the JAR upgrade file package; If they are inconsistent, the JAR file package is the JAR upgrade file package.

8. A plug-in dynamic loading device, characterized in that: The plug-in dynamic loading device comprises: A timing monitoring module is used for performing real-time detection of the JAR file package sent by the user end based on a monitoring program to determine whether the JAR file package is a JAR upgrade file package when the software system detects that the JAR file package sent by the user end is located at the target location; A loading cache module is used to process the bean program in the JAR upgrade file package based on at least two different plug-in loaders and the shared cache areas corresponding to the different plug-in loaders, and determine the bean program in the different shared cache areas; The program update module is used to perform Spring container update processing on the bean programs in different cache areas to complete the update of the bean programs.

9. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and the machine-readable instructions are executed by the processor to execute the steps of the plug-in dynamic loading method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the plug-in dynamic loading method according to any one of claims 1 to 7 are executed.

Citation Information

Patent Citations

  • Spring application service upgrading method and storage medium

    CN107239313A

  • Plug-in dynamic updating method and device, electronic equipment and storage medium

    CN111475193A

  • Resource updating method, device and equipment of application program and readable storage medium

    CN115129348A

  • Custom function implementation method based on dynamic class loading mode

    CN115858045A

  • Hot plug-in processing method and system based on Java program and storage medium

    CN118069236A