Code package processing method and device
By obtaining and parsing new service code packages for service codes, dynamically loading them to the virtual machine and registering them to the container, the challenges brought about by the complexity of functional modules in the service product update iteration are solved, and efficient service access processing and automated loading are achieved.
Patent Information
- Application Number
- CN202411545635.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-03-11
AI Technical Summary
In the process of updating and iteration of service products, in order to improve scalability, the implementation of functional modules is performed by other providers, resulting in complex and diverse functional modules, increasing challenges and pressure from other providers.
By obtaining the code package of the new service of the service code, the code development template based on the service code is used to develop and package the code, parse and process the implementation class, and load it into the virtual machine through the class loader, instantiate and register it into the container of the service code, realizing dynamic loading and automated loading.
It solves the possible class conflicts and package conflicts in the dynamic loading process of code packages for newly added services, improves the loading success rate of code packages, and improves the convenience and efficiency of service access processing.
Smart Images

Figure CN119597333A_ABST
Abstract
Description
Technical Field
[0001] This document relates to the field of data processing technology, and in particular to a code package processing method and device. Background Art
[0002] With the continuous development and updating of Internet technology, the application scope of online services provided based on the Internet has become wider and wider, and has gradually been known by more and more users. The update and iteration of service products has also gradually accelerated. In the process of updating and iteration of service products, in order to improve the scalability of service products, the implementation of certain functional modules in the service products is often handed over to other providers to execute. In this case, the service functions of the service products can be more perfect. In this process, these functional modules of the service products are complex and diverse, which makes other providers face certain challenges and pressures. Summary of the invention
[0003] One or more embodiments of the present specification provide a code package processing method, including: obtaining a code package of a newly added service of a service code. The code package is obtained after the provider of the newly added service develops and packages the code of the newly added service based on the code development template of the service code. The code package is parsed to obtain an implementation class, and the implementation class is loaded into a virtual machine through a class loader. The implementation class is instantiated in the virtual machine to obtain an instance of the implementation class. The instance of the implementation class is registered with the container of the service code, so that when the newly added service is accessed, the instance is called from the container to perform service access processing.
[0004] One or more embodiments of the present specification provide a code package processing device, including: a code package acquisition module, configured to acquire a code package of a newly added service of a service code. The code package is obtained after the provider of the newly added service develops and packages the code of the newly added service based on the code development template of the service code. An implementation class loading module, configured to parse the code package to obtain an implementation class, and load the implementation class into a virtual machine through a class loader. An instantiation module, configured to instantiate the implementation class in the virtual machine to obtain an instance of the implementation class. An instance registration module, configured to register an instance of the implementation class with the container of the service code, so that when the newly added service is accessed, the instance is called from the container to perform service access processing.
[0005] One or more embodiments of the present specification provide a code package processing device, including: a processor; and a memory configured to store computer executable instructions, wherein when the computer executable instructions are executed, the processor: obtains a code package of a newly added service of a service code. The code package is obtained after the provider of the newly added service develops and packages the code of the newly added service based on the code development template of the service code. The code package is parsed to obtain an implementation class, and the implementation class is loaded into a virtual machine through a class loader. The implementation class is instantiated in the virtual machine to obtain an instance of the implementation class. The instance of the implementation class is registered with the container of the service code, so that when the newly added service is accessed, the instance is called from the container to perform service access processing.
[0006] One or more embodiments of the present specification provide a computer-readable storage medium for storing computer-executable instructions, which implement the following steps when executed: Obtain a code package for a newly added service of a service code. The code package is obtained after the provider of the newly added service develops and packages the code for the newly added service based on a code development template of the service code. Parse the code package to obtain an implementation class, and load the implementation class into a virtual machine through a class loader. Instantiate the implementation class in the virtual machine to obtain an instance of the implementation class. Register the instance of the implementation class with the container of the service code so that when the newly added service is accessed, the instance is called from the container to perform service access processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0007] In order to more clearly illustrate one or more embodiments of the present specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present specification. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative labor. Figure 1 A schematic diagram of an implementation environment of a code package processing method provided in one or more embodiments of this specification; Figure 2 A processing flow chart of a code package processing method provided in one or more embodiments of this specification; Figure 3 A processing flow chart of a code package processing method applied to a signature verification scenario provided by one or more embodiments of this specification; Figure 4 A schematic diagram of an embodiment of a code packet processing device provided by one or more embodiments of this specification; Figure 5A schematic diagram of the structure of a code packet processing device provided in one or more embodiments of this specification. DETAILED DESCRIPTION
[0008] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the technical solutions in one or more embodiments of this specification will be clearly and completely described below in conjunction with the drawings in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.
[0009] The code package processing method provided in one or more embodiments of this specification can be applied to the implementation environment of code package processing. Figure 1 , the implementation environment at least includes: A code package processing component 101 for processing code packages, and a server 102 for deploying the code package processing component 101; in addition, the implementation environment may also include a data storage system 103 for storing code packages, and a development system 104 for code development and code packaging; The server 102 may be run on a server, which may be one or more servers, a server cluster consisting of several servers, or a cloud server of a cloud computing platform; The data storage system 103 may be run on a server, which may be one or more servers, a server cluster consisting of several servers, or a cloud server of a cloud computing platform; it should be noted that the server 102 and the data storage system 103 may be run by the same server, or by different servers; the development system 104 may be run on a provider device of a newly added service of the service code; In this implementation environment, after the code package processing component 101 obtains the code package of the newly added service of the service code from the data storage system 103, it loads the implementation class in the code package of the newly added service into the virtual machine through the class loader, creates an instance of the implementation class in the virtual machine, and registers the instance of the implementation class with the container of the service code, so that when the newly added service is accessed, the instance is called from the container of the service code to perform service access processing, thereby realizing dynamic loading of the instance of the newly added service through the code package processing component, so that the service code can achieve the effect of automatic loading of the instance of the newly added service without restarting; Among them, the code package can be obtained after the provider of the new service develops and packages the code for the new service based on the code development template of the service code; the code development and code packaging here can be carried out in the development system 104, so as to improve the convenience and flexibility of the code development of the provider of the new service through the code development template of the service code, and improve the adaptability of the code package and the service code.
[0010] One or more embodiments of a code packet processing method provided in this specification are as follows: Reference Figure 2 The code package processing method provided in this embodiment specifically includes steps S202 to S208.
[0011] Step S202, obtaining a code package of a newly added service of the service code.
[0012] The service code described in this embodiment refers to an identification code used to access or trigger a service. The specific form of the service code can be a QR code, barcode, color code, 3D code, etc.; the service code can be displayed on the client according to the code display instruction, and the user can scan the service code through the client. The scanning results of different users scanning through different clients may be different. For example, the scanning result of user A scanning the service code is to jump to service a, and the scanning result of user B scanning the service code is to jump to service b; optionally, the service code is configured with multiple services including the newly added service, that is, the service code supports one code for multiple scenarios; the service types of the multiple services configured by the service code are not specifically limited here, for example, the services configured by the service code can be government services, scenic area services, transportation services, etc.; the code package processing method provided in this embodiment can be applied to a code package processing component, and the code package processing component can be deployed on the server corresponding to the service code.
[0013] The newly added service of the service code refers to the service newly added by the service code. Similarly, the service type of the newly added service here is not specifically limited in this embodiment. The newly added service can be a government service, a scenic spot service, a transportation service, etc.; the code package of the newly added service refers to a code package that implements service-related functions of the newly added service, such as a JAR (Java Archive) package of the newly added service using the SPI (Service Provider Interface) mechanism; optionally, the code package is obtained after the provider of the newly added service develops and packages the code for the newly added service based on the code development template of the service code.
[0014] In actual applications, since the number of new services of the service code may continue to increase, if the development of the code package of the new service is handed over to the provider of the new service to complete independently, that is, no assistance is provided to the provider of the new service, in this case, the providers of each new service are isolated and independently complete the code development, which leads to class conflicts, package conflicts and other problems in the dynamic loading process of the code packages developed by each provider. In view of this, in order to avoid class conflicts, package conflicts and other problems in the code package loading process that lead to loading failures and improve the loading success rate of the code package, this embodiment introduces a code development template for the service code. Through a unified code development template, the code package obtained after the provider of the new service performs code development and code packaging can be successfully loaded; The code development template of the service code refers to a development template for code development and code packaging for the service of the service code, and the code development template may be an engineering template, such as an engineering template using the SPI mechanism; the provider of the newly added service refers to the provider of the relevant service functions of the newly added service, that is, the implementer of the relevant service functions of the newly added service; The code packaging may include: performing code obfuscation on the service code obtained by code development through a data generation component integrated with a code development template to obtain an updated service code, and packaging the updated service code to obtain a code package. Specifically, in an optional implementation manner provided in this embodiment, the code packaging is implemented in the following manner: Generate an updated class name for the class name in the service code obtained by the code development through the data generation component integrated in the code development template, and generate a package name for packaging; The class name in the service code is replaced with the update class name to obtain the update service code, and the update service code is packaged according to the package name to obtain the code package.
[0015] Among them, the data generation component can be a data generation plug-in, specifically a custom plug-in; the service code refers to the service code of the newly added service; the class name in the service code refers to the class name of the implementation class in the service code; the updated class name includes the class name regenerated for the class name; the package name refers to the package name of the code package after subsequent packaging; the updated service code refers to the updated service code after the class name in the service code is updated.
[0016] On this basis, optionally, the updated class name is obtained after the class name is input into a string generation algorithm for string generation; the package name is generated based on a timestamp of the current time; Among them, the string generation algorithm can be an algorithm for converting a class name into an updated class name in the form of a unique string. For example, the class name in the service code is 1. The class name 1 can be converted into a unique string as the updated class name through the string generation algorithm, that is, the updated class name obtained by the string generation algorithm each time the string is generated is different, so that the class name of the implementation class in each code package is different, thereby improving the success rate of loading the implementation class; the timestamp of the current time refers to the time point information representing the current time. Since the timestamp changes with time, the package name generated based on the timestamp of the current time is also unique, thereby avoiding package conflicts during the loading process.
[0017] It should be noted that the above-mentioned updated class name can also be obtained after the generation instruction is input into the string generation algorithm for string generation, that is, in the process of generating the updated class name, the string generation algorithm does not need to input the class name, and the updated class name can be generated after receiving the generation instruction; the updated class name can also be generated based on the timestamp of the current time; the package name can be obtained after the generation instruction is input into the string generation algorithm for string generation.
[0018] In specific implementation, the service code can provide a code development template through the development system, so that the provider of the newly added service of the service code can develop and package the code based on the code development template, thereby obtaining a code package for the newly added service; optionally, the code development template is configured in the development system; the code package is uploaded from the development system to the data storage system according to the upload instruction of the provider; the data storage system stores the code package after the usability verification is performed on the code package and the verification passes; Specifically, the provider of the new service can develop and package the code based on the code development template configured by the development system to obtain the code package of the new service. After that, the provider of the new service can upload the code package of the new service from the development system to the data storage system. In order to further improve the success rate of dynamic loading of the code package, the data storage system can perform usability verification on the code package after receiving the code package of the new service uploaded by the development system, and update the code package of the new service to the unloaded list of the service code after the usability verification passes; Among them, the availability verification of the code package may include: verifying whether there is a preset implementation class in the implementation class in the code package, and if so, determining that the verification is passed, and if not, determining that the verification is not passed; the preset implementation class here refers to one or more implementation classes of pre-set types; thereby, the availability verification of the code package is performed to verify whether the code package is obtained after code development and code packaging based on the code development template of the service code. Since the code development template can solve problems such as class conflicts and package conflicts, the availability verification is used to further improve the success rate of dynamic loading of the code package.
[0019] It should be added that in order to enhance the flexibility of code development and code packaging based on the service code code development template, the package type of the code package input by the provider of the new service can also be collected, and the package type of the code package and the code package can be uploaded from the development system to the data storage system according to the upload instruction of the provider of the new service; the package type includes the package type of the code package with parameters and / or the package type of the code package without parameters.
[0020] In actual applications, the number of newly added services of the service code may continue to increase. In this case, the number of code packages of the newly added services may also continue to increase. In order to enable timely service access processing when the newly added services are accessed, and to improve the convenience and efficiency of service access processing; in an optional implementation manner provided by this embodiment, in the process of obtaining the code package of the newly added service of the service code, the following operations are performed: The code package of the newly added service is read from the unloaded list of the service code stored in the data storage system through a scheduled reading task.
[0021] The scheduled reading task includes a scheduled task for reading code packages according to a reading cycle; and the unloaded list of service codes refers to a list of code packages of service codes that have not been loaded.
[0022] Step S204: parse the code package to obtain an implementation class, and load the implementation class into the virtual machine through a class loader.
[0023] After obtaining the code package of the newly added service with the service code as mentioned above, in this step, the implementation class is obtained by parsing the code package, and the implementation class is loaded into the virtual machine through the class loader, so as to facilitate the subsequent instantiation of the implementation class, thereby realizing dynamic access to the newly added service.
[0024] The implementation class in this embodiment may be a class in a code package that implements the relevant service functions of the newly added service, that is, a Java class. The class loader refers to a class loader used for class loading, and the class loader may be a custom class loader. The virtual machine may be a Java Virtual Machine.
[0025] During specific implementation, since only the implementation class can be loaded into the virtual machine, it is necessary to identify the implementation class in the code package. In the process of parsing the code package to obtain the implementation class, the code package can be decompressed, and the class identification of the decompression result can be performed to obtain the implementation class; in the process of loading the implementation class into the virtual machine through the class loader, the implementation class can be loaded into the memory of the virtual machine through the custom class loader.
[0026] Step S206: instantiate the implementation class in the virtual machine to obtain an instance of the implementation class.
[0027] In the above, the implementation class is obtained by parsing the code package of the newly added service, and the implementation class is loaded into the virtual machine through the class loader. Specifically, the implementation class can be loaded into the memory of the virtual machine through a custom class loader. In this step, an instance of the implementation class is created in the virtual machine. Specifically, the implementation class can be instantiated in the memory of the virtual machine to obtain an instance of the implementation class; the instance of the implementation class described in this embodiment refers to the instance object of the implementation class.
[0028] During specific implementation, the local cache mechanism may be used to instantiate the implementation class in the virtual machine to obtain an instance of the implementation class, that is, the local cache mechanism may be used to instantiate the implementation class in the memory of the virtual machine to obtain an instance of the implementation class.
[0029] Step S208: registering the instance of the implementation class to the container of the service code, so that when the newly added service is accessed, the instance is called from the container to perform service access processing.
[0030] In the above, the implementation class is instantiated in the virtual machine to obtain an instance of the implementation class. In this step, the instance of the implementation class can be registered with the container of the service code, so that when the new service is accessed, the instance can be called from the container to perform service access processing. After the instance of the implementation class is registered in the container of the service code, the corresponding instance can be called in time to perform service access processing. Specifically, the reflection mechanism can be used to register the instance of the implementation class with the container of the service code, thereby ensuring the dynamic and flexibility of instance registration.
[0031] The container of the service code described in this embodiment can be a singleton container, specifically a Bean singleton container. The Bean singleton container refers to a container in a specific mode of the Spring IoC (Inversion of Control) container. The Bean singleton container ensures that no matter how many requests involve a certain instance, the container will return the same instance.
[0032] It is mentioned above that the service code is configured with multiple services including the newly added service. On this basis, optionally, instances of implementation classes in code packages of other services among the multiple services are also registered in the container; the other services among the multiple services here refer to other services among the multiple services except the newly added service; that is, the service code can provide different services in multiple scenarios.
[0033] In specific implementation, since the code package of the newly added service cannot be loaded directly, and only the implementation class obtained by parsing the code package can be loaded, when the newly added service is accessed, the class name mapped by the code package of the newly added service can be queried based on the class name mapping table, and the corresponding instance can be called from the container based on the class name to perform service access processing, so as to ensure that the instance call can be performed smoothly; in an optional implementation manner provided by this embodiment, in the process of calling the instance from the container to perform service access processing, the following operations are performed: Query the class name of the implementation class of the code package mapping of the newly added service in the class name mapping table; The instance corresponding to the class name is called from within the container to perform the service access process.
[0034] Among them, the class name mapping table refers to a mapping table of the package name of the code package of the service code and the class name of the implementation class, that is, the class name mapping table records the package name of the code package of the service configured by the service code and the class name of the implementation class mapped to the package name; the class name mapping table can be stored in a DB (Database) database.
[0035] On this basis, in an optional implementation manner provided by this embodiment, in the process of calling the instance corresponding to the class name from the container to perform the service access processing, the following operations are performed: Pass the class name into the instance acquisition function; The instance corresponding to the class name is called from the container through the instance acquisition function to perform the service access process.
[0036] The instance acquisition function may be getBean(). The service access processing here may be responding to the service access request of the newly added service.
[0037] As described above, in the process of obtaining the code package of the newly added service of the service code, the code package of the newly added service can be read from the unloaded list of the service code stored in the data storage system through a scheduled reading task. On this basis, in an optional implementation manner provided by this embodiment, after registering the instance of the implementation class to the container of the service code so as to call the instance from the container to perform service access processing when the newly added service is accessed, the following operations are further performed: A loading success instruction of the code package is returned to the data storage system, so that the code package is deleted from the unloaded list based on the loading success instruction, and updated to the loaded list of the service code.
[0038] Among them, the unloaded list refers to a list of code packages of the service code that have not been loaded; the loaded list of the service code refers to a list of code packages of the service code that have been loaded, that is, a list of code packages of the service code that have been successfully loaded. The successfully loaded code package here refers to a code package that is parsed to obtain an implementation class, the implementation class is loaded into a virtual machine, the implementation class is instantiated in the virtual machine to obtain an instance, and the instance is registered to the container of the service code; the loaded list can be stored in a MySQL database.
[0039] In actual applications, the service code or the service provider of the service configured by the service code has a need to delete the code package of the service. For example, the service needs to be offline. In this case, the service code can delete the code package of the service. For example, the code package of the service needs to be updated. In this case, the service provider can delete the code package of the service. In view of this, in order to be able to destroy the corresponding instance in the container in time when the code package is deleted to avoid waste of resources; in an optional implementation mode provided by this embodiment, the following operations are also performed: Obtaining a deletion record of deleting a code package for the service code; According to the package name of the code package in the deletion record, the instance of the implementation class corresponding to the package name is destroyed from the container.
[0040] Among them, the package name of the code package in the deletion record may be generated by the provider of the service code when deleting the code package, or may be generated by the provider of the service configured by the service code corresponding to the code package when deleting the code package; specifically, the package name of the code package in the deletion record may be generated by the provider of the service code when deleting the code package when the service corresponding to the code package is offline, or may be generated by the provider of the service corresponding to the code package when the code package is updated.
[0041] It should be noted that it is also possible to obtain deletion records of code packages deleted for service codes from the data storage system through a scheduled acquisition task, and according to the package name of the code package in the deletion record, destroy the instance of the implementation class corresponding to the package name from the service code container. By promptly destroying the instance corresponding to the deleted code package, the resource space in the service code container is released to improve resource utilization.
[0042] It should be supplemented that each optional implementation method in steps S202 to S208 provided in this embodiment can be executed independently as needed, or can be combined and referenced with each other. At the same time, each specific execution step in each optional implementation method can also be executed independently, and this embodiment does not make specific limitations.
[0043] In summary, one or more code package processing methods provided in this embodiment can be applied to a code package processing component, which can be deployed on a server corresponding to the service code. The server can be one or more, that is, the service code can be deployed in a distributed cluster, and the code package processing component integrated in each server in the distributed cluster can execute the code package processing method provided in this embodiment; Specifically, first, after obtaining the code package of the newly added service of the service code, the code package is obtained after the provider of the newly added service develops and packages the code of the newly added service based on the code development template of the service code, the code package is parsed to obtain the implementation class, and the implementation class is loaded into the virtual machine through the custom class loader. Secondly, the implementation class is instantiated in the virtual machine to obtain an instance of the implementation class, and the instance of the implementation class is registered with the container of the service code, so that when the newly added service is accessed, the class name of the implementation class mapped by the code package of the newly added service is queried in the class name mapping table, and the instance corresponding to the class name is called from the container to perform service access processing. In this way, by loading the implementation class in the code package of the newly added service into the virtual machine, and registering the instance of the implementation class with the container of the service code, the instance can be dynamically called for access processing when the newly added service is accessed, thereby improving the convenience and efficiency of service access processing. At the same time, the convenience of code development for the new service of the service code is improved through the code development template of the service code.
[0044] The following uses the application of a code package processing method provided in this embodiment in a signature verification scenario as an example to further illustrate the code package processing method provided in this embodiment. Figure 3 The code package processing method applied to the signature adding and verification scenario specifically includes the following steps.
[0045] Step S302 : reading the code package of the signature verification service of the service code from the unloaded list of the service code stored in the data storage system through a scheduled reading task.
[0046] Optionally, the code package is obtained after the provider of the signature adding and verification service develops and packages the code for the signature adding and verification service based on the code development template of the service code.
[0047] Step S304, parse the code package to obtain an implementation class, and load the implementation class into the virtual machine through a custom class loader.
[0048] Step S306: instantiate the implementation class in the virtual machine to obtain an instance of the implementation class.
[0049] Step S308: register the instance of the implementation class to the container of the service code, so that when the signature verification service is accessed, the instance is called from the container to perform service access processing.
[0050] Step S310, returning a loading success instruction of the code package to the data storage system, so as to delete the code package from the unloaded list of the service code based on the loading success instruction, and update the code package to the loaded list of the service code.
[0051] Among them, the specific process of calling an instance from a container to perform service access processing when the signing and verification service is accessed may include: the client sends a signing request to the server, and after the server receives the signing request sent by the client, it queries the class name of the implementation class mapped to the code package of the signing service carried in the signing request in the class name mapping table, calls the instance corresponding to the class name in the container of the service code to generate signing parameters, obtains the signing parameters and returns them to the client, the client signs the request information according to the received signing parameters to obtain signing request information, the client sends the signing request information to the server through the gateway, and after the server receives the signing request information, it queries the class name of the implementation class mapped to the code package of the signature verification service in the class name mapping table, calls the instance corresponding to the class name in the container of the service code to generate signing parameters, obtains the signing parameters corresponding to the signing parameters, and the server verifies the signing request information based on the signing parameters, and responds to the request information after the verification is passed.
[0052] It should be noted that any one of steps S302 to S310 or any combination of multiple steps can be replaced by the corresponding technical means provided in the above steps S202 to S208 according to the needs of implementation and deployment, and will not be described one by one here.
[0053] An embodiment of a code packet processing device provided in this specification is as follows: In the above-mentioned embodiment, a code package processing method is provided, and correspondingly, a code package processing device is also provided, which is described below with reference to the accompanying drawings.
[0054] Reference Figure 4 , which shows a schematic diagram of an embodiment of a code packet processing device provided in this embodiment.
[0055] Since the device embodiment corresponds to the method embodiment, the description is relatively simple, and the relevant parts can refer to the corresponding description of the method embodiment provided above. The device embodiment described below is only illustrative.
[0056] This embodiment provides a code packet processing device, including: A code package acquisition module 402 is configured to acquire a code package of a newly added service of a service code; the code package is obtained after the provider of the newly added service develops and packages the code of the newly added service based on a code development template of the service code; An implementation class loading module 404 is configured to parse the code package to obtain an implementation class, and load the implementation class into the virtual machine through a class loader; An instantiation module 406 is configured to instantiate the implementation class in the virtual machine to obtain an instance of the implementation class; The instance registration module 408 is configured to register the instance of the implementation class to the container of the service code, so as to call the instance from the container to perform service access processing when the newly added service is accessed.
[0057] An embodiment of a code packet processing device provided in this specification is as follows: Corresponding to the code package processing method described above, based on the same technical concept, one or more embodiments of this specification further provide a code package processing device, the code package processing device is used to execute the code package processing method provided above, Figure 5 A schematic diagram of the structure of a code packet processing device provided in one or more embodiments of this specification.
[0058] This embodiment provides a code packet processing device, including: like Figure 5 As shown, the code packet processing device may have relatively large differences due to different configurations or performances, and may include one or more processors 501 and memory 502, and the memory 502 may store one or more storage applications or data. Among them, the memory 502 may be a short-term storage or a persistent storage. The application stored in the memory 502 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the code packet processing device. Furthermore, the processor 501 may be configured to communicate with the memory 502, and execute a series of computer executable instructions in the memory 502 on the code packet processing device. The code packet processing device may also include one or more power supplies 503, one or more wired or wireless network interfaces 504, one or more input / output interfaces 505, one or more keyboards 506, etc.
[0059] In a specific embodiment, the code packet processing device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions in the code packet processing device, and the one or more codes configured to be executed by one or more processors include the following computer executable instructions: Obtaining a code package of a newly added service of a service code; the code package is obtained after the provider of the newly added service develops and packages the code of the newly added service based on a code development template of the service code; Parsing the code package to obtain an implementation class, and loading the implementation class into a virtual machine through a class loader; Instantiating the implementation class in the virtual machine to obtain an instance of the implementation class; The instance of the implementation class is registered to the container of the service code, so that when the newly added service is accessed, the instance is called from the container to perform service access processing.
[0060] An embodiment of a computer-readable storage medium provided in this specification is as follows: Corresponding to the code packet processing method described above, based on the same technical concept, one or more embodiments of this specification also provide a computer-readable storage medium.
[0061] The computer-readable storage medium provided in this embodiment is used to store computer-executable instructions, and the computer-executable instructions implement the following steps when executed: Obtaining a code package of a newly added service of a service code; the code package is obtained after the provider of the newly added service develops and packages the code of the newly added service based on a code development template of the service code; Parsing the code package to obtain an implementation class, and loading the implementation class into a virtual machine through a class loader; Instantiating the implementation class in the virtual machine to obtain an instance of the implementation class; The instance of the implementation class is registered to the container of the service code, so that when the newly added service is accessed, the instance is called from the container to perform service access processing.
[0062] It should be noted that the embodiment of a computer-readable storage medium in this specification and the embodiment of a code package processing method in this specification are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the aforementioned corresponding method, and the repeated parts will not be repeated.
[0063] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referenced to each other. Each embodiment focuses on the differences from other embodiments. For example, the device embodiment, equipment embodiment and computer-readable storage medium embodiment are similar to the method embodiment, so the description is relatively simple. To read the relevant contents in the device embodiment, equipment embodiment and computer-readable storage medium embodiment, please refer to the partial description of the method embodiment.
[0064] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0065] In the 1930s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to circuit structures such as diodes, transistors, switches, etc.) or software improvements (improvements to method flows). However, with the development of technology, many of today's method flow improvements can be regarded as direct improvements to hardware circuit structures. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using hardware entity modules. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask chip manufacturers to design and produce dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0066] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.
[0067] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0068] For the convenience of description, the above devices are described in terms of functions and are divided into various units. Of course, when implementing the embodiments of this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0069] It should be understood by those skilled in the art that one or more embodiments of the present specification may be provided as a method, system or computer program product. Therefore, one or more embodiments of the present specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0070] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processing machine, or other programmable code package processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable code package processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0071] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable code packet processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0072] These computer program instructions may also be loaded onto a computer or other programmable code package processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0073] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0074] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0075] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0076] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of features includes not only those features, but also other features not explicitly listed, or also includes features inherent to such process, method, commodity or device. In the absence of further restrictions, features defined by the phrase "including a ..." do not exclude the existence of other identical features in the process, method, commodity or device including the features.
[0077] One or more embodiments of the present specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0078] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0079] The above description is only an embodiment of this document and is not intended to limit this document. For those skilled in the art, this document may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this document should be included in the scope of the claims of this document.
Claims
1. A code package processing method, comprising: Get the code package of the newly added service of the service code; The code package is obtained after the provider of the newly added service develops and packages the code of the newly added service based on the code development template of the service code; Parsing the code package to obtain an implementation class, and loading the implementation class into a virtual machine through a class loader; Instantiating the implementation class in the virtual machine to obtain an instance of the implementation class; The instance of the implementation class is registered to the container of the service code, so that when the newly added service is accessed, the instance is called from the container to perform service access processing.
2. The code package processing method according to claim 1, wherein calling the instance from the container to perform service access processing comprises: Query the class name of the implementation class of the code package mapping of the newly added service in the class name mapping table; The instance corresponding to the class name is called from within the container to perform the service access process.
3. The code package processing method according to claim 2, wherein calling the instance corresponding to the class name from within the container to perform the service access processing comprises: Pass the class name into the instance acquisition function; The instance corresponding to the class name is called from the container through the instance acquisition function to perform the service access process.
4. According to the code package processing method of claim 1, the code packaging is implemented in the following manner: Generate an updated class name for the class name in the service code obtained by the code development through the data generation component integrated in the code development template, and generate a package name for packaging; The class name in the service code is replaced with the update class name to obtain the update service code, and the update service code is packaged according to the package name to obtain the code package.
5. The code package processing method according to claim 4, wherein the updated class name is obtained after the class name is input into a string generation algorithm for string generation; and the package name is generated based on a timestamp of the current time.
6. The code package processing method according to claim 1, wherein the code development template is configured in a development system; The code package is uploaded from the development system to the data storage system according to the upload instruction of the provider; The data storage system performs usability verification on the code package and stores the code package after the verification passes.
7. The code packet processing method according to claim 1, further comprising: Obtaining a deletion record of deleting a code package for the service code; According to the package name of the code package in the deletion record, the instance of the implementation class corresponding to the package name is destroyed from the container.
8. The code package processing method according to claim 1, wherein the code package of the newly added service for obtaining the service code comprises: Reading the code package of the newly added service from the unloaded list of the service code stored in the data storage system through a scheduled reading task; After the step of registering the instance of the implementation class to the container of the service code so as to call the instance from the container to perform service access processing when the newly added service is accessed is executed, the method further includes: A loading success instruction of the code package is returned to the data storage system, so that the code package is deleted from the unloaded list based on the loading success instruction, and updated to the loaded list of the service code.
9. The code package processing method according to claim 1, wherein the service code is configured with a plurality of services including the newly added service; The container also registers instances of implementation classes in code packages of other services among the multiple services.
10. A code packet processing device, comprising: A code package acquisition module, configured to acquire a code package of a newly added service of a service code; The code package is obtained after the provider of the newly added service develops and packages the code of the newly added service based on the code development template of the service code; An implementation class loading module is configured to parse the code package to obtain an implementation class, and load the implementation class into the virtual machine through a class loader; An instantiation module, configured to instantiate the implementation class in the virtual machine to obtain an instance of the implementation class; The instance registration module is configured to register the instance of the implementation class with the container of the service code, so as to call the instance from the container to perform service access processing when the newly added service is accessed.
11. A code packet processing device, comprising: processor; and a memory configured to store computer executable instructions that, when executed, cause the processor to: Obtaining a code package of a newly added service of a service code; the code package is obtained after the provider of the newly added service develops and packages the code of the newly added service based on a code development template of the service code; Parsing the code package to obtain an implementation class, and loading the implementation class into a virtual machine through a class loader; Instantiating the implementation class in the virtual machine to obtain an instance of the implementation class; The instance of the implementation class is registered to the container of the service code, so that when the newly added service is accessed, the instance is called from the container to perform service access processing.
12. A computer-readable storage medium for storing computer-executable instructions, wherein the computer-executable instructions implement the steps of the method of claim 1 when executed.