[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN117806668A - Micro-service upgrading method and device, electronic equipment and storage medium - Google Patents

Micro-service upgrading method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN117806668A
CN117806668A CN202211170565.5A CN202211170565A CN117806668A CN 117806668 A CN117806668 A CN 117806668A CN 202211170565 A CN202211170565 A CN 202211170565A CN 117806668 A CN117806668 A CN 117806668A
Authority
CN
China
Prior art keywords
function
package
filing
micro
service
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211170565.5A
Other languages
Chinese (zh)
Inventor
李怀
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Zitiao Network Technology Co Ltd
Original Assignee
Beijing Zitiao Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Zitiao Network Technology Co Ltd filed Critical Beijing Zitiao Network Technology Co Ltd
Priority to CN202211170565.5A priority Critical patent/CN117806668A/en
Publication of CN117806668A publication Critical patent/CN117806668A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the disclosure provides a micro-service upgrading method, a micro-service upgrading device, electronic equipment and a storage medium. A method for micro-service upgrade, applied to containerized micro-services, the method comprising: acquiring request parameters, wherein the request parameters comprise resource location information and function parameters; based on the resource position information, acquiring and analyzing a function filing package corresponding to the micro-service, wherein the function filing package is a data package formed by packing function codes, the function codes inherit abstract classes included in an execution inlet filing package so as to realize an abstract method in the execution inlet filing package, and the abstract method is used for identifying an execution inlet of the function codes; and executing the corresponding function codes based on the parsed function filing package and the function parameters. The containerized micro-service obtains and analyzes the function filing package based on the request parameters only in a hot loading mode to finish micro-service upgrading, solve the problem of time consumption of containerized micro-service upgrading, and achieve the effect of reducing the time length of containerized micro-service upgrading.

Description

Micro-service upgrading method and device, electronic equipment and storage medium
Technical Field
The embodiment of the disclosure relates to computer technology, in particular to a method, a device, electronic equipment and a storage medium for micro-service upgrade.
Background
With the continuous development of micro-service technology, containerization gradually becomes a mainstream scheme of micro-service deployment, and the manner of directly deploying or running codes on a platform or an operating system can be replaced by containerized deployment, so that the deployment and running of the micro-service are not influenced by a dependent infrastructure or an operating system of an environment.
However, after the micro-service is containerized, the upgrade of the micro-service generally goes through multiple steps of compiling the mirror image, pulling the mirror image, starting the container, and the micro-service, so that the time required for completing the upgrade of the micro-service in the container once is several tens of minutes or even longer, resulting in longer time consumption for upgrading the containerized micro-service.
Disclosure of Invention
The disclosure provides a method, a device, electronic equipment and a storage medium for upgrading micro services, which are used for solving the problem that the containerized micro services are time-consuming to upgrade.
In a first aspect, an embodiment of the present disclosure provides a method for upgrading a micro service, applied to a containerized micro service, including: acquiring request parameters, wherein the request parameters comprise resource location information and function parameters;
Acquiring and analyzing a function filing package corresponding to a micro service based on the resource position information, wherein the function filing package is a data package formed after function codes are packaged, the function codes inherit abstract classes included in an execution inlet filing package so as to realize an abstract method in the execution inlet filing package, the abstract method is used for identifying an execution inlet of the function codes, and the function codes are codes after updating functions provided by the micro service;
and executing the corresponding function codes based on the parsed function filing package and the function parameters.
In a second aspect, an embodiment of the present disclosure further provides a micro service upgrade apparatus, including:
the acquisition module is used for acquiring request parameters, wherein the request parameters comprise resource position information and functional parameters;
the analysis module is used for acquiring and analyzing a function filing package corresponding to the micro-service based on the resource position information, wherein the function filing package is a data package formed after function codes are packaged, the function codes inherit abstract classes included in an execution inlet filing package so as to realize an abstract method in the execution inlet filing package, the abstract method is used for identifying an execution inlet of the function codes, and the function codes are codes after updating functions provided by the micro-service;
And the execution module is used for executing the corresponding function codes based on the parsed function filing package and the function parameters.
In a third aspect, embodiments of the present disclosure further provide an electronic device, including:
one or more processing devices;
storage means for storing one or more programs,
when the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the micro-service upgrade method provided by the embodiments of the present disclosure.
In a fourth aspect, the presently disclosed embodiments also provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are for performing the micro-service upgrade method provided by the presently disclosed embodiments.
According to the embodiment of the disclosure, request parameters are obtained, wherein the request parameters comprise resource position information and function parameters; acquiring and analyzing a function filing package corresponding to a micro service based on the resource position information, wherein the function filing package is a data package formed after function codes are packaged, the function codes inherit abstract classes included in an execution inlet filing package so as to realize an abstract method in the execution inlet filing package, the abstract method is used for identifying an execution inlet of the function codes, and the function codes are codes after updating functions provided by the micro service; based on the analyzed function filing package and the function parameters, corresponding function codes are executed to complete micro-service upgrading, multiple steps of compiling mirror image, mirror image pulling, starting a container, micro-service and the like are not needed in the whole upgrading process, the containerized micro-service obtains and analyzes the function filing package based on the request parameters only in a hot loading mode to complete micro-service upgrading, the problem of time consumption of containerized micro-service upgrading is solved, and the effect of reducing the time length of containerized micro-service upgrading is achieved.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale.
Fig. 1 is a flow chart of a method for upgrading a micro service according to an embodiment of the disclosure;
FIG. 2 is a flow chart of a method for upgrading micro services according to an embodiment of the present disclosure;
FIG. 3 is a system framework diagram provided by an embodiment of the present disclosure;
FIG. 4 is a catalog format schematic diagram of a custom archive package generated by a custom packaging plug-in provided by an embodiment of the present disclosure;
FIG. 5 is a core class diagram of a class loader provided by an embodiment of the present disclosure;
FIG. 6 is a flow chart of the execution of a class loader provided by an embodiment of the present disclosure;
FIG. 7 is a schematic diagram of a micro-service upgrade apparatus according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
It will be appreciated that prior to using the technical solutions disclosed in the embodiments of the present disclosure, the user should be informed and authorized of the type, usage range, usage scenario, etc. of the personal information related to the present disclosure in an appropriate manner according to the relevant legal regulations.
For example, in response to receiving an active request from a user, a prompt is sent to the user to explicitly prompt the user that the operation it is requesting to perform will require personal information to be obtained and used with the user. Thus, the user can autonomously select whether to provide personal information to software or hardware such as an electronic device, an application program, a server or a storage medium for executing the operation of the technical scheme of the present disclosure according to the prompt information.
As an alternative but non-limiting implementation, in response to receiving an active request from a user, the manner in which the prompt information is sent to the user may be, for example, a popup, in which the prompt information may be presented in a text manner. In addition, a selection control for the user to select to provide personal information to the electronic device in a 'consent' or 'disagreement' manner can be carried in the popup window.
It will be appreciated that the above-described notification and user authorization process is merely illustrative and not limiting of the implementations of the present disclosure, and that other ways of satisfying relevant legal regulations may be applied to the implementations of the present disclosure.
It will be appreciated that the data (including but not limited to the data itself, the acquisition or use of the data) involved in the present technical solution should comply with the corresponding legal regulations and the requirements of the relevant regulations.
Micro-services are a cloud-native architecture approach in which a single application may be made up of many loosely-coupled and independently-deployable smaller components or services. The services are coordinated and matched with each other, and the final value is provided for the users. Each service runs in an independent process, and the service communicate with each other by adopting a lightweight communication mechanism. Each service is built around specific functions and can be deployed independently to a production environment, class production environment, etc. Micro-services consist of many smaller, loosely coupled services that make up an application.
With the continuous development of the springboot microservice technology, the containerization gradually becomes a mainstream scheme of microservice deployment, and software codes and required components, such as java virtual machines, dependent libraries and the like, are packaged together and then run in own containers in a separated mode.
The method has the advantages that the mode of directly deploying and operating codes on a platform or an operating system can be replaced by containerized deployment, so that the deployment and the operation of the micro-service are not influenced by a dependent basic framework or an environment operating system any more, but after the springboot micro-service is containerized, the upgrading process and the required time of the micro-service are also prolonged, 3 steps of compiling mirror images, mirror image pulling, starting the container and the micro-service are generally carried out, the upgrading time of the springboot micro-service in the container once is generally required to be several tens of minutes or even longer, the size of the mirror images generated by compiling is generally several hundred megameters, and the dependence on hard disk storage resources is increased.
In order to solve the above technical problems, fig. 1 is a flow chart of a micro service upgrading method provided by an embodiment of the present disclosure, where the embodiment of the present disclosure is applicable to a case of performing containerized micro service upgrading, the method may be performed by a micro service upgrading device, and the device may be implemented in a form of software and/or hardware, optionally, implemented by an electronic device, where the electronic device may be a mobile terminal, a PC end, a server, or the like.
As shown in fig. 1, the method includes:
s110, acquiring request parameters.
The request parameters include resource location information and function parameters.
The request parameter may be understood as a parameter for requesting a micro-service upgrade. The acquisition of the request parameters is not limited, and can be acquired from the user through a human-computer interaction interface. Resource location information may be understood as information characterizing the location of a resource, which may be a functional archive package. The function archive package may be a data package formed by packaging the function codes. The function parameters may be parameters related to functions required at the time of micro-service upgrade. The function parameters can be transmitted to the function code in a penetrating way, and can be obtained when the function code is executed as an entry of the function code so as to complete the required function based on the function parameters. The specific content of the functional parameter is not limited, and may be determined based on actual conditions. The functional code is also called service code, which is the code for designing service logic in a specific project, namely the code for realizing the required requirement.
For example, a functional unit may be referred to as an algorithm unit corresponding to a function to be implemented, taking the functional unit as an output "hi" as an example, and the functional parameter may be taken as an input parameter of the functional unit, where "hi" may be a functional parameter. When executing the function code, the output of "hi" can be realized with the function parameter as an input. The function unit can be obtained after the function archiving package class loader analyzes.
In one embodiment, the functional unit sends a default message, for example, the default message is message a, and the micro service can implement the function provided by the functional unit, and when the micro service needs to be updated, for example, the micro service needs to be updated to send message b, the modified function code can be packaged into a function filing package. When a request for transmitting a message is again made, a function filing package can be acquired, and the function filing package is changed from the original message a to the message b because the updated function filing package is acquired. Thus, after a request to send a message, such as after the request parameters for the request to send a message are obtained, the function code for sending message b may be executed.
In one embodiment, the message is sent to user m through a communication facility. After the account of user m in the communication tool does not exist, an update of the micro service is required, such as sending a message to the new user n, which is originally required to be sent to user m. Further, the function code implementing the transmission to user a is changed so that the message can be transmitted to user n. After the function codes are changed, the function codes can be packaged and uploaded to a Maven warehouse. When the user sends a message to the user m next time, the corresponding modified function code can be acquired, and the message sending to the user n is completed. When the function code is changed, the execution portal archive package needs to be inherited, and the resource position information before and after the function code is changed is the same. The corresponding function parameters after the function code is changed can be determined based on the parameters required by the changed function code. If the function parameter corresponding to the function code before modification is user m, the function parameter corresponding to the function code after modification is user n.
And S120, acquiring and analyzing a function filing package corresponding to the micro service based on the resource position information.
The function filing package is a data package formed by packing function codes, the function codes inherit abstract classes included in the execution entrance filing package to realize an abstract method in the execution entrance filing package, the abstract method is used for identifying an execution entrance of the function codes, and the function codes are codes after updating functions provided by the micro-services. The function parameters are parameters required for executing a desired function when the function code is executed.
The function filing package is formed by packaging the function codes, and the function codes can inherit abstract classes of the execution entry filing package when being realized so as to realize abstract methods in the abstract classes. The abstract method identifies an execution inlet of the function code, and the function parameters can be transmitted to the execution inlet identified by the abstract method so as to execute the updated function code, thereby realizing micro-service upgrading.
The execution portal archive package may be considered a base package, i.e., a base package. The realization of all functions inherits the execution inlet filing package, and the writing of the function codes is realized on the basis of the execution inlet filing package.
After the request parameter is acquired, the resource position information in the request parameter can be acquired, so that the function filing package corresponding to the resource position information can be acquired based on the resource position information. There is a one-to-one correspondence between the functional archive package and the resource location information. The specific content of the resource location information is not limited here. The specific form of the resource location information may be determined based on the manner in which the feature archive package is stored. If the feature archival package is stored within the wheat Wen Cangku, the resource location information can be wheat Wen Zuobiao. Based on wheat Wen Zuobiao, the functional filing package corresponding to wheat Wen Zuobiao can be obtained from wheat Wen Cangku.
After the resource location information is acquired, the function filing package can be acquired from the storage space of the storage function filing package. The functional archive package may be stored on a remote server or terminal device. The step can acquire the function filing package corresponding to the resource position information to the local through a network request mode. After the local data is obtained, the function filing package can be analyzed so as to execute the function codes in the function filing package. The specific manner of parsing is not limited herein and may be determined based on actual conditions. If the function filing package can be analyzed, the filing, namely, an Archive object; the associated archive packages stored under the function archive package setup path may also be parsed.
And S130, executing corresponding function codes based on the parsed function filing package and the function parameters.
After the function filing package is analyzed, the function parameters can be used as the parameters of the function codes corresponding to the function filing package to execute the function codes, and when the function codes are executed, loading and instantiation of the required class can be realized based on the class loader of the corresponding function filing package, so that the entry method class of the function codes is executed, and the function logic is triggered. After the function code is executed, the execution result can be returned to the user.
In this embodiment, the containerized micro-service may be loaded with a function archive package based on a hot loading manner, the function archive package may be generated after being packaged based on the modified function code, and the corresponding function code may be executed after being loaded into the function archive package. Hot loading means that the altered code can be validated without restarting the microservice.
According to the technical scheme, multiple steps of compiling mirror image, mirror image pulling, starting a container, micro-service and the like are not needed in the whole upgrading process, the containerized micro-service obtains and analyzes the function archiving package based on the request parameters only in a hot loading mode so as to complete micro-service upgrading, solve the problem of consuming time for containerized micro-service upgrading, and achieve the effect of reducing the time length of containerized micro-service upgrading.
In one embodiment, the abstract methods within the portal archive package have annotation information for locating the abstract methods.
The annotation information may be considered as an annotation description added for something. Annotation information is also called annotation information, and the added annotation information realizes the addition standard (i.e. certain information is attached) of methods, classes, parameters, packages, domains, variables and the like. And the marked information is extracted for use by reflection at a later time.
Where the function code is java code, the annotation is a type of metadata that can be added to the java code, and classes, methods, variables, parameters, and packages can all be modified with annotations. The annotation has no direct effect on the code it modifies. Information may be provided for class loading to find the ingress class.
In the present disclosure, the entry class of the function code, also called entry code class, needs to be added with annotation information, through which the class loader can find the entry class of the function logic, and further trigger the function logic to implement micro-service update.
In one embodiment, the packet name path of the abstract class is a fixed target path, the packet name path of the annotation information is the fixed target path, and the annotation information and the fixed path are used for locating the abstract method.
In this embodiment, the abstract class and the packet name path of the annotation information may be fixed, so that the entry class of the package, such as the abstract method, is archived by the fixed path and the annotation information positioning function. The target path, where abstract class and annotation information are fixed, may inherit from the packet name path of the execution portal archive package.
In one embodiment, the function filing package is a custom filing package, the filing package associated with the function codes is stored under a set path in the function filing package, the function filing package is obtained by packing the function codes through a custom packing plug-in, and the custom packing plug-in is used for packing the filing package associated with the function codes stored under the set path into the function filing package by returning the set path to a set layout method.
The functional archive package in this embodiment is a custom archive package, i.e., a custom archive package. The function archive package stores archive packages associated with functions, such as dependent archive packages. The archive package may be an archive package.
To enable packaging of custom archives, the present disclosure uses custom packaging plug-ins to package to obtain custom archives. The custom package plug-in may package the associated archive packages stored under the set path to a functional archive package. The set path can be an independent path under the function filing package and is specially used for storing the filing package associated with the function codes.
The custom package plug-in the embodiment can be modified on the basis of a spellebute text plug-in, namely a spring-boot-maven-plug in package plug-in, and a jar package in a custom format, namely a function filing package, is realized by rewriting repackageMojo class maven package entry function repackage. Specifically, the jar layout, that is, the XJarLayout class, is customized, the class realizes the repackaging layout, that is, the repackaging layout interface, and a getLibraryDestination method is defined in the customized repackaging layout interface, and the getLibraryDestination method can return to a fixed set path, such as an 'X-BOOT-INF/lib/' path.
The setup layout setLayout method of the repackager object is then invoked, set as a custom XJarLayout object, to package the archive associated with the function code under the set path.
Fig. 2 is a flowchart of a micro-service upgrade method according to an embodiment of the present disclosure, and as shown in fig. 2, the method embodies specific operations of acquiring and analyzing a function archive package and executing a function code, and includes the following steps:
s210, acquiring request parameters.
S220, acquiring and analyzing the functional Java filing package corresponding to the wheat Wen Zuobiao from the wheat Wen Cangku through a class loader suitable for the functional Java filing package.
The coordinates in maven are to locate a uniquely identified jar packet. The Maven coordinates are mainly composed of GAV, and based on the Maven coordinates, a jar packet can be determined to be at the internet location.
G in GAV is groupID: the current Maven organization name is defined, is a unique identifier of the item organization, and the structure of the packet actually corresponding to the java is the directory structure of the java in the main directory. Which group the item belongs to is defined. A is artifactId: the actual item name is defined, which is the unique identifier of the item, defining the unique ID of the current maven item in the group. V is version: a current version of the current item is defined.
The wheat Wen Cangku is a place for storing jar packages, the jar packages are mainly used for packaging class files, and the jar packages in the application are also called functional jar packages and are used for achieving micro-service upgrading.
The function filing package in this embodiment may be a function jar package, and after the custom package plug-in obtains the function filing package by packaging, the function filing package may be placed in a wheat, i.e. a maven warehouse, so that when the function is to be upgraded, the function jar package corresponding to the resource location information is obtained from the wheat Wen Cangku based on the resource location information, i.e. the function java filing package. The resource location information is wheat Wen Zuobiao.
After the resource location information is obtained in this step, the functional jar packet corresponding to the resource location information may be obtained from the wheat Wen Cangku by a class loader applicable to the functional jar packet. The class loader applicable to the functional jar packet can be regarded as a class loader capable of acquiring and analyzing the functional jar packet. The functional jar package is a custom jar package, and the custom jar package can be obtained and analyzed through class loading suitable for the application.
When the class loader acquires the functional jar package, the class loader can acquire the functional jar package from a remote server, analyze the jar package and analyze an archive package under a set path in the jar package.
In one embodiment, the class loader includes a first class loader and a second class loader, and correspondingly, the obtaining and parsing, by the class loader applicable to the functional java archive package, the functional java archive package corresponding to the wheat Wen Zuobiao from the wheat Wen Cangku includes:
in the creating and archiving method of the first class loader, the functional Java archiving package corresponding to the wheat Wen Zuobiao is pulled to the local and the functional Java archiving package is analyzed;
in the nested filing method of the first type loader, determining whether a set path exists in the path of the functional Java filing package, wherein the filing package associated with the functional code is stored in the set path, and if so, analyzing the filing package stored in the set path;
In the class loader acquiring method of the first class loader, determining the class loader corresponding to the functional Java archive package, and the second class loader associates the class loader determined by the class loader acquiring method with the class loader through a construction method.
The construction method is a special method, which is a method similar to the name. The creation of the object is accomplished by a construction method, and the function of the object is mainly to complete the initialization of the object. The construction method is automatically invoked when a class instantiates an object. The construction method can also be reloaded as well as other methods. In Java, any variable must be initially set before it can be used.
The first type loader can be used for acquiring and analyzing the functional jar packet to the memory so that the analyzed jar packet can be analyzed by the containerized micro-service, and the second type loader can be used for secondarily packaging the analyzed jar packet to the memory. The second class loader aggregates the first class loader and the java native class loader, such as the URLClassLoader, to provide a final loading method to the outside. The java native class loader can load java native information, and the first class loader can load custom jar packets.
The Archive method is created, namely, the createArchive method can be used for rewriting the createArchive method, and the Archive method can be created to pull the function Archive package to the local and analyze the function Archive package into an Archive object.
The nested archiving method, namely the isNestedARchive method, can be used for rewriting the isNestedARchive method, and the archiving method can be created to judge whether a set path exists under the path of the function jar packet, and if so, the archiving packet associated with the function code under the set path can be analyzed.
The first class loader further comprises a class loader acquisition method, the method is a newly added method, the class loader corresponding to the function jar can be determined, and the method is used for analyzing the java class file under the function jar package based on the corresponding class loader by the second class loader.
The second class loader can be related to the class loader corresponding to the function jar packet determined by the first class loader through the construction method so as to acquire the entry address of the class realizing the abstract method, acquire the entry class and execute the function code.
S230, loading the function filing package analyzed by the first type loader into the memory through a method for loading the second type loader into the memory.
The load XJarTomemory method is a method for loading the parsed function archive package into the memory. The second type loader can load the parsed function archive package into the memory.
S240, acquiring and executing the function codes for realizing the abstract method through the query method of the second class loader.
The query method, namely the findXJob method, can inherit the entry class of the abstract class included in the execution entry filing package, then instantiate class objects in a reflection mode, and execute the abstract method of the objects, namely the dojob method, namely the function code is realized. The function parameter is the parameter of the function code.
By the micro-service upgrading method provided by the embodiment, the custom function jar package is loaded through the wheat Wen Zuobiao, analysis of the custom function jar package is realized, execution of the function code of the custom function jar package is executed, and the function parameter is used as an input parameter when the function code is executed. On the basis that the loading time is reduced in the whole upgrading process, the micro-service upgrading can be realized only based on the function filing package, and resources required by the micro-service upgrading are reduced.
In the following, the present disclosure is described exemplarily, where the micro service upgrade method provided by the present disclosure may be considered as micro service upgrade under a java hot loading RESTful micro service framework based on springboot in a container environment, a request parameter in the present application may be an http request, and a corresponding micro service framework may be RESTful. RESTful is a specification, a standard for micro-services. Springboot is a Java container that then needs to run inside the container of a virtual machine. The spring boot is a container, and the function code can run under the framework of the spring boot.
The method and the device mainly solve the problems that upgrading of the containerized springboot micro-clothes is long in time consumption and occupies more storage resources.
According to the method, the micro service code, namely the functional code, is finally packaged into the jar package (namely the functional filing package) in the custom format through the custom java class loader (namely the class loader applicable to the functional Java filing package), the custom format jar package (namely the execution entry filing package) and the custom execution unit, and the dynamic upgrading of the micro service is realized through a hot loading mode.
The hot loading can analyze the self-defined jar packet into a format which can be operated by java, find an entry address according to annotation information after the analysis is completed, and execute a dojob method corresponding to the entry address.
The custom format jar package is a logical execution unit, implementation of all functions requires inheritance of the custom format jar package, writing of function code on the custom format jar package,
the purpose of the custom format jar package is to provide a base package for the framework of the present disclosure, so that the function generates a corresponding function archive package by inheriting the reference package and stores the corresponding function archive package in the wheat Wen Cangku. That is, the execution unit relies on the custom format jar packet to realize the logic of the custom format jar packet, and then realizes the logic of the execution unit itself, such as function codes. Custom format jar packages include classes of underlying methods, i.e., abstract methods.
The class loader executes the functional unit, finds the entry of the functional unit through the annotation information, and the functional unit is the actual functional code that implements the base package.
The implementation of the present disclosure is mainly composed of four parts:
1. the custom format request parameters comprise resource location information, namely GAV parameters (maven coordinates, g stands for groupId, a stands for artifactId, and v stands for version), and request parameter information, namely function parameters, needed by an execution portal;
2. the user-defined execution unit jar package is an execution portal filing package, and the function code can be realized in a specified abstract method doJob by inheriting abstract class Abstract XJob provided by the framework system;
3. the custom maven packaging plug-in based on spring-boot-maven-plug in is responsible for generating jar files in a specified format, namely a function filing package;
4. and the class loader which is responsible for pulling the Jar file and analyzing the custom Jar format based on the spring-boot-loader is applicable to the class loader of the functional Java filing package.
Fig. 3 is a system frame diagram provided by an embodiment of the present disclosure, referring to fig. 3, a spring boot micro service may be integrated on a server, and a maven package plug-in may be integrated on any terminal device and the server. The function archive package packaged by the maven packaging plug-in can be packaged into a maven warehouse. The maven repository may be located at any terminal device and server. The maven warehouse, the maven package plug-in and the springboot microservice can be on one electronic device or different electronic devices.
In the framework of the present disclosure, in order to obtain a functional jar packet and execute a functional code, a request parameter may be in a json format, where the request parameter includes two parts:
resource location information, i.e., gav parameters, for locating functional jar packets;
the normal request parameters, i.e. the function parameters, are used to pass through to the execution unit.
Within the framework of the present disclosure, a custom execution portal jar package, i.e., an execution portal archive package, is composed of an abstract class, i.e., annotation information, which is the abstract method doJob (i.e., hot loader portal) that the function code must inherit and implement.
Custom notes @ XJob is a class of functional entry codes, i.e., notes that must be added to the class of entries, through which the custom class loader can find the class of entries of the functional logic, i.e., the inherited doJob method.
The abstract class Abstract XJob packet name path is fixed com.XX, the entry of the doJob method is Map object exit and Map object, wherein the Map object of the entry is common request parameter of transparent transmission, the function code realizes the method, the specific logic code, namely the function code, in which the packet name path of the custom annotation @ XJob is also fixed com.XX, and the entry method class of the function jar packet can be found through the fixed path and the annotation name, namely the actual function code of the abstract class is realized.
The custom maven packaging plug-in, namely the custom packaging plug-in, firstly realizes a repackaging layout interface through the custom XJarLayout class, and defines a get library destination method in the interface. And the getLibraryDestination method is rewritten, a fixed X-BOOT-INF/lib/"path is returned, namely, a path is set, and the X-BOOT-INF/lib/" path is called to acquire a native jar under the path to carry out reparse packaging.
In this embodiment, when the function code is written, the execution entry jar packet needs to be inherited, and when the function code is packaged, the dependent jar packet can also be packaged. The packaged function archive package may be stored in a Maven repository.
After obtaining the request parameters of the user, the class loader upgrades the micro service in a hot loading mode, such as a dynamic updating mode in the running process, for example, obtains the request parameters of the user, obtains the corresponding function filing package based on the request parameters, extracts the function codes of the function filing package, and loads the function codes into the memory for execution. The function filing package is generated based on the changed function codes, and after the function codes are loaded into the memory and executed, the micro service where the class loader is located, such as the springboot micro service, namely the upgrade of the springboot micro service, is completed.
Fig. 4 is a catalog format schematic diagram of a custom archive package generated by a custom packaging plug-in provided by an embodiment of the present disclosure. Referring to fig. 4, the package name represents a java namespace of a function implementation, after the function codes are packaged, some codes can be placed under a package name path, and an X-BOOT-INF/lib directory is a path (i.e. a set path) stored by a third party native jar on which the function depends, i.e. an archive package storage path on which the function codes depend. The function code may use a third party open source technology, and for java, the jar package, the function code dependent jar package is stored under the set path. The directory format of the present disclosure enables the effect of isolation. Such as the isolation of different functional codes, the isolation of different content of the same functional code.
The present disclosure is a class loader, i.e. a class loader applicable to the functional java archive package, and fig. 5 is a core class diagram of a class loader provided by an embodiment of the present disclosure. Referring to fig. 5, the custom class loader of the present invention is composed of two core classes, namely an XJarLauncher (i.e., a first class loader) and a HotSwapClassLoader (i.e., a second class loader), the first class loader is used for pulling a function archive package, and the second class loader is used for aggregating the first class loader and the native loader to provide a final loading method.
The XJarLauncher inherits abstract class ExeccentrileArchiveleauncher from spring-boot-loader project, dynamically pulls a Jar package (i.e. a function archiving package) in a custom format and analyzes class files therein by a custom construction method and a rewrite createArchive method (i.e. a nested archiving method) and an isNestedARchive method (i.e. a nested archiving method), and returns ClassLoader corresponding to the Jar package (i.e. a function archiving package) which is pulled currently by a custom getXJarClassLoader method (i.e. a class loader acquisition method), namely a class loader corresponding to the function Java archiving package.
The HotSwapClassLoader inherits from a java native class loader URLClassLoader, associates class loaders acquired by getXJarClassLoader of the XJarLauncher object in a self-defined construction method, acquires a function object instance which realizes abstract class Abstract XJob by a self-defined findXJob method (i.e. a query method), and finally invokes the doJob method to execute function logic.
FIG. 6 is a flow chart illustrating the implementation of a class loader provided by an embodiment of the present disclosure, referring to FIG. 6, the containerized micro-service obtains request parameters from a user, and parses GAV information, i.e., resource location information, in the request parameters; the XJarLauncher object is then initialized by the construction method using GAV parameters, i.e., resource location information. The XJarLauncher object may be initialized each time a request parameter is obtained.
The user may be a person or a dependent microservice of a third party.
And calling createArchive in the construction method to acquire GAV coordinates, namely jar files under the resource position information, namely the function filing package. Injecting the created XJarLauncher object through a construction method of the HotSwapClassLoader, calling the getXJarClassLoader of the XJarLauncher object to carry out parent-child loading association in the construction method, and calling the getJarFile method of the XJarLauncher object to acquire a file object of the Jar which is already pulled to the local, wherein the file object can be regarded as an instance corresponding to the function archive package after being loaded into the memory. The functional archive package is a file object after being loaded into the memory. And calling a toURL method of the File object to acquire the path address of the File. And then, calling addURLFile and loadXJarTomemory methods by using the obtained file address to load a class file into a memory (namely, loading a function filing package analyzed by a first class loader into the memory through a loading method of a second class loader), calling findKefuJob, namely, finding an entry class for realizing Abstract XJob by using the findXJob method, instantiating an Abstract XJob object by using the initJob, and executing a doJob method of the object to realize function logic, namely, realizing a query method through the second class loader, and obtaining and executing a function code for realizing the abstract method.
More specifically, the XJarLauncher class is inherited from the ExecutableArchiveleauncher class, the createArchive and isNestedARchive methods are rewritten, the constructors are customized and the getXJarClassLoader function is newly added,
the construction function is mainly used for injecting gav parameters, the corresponding jar package is pulled to the local place through the gav parameters injected by the construction function in the rewritten createArchive, the jar package is resolved into an Archive object, and the rewritten isNestedARC is mainly used for judging whether the path under the jar is under the path of 'X-BOOT-INF/lib/', and is used for resolving the third party dependent jar compressed and packed by the custom packing plug-in, namely the function archiving package associated with the function code. createArchive and isNestedArchive parse the functional archive package into a format that conforms to the virtual machine specification. The newly added getXJarClassLoader mainly returns a ClassLoader object corresponding to jar based on the gav parameter injected by the constructor, namely a class loader corresponding to the functional Java filing package, and is used for analyzing the java class file under the jar. Namely, the creation archiving method and the nesting archiving method of the first type loader analyze the function archiving package into other formats of the virtual machine.
The HotSwapClassLoader class inherits from the URLClassLoader, the XJarLauncher object is used as an entry to be injected into the class through a self-defined construction parameter, and the ClassLoader object returned by the getXJarClassLoader of the XJarLauncher object is associated with the father ClassLoader, namely, the class loader determined by the class loader acquisition method is associated with the class loader by the second class loader through a construction method. A parent ClassLoader may be a currently executing thread, such as a thread of a class loader object.
The class file parsed by the XJarLauncher is loaded into memory by a custom loadxjartommemory method (i.e., a load to memory method),
the actual function class of Abstract XJob is inherited in the custom jar through the custom findXJob method (i.e. query method), the object is instantiated through reflection, then the doJob method can be called through the object, the actual function logic is triggered, and finally the execution result is returned.
The first type loader and the second type loader can also be applicable to native classes, the used native classes are not limited, for example, the first type loader can also use entry, file, classloader and defaulthandler system, and the abstract class exechamabalearchevacuncher inherited by the first type loader can also use entry.
The second class of loaders may also use URLs and garfile.
According to the micro-service upgrading method provided by the disclosure, the containerized upgrading process is not required to be executed, only the function archiving package is required to be packaged to the wheat Wen Cangku in a hot loading mode, the function archiving package inherits the execution inlet jar package, and the function codes can be realized in the function archiving package. At the micro-service upgrade, the function archive package is pulled from within the wheat Wen Cangku for micro-service upgrade. The method and the device can shorten the micro-service upgrading time of the springboot to tens of seconds.
The function filing package packed by the present disclosure is a pure function code, the function filing package is the size of the function code, or the function code size plus the dependent filing package, i.e. the function filing package can be only tens of megabits, even several megabits, and the amount of resources involved is small. The method reduces hundreds of megabits of storage resources required for upgrading the micro-service to tens of megabits by generating a new jar packet to upgrade the micro-service.
Fig. 7 is a schematic structural diagram of a micro service upgrade apparatus according to an embodiment of the present disclosure, where the apparatus includes: acquisition module 710, parsing module 720 and execution module 730.
An obtaining module 710, configured to obtain request parameters, where the request parameters include resource location information and function parameters;
the parsing module 720 is configured to obtain and parse a function archiving package corresponding to the micro service based on the resource location information, where the function archiving package is a data package formed after a function code is packaged, and the function code inherits an abstract class included in an execution entry archiving package to implement an abstract method in the execution entry archiving package, where the abstract method is used to identify an execution entry of the function code, and the function code is a code after updating a function provided by the micro service;
And an execution module 730, configured to execute the corresponding function code based on the parsed function archive package and the function parameter.
According to the technical scheme provided by the embodiment of the disclosure, multiple steps of compiling mirror image, mirror image pulling, starting a container, micro service and the like are not needed in the whole upgrading process, the containerized micro service obtains and analyzes the function filing package based on the request parameters only in a hot loading mode so as to complete micro service upgrading, solve the problem of time consumption of containerized micro service upgrading, and achieve the effect of reducing the time length of containerized micro service upgrading.
The micro-service upgrading device provided by the embodiment of the disclosure can execute the micro-service upgrading method provided by any embodiment of the disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
It should be noted that each unit and module included in the above apparatus are only divided according to the functional logic, but not limited to the above division, so long as the corresponding functions can be implemented; in addition, the specific names of the functional units are also only for convenience of distinguishing from each other, and are not used to limit the protection scope of the embodiments of the present disclosure.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure. Referring now to fig. 8, a schematic diagram of an electronic device (e.g., a terminal device or server in fig. 8) 500 suitable for use in implementing embodiments of the present disclosure is shown. The electronic device 500 of the present disclosure includes: one or more processing devices 501;
Storage 508, for storing one or more programs,
the one or more programs, when executed by the one or more processing devices 501, cause the one or more processing devices 501 to implement the micro-service upgrade method provided by embodiments of the present disclosure.
The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 8 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 8, the electronic device 500 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 501, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage means 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic apparatus 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An edit/output (I/O) interface 505 is also connected to bus 504.
In general, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 507 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 508 including, for example, magnetic tape, hard disk, etc.; and communication means 509. The communication means 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. While fig. 8 shows an electronic device 500 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 509, or from the storage means 508, or from the ROM 502. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing device 501.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
The electronic device provided by the embodiment of the present disclosure and the micro service upgrade method provided by the above embodiment belong to the same inventive concept, and technical details not described in detail in the present embodiment may be referred to the above embodiment, and the present embodiment has the same beneficial effects as the above embodiment.
The present disclosure provides a computer storage medium having stored thereon a computer program which, when executed by a processor, implements the micro-service upgrade method provided by the above embodiments.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two.
The computer storage medium may be a storage medium of computer executable instructions, which when executed by a computer processor, are for performing a method as provided by the present disclosure.
The computer readable storage medium may be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to:
the computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring request parameters, wherein the request parameters comprise resource location information and function parameters;
acquiring and analyzing a function filing package corresponding to a micro service based on the resource position information, wherein the function filing package is a data package formed after function codes are packaged, the function codes inherit abstract classes included in an execution inlet filing package so as to realize an abstract method in the execution inlet filing package, the abstract method is used for identifying an execution inlet of the function codes, and the function codes are codes after updating functions provided by the micro service;
And executing the corresponding function codes based on the parsed function filing package and the function parameters.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules or units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. Where the name of the module or unit does not constitute a limitation on the unit itself in some cases, the acquisition module may also be described as a "request parameter acquisition module", for example.
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, there is provided a micro service upgrade method, applied to a containerized micro service, including:
acquiring request parameters, wherein the request parameters comprise resource location information and function parameters;
acquiring and analyzing a function filing package corresponding to a micro service based on the resource position information, wherein the function filing package is a data package formed after function codes are packaged, the function codes inherit abstract classes included in an execution inlet filing package so as to realize an abstract method in the execution inlet filing package, the abstract method is used for identifying an execution inlet of the function codes, and the function codes are codes after updating functions provided by the micro service;
and executing the corresponding function codes based on the parsed function filing package and the function parameters.
In accordance with one or more embodiments of the present disclosure, a method of example 1 is provided,
the resource location information includes a wheat Wen Zuobiao, the function filing package includes a function Java filing package, and correspondingly, the function filing package corresponding to the micro-service is obtained and analyzed based on the resource location information, including:
and acquiring and analyzing the functional Java filing package corresponding to the wheat Wen Zuobiao from the wheat Wen Cangku through a class loader suitable for the functional Java filing package.
In accordance with one or more embodiments of the present disclosure, a method of example 2 is provided,
the class loader comprises a first class loader and a second class loader, and correspondingly, the method for acquiring and analyzing the functional Java filing package corresponding to the wheat Wen Zuobiao from the wheat Wen Cangku through the class loader suitable for the functional Java filing package comprises the following steps:
in the creating and archiving method of the first class loader, the functional Java archiving package corresponding to the wheat Wen Zuobiao is pulled to the local and the functional Java archiving package is analyzed;
in the nested filing method of the first type loader, determining whether a set path exists in the path of the functional Java filing package, wherein the filing package associated with the functional code is stored in the set path, and if so, analyzing the filing package stored in the set path;
in the class loader acquiring method of the first class loader, determining the class loader corresponding to the functional Java archive package, and the second class loader associates the class loader determined by the class loader acquiring method with the class loader through a construction method.
In accordance with one or more embodiments of the present disclosure, a method of example 1 is provided [ example 4 ],
The executing the corresponding function code based on the parsed function filing package and the function parameter comprises the following steps:
loading the function filing package analyzed by the first type loader into the memory through a method of loading the second type loader into the memory;
and acquiring and executing the function code for realizing the abstract method by the query method of the second class loader, wherein the function parameter is the parameter of the function code.
In accordance with one or more embodiments of the present disclosure, a method of example 1 is provided [ example 5 ],
the abstract methods have annotation information within the portal archive package, the annotation information being used to locate the abstract methods.
In accordance with one or more embodiments of the present disclosure, the method of example 5 is provided [ example 6 ],
the packet name path of the abstract class is a fixed target path, the packet name path of the annotation information is the fixed target path, and the annotation information and the fixed path are used for positioning the abstract method.
In accordance with one or more embodiments of the present disclosure, a method of example 1 is provided [ example 7 ],
the function filing package is a self-defined filing package, the filing package associated with the function codes is stored under a set path in the function filing package, the function filing package is obtained by packing the function codes through a self-defined packing plug-in, and the self-defined packing plug-in is used for packing the filing package associated with the function codes stored under the set path into the function filing package by returning the set path to a set layout method.
According to one or more embodiments of the present disclosure, there is provided a micro service upgrade apparatus [ example 8 ], comprising:
the acquisition module is used for acquiring request parameters, wherein the request parameters comprise resource position information and functional parameters;
the analysis module is used for acquiring and analyzing a function filing package corresponding to the micro-service based on the resource position information, wherein the function filing package is a data package formed after function codes are packaged, the function codes inherit abstract classes included in an execution inlet filing package so as to realize an abstract method in the execution inlet filing package, the abstract method is used for identifying an execution inlet of the function codes, and the function codes are codes after updating functions provided by the micro-service;
and the execution module is used for executing the corresponding function codes based on the parsed function filing package and the function parameters.
According to one or more embodiments of the present disclosure, there is provided an electronic device [ example 9 ], the electronic device comprising:
one or more processing devices;
storage means for storing one or more programs,
the one or more programs, when executed by the one or more processing devices, cause the one or more processing devices to implement the methods of any of examples 1-7.
According to one or more embodiments of the present disclosure, there is provided a storage medium containing computer-executable instructions for performing the method of any one of examples 1-7 when executed by a computer processor.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims.

Claims (10)

1. A method of micro-service upgrade, applied to containerized micro-services, the method comprising:
acquiring request parameters, wherein the request parameters comprise resource location information and function parameters;
acquiring and analyzing a function filing package corresponding to a micro service based on the resource position information, wherein the function filing package is a data package formed after function codes are packaged, the function codes inherit abstract classes included in an execution inlet filing package so as to realize an abstract method in the execution inlet filing package, the abstract method is used for identifying an execution inlet of the function codes, and the function codes are codes after updating functions provided by the micro service;
and executing the corresponding function codes based on the parsed function filing package and the function parameters.
2. The method of claim 1, wherein the resource location information comprises wheat Wen Zuobiao, the function archive package comprises a function java archive package, and the acquiring and analyzing the function archive package corresponding to the micro service based on the resource location information comprises:
And acquiring and analyzing the functional Java filing package corresponding to the wheat Wen Zuobiao from the wheat Wen Cangku through a class loader suitable for the functional Java filing package.
3. The method according to claim 2, wherein the class loader includes a first class loader and a second class loader, and the obtaining and parsing, by the class loader adapted to the functional java archive package, the functional java archive package corresponding to the wheat Wen Zuobiao from the wheat Wen Cangku includes:
in the creating and archiving method of the first class loader, the functional Java archiving package corresponding to the wheat Wen Zuobiao is pulled to the local and the functional Java archiving package is analyzed;
in the nested filing method of the first type loader, determining whether a set path exists in the path of the functional Java filing package, wherein the filing package associated with the functional code is stored in the set path, and if so, analyzing the filing package stored in the set path;
in the class loader acquiring method of the first class loader, determining the class loader corresponding to the functional Java archive package, and the second class loader associates the class loader determined by the class loader acquiring method with the class loader through a construction method.
4. The method of claim 1, wherein the executing the corresponding function code based on the parsed function archive and the function parameters comprises:
loading the function filing package analyzed by the first type loader into the memory through a method of loading the second type loader into the memory;
and acquiring and executing the function code for realizing the abstract method by the query method of the second class loader, wherein the function parameter is the parameter of the function code.
5. The method of claim 1, wherein the abstract method has annotation information within the portal archive, the annotation information being used to locate the abstract method.
6. The method of claim 5, wherein a packet name path of the abstract class is a fixed target path, wherein a packet name path of the annotation information is the fixed target path, and wherein the annotation information and the fixed path are used to locate the abstract method.
7. The method of claim 1, wherein the function archive package is a custom archive package, wherein an archive package associated with a function code is stored under a set path in the function archive package, the function archive package is obtained by packing the function code through a custom packing plug-in, and the custom packing plug-in is used for packing the archive package associated with the function code stored under the set path into the function archive package by returning the set path to a set layout method.
8. A micro-service upgrade apparatus, comprising:
the acquisition module is used for acquiring request parameters, wherein the request parameters comprise resource position information and functional parameters;
the analysis module is used for acquiring and analyzing a function filing package corresponding to the micro-service based on the resource position information, wherein the function filing package is a data package formed after function codes are packaged, the function codes inherit abstract classes included in an execution inlet filing package so as to realize an abstract method in the execution inlet filing package, the abstract method is used for identifying an execution inlet of the function codes, and the function codes are codes after updating functions provided by the micro-service;
and the execution module is used for executing the corresponding function codes based on the parsed function filing package and the function parameters.
9. An electronic device, the electronic device comprising:
one or more processing devices;
storage means for storing one or more programs,
when the one or more programs are executed by the one or more processing devices, the one or more processing devices are caused to implement the method of any of claims 1-7.
10. A storage medium containing computer executable instructions for performing the method of any of claims 1-7 when executed by a computer processor.
CN202211170565.5A 2022-09-23 2022-09-23 Micro-service upgrading method and device, electronic equipment and storage medium Pending CN117806668A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211170565.5A CN117806668A (en) 2022-09-23 2022-09-23 Micro-service upgrading method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211170565.5A CN117806668A (en) 2022-09-23 2022-09-23 Micro-service upgrading method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117806668A true CN117806668A (en) 2024-04-02

Family

ID=90422257

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211170565.5A Pending CN117806668A (en) 2022-09-23 2022-09-23 Micro-service upgrading method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117806668A (en)

Similar Documents

Publication Publication Date Title
US10146515B1 (en) Live code updates
US8738589B2 (en) Classloading technique for an application server that provides dependency enforcement
CN110502222B (en) AAR method, apparatus, medium, and device for outbound dependency on internal base repository
US8327341B2 (en) Integrating aspect oriented programming into the application server
CN111240684B (en) Cutting method and device of JS codes, medium and electronic equipment
EP3848798A1 (en) Information processing method and apparatus, storage medium, and electronic device
US20080301637A1 (en) Profile service based deployment configuration
CN112463123B (en) Task compiling method, device, network node, system and storage medium
US12118361B2 (en) Unicontainers
CN110750545B (en) Dynamic library heat updating method, device, medium and equipment
US11068243B2 (en) Application stack builder based on node features
CN114077423A (en) Airport APP development container architecture based on mobile cross-platform
US8640146B2 (en) Providing extensive ability for describing a management interface
CN112527386B (en) Application program issuing method and device
CN112835568A (en) Project construction method and device
CN113268245A (en) Code analysis method, device and storage medium
US9996344B2 (en) Customized runtime environment
CN110851211A (en) Method, apparatus, electronic device, and medium for displaying application information
US20080301711A1 (en) Providing a POJO-based microcontainer for an application server
CN112416303B (en) Software development kit hot repair method and device and electronic equipment
CN114911481A (en) Code compiling method and device and electronic equipment
CN109491687B (en) Hot updating method and device of application software, terminal and readable medium
CN115576623B (en) Application program starting method and device
CN117806668A (en) Micro-service upgrading method and device, electronic equipment and storage medium
CN118132203A (en) Container management method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination