Processor loading method and apparatus, non-volatile storage medium and computer device

By obtaining a list of processor configuration information and constructing a processor chain using custom class annotations, the problem of high complexity in adjusting the processor chain in existing technologies is solved, achieving flexible configuration and real-time adjustment of processors, and improving the stability and flexibility of the system.

WO2026031409A1PCT designated stage Publication Date: 2026-02-12CHINA TELECOM BESTPAY CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/135585
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-08-05
Filing Date
2024-11-29
Publication Date
2026-02-12

AI Technical Summary

Technical Problem

In existing technologies, the fixed code for building processor chains requires significant code modifications when adding or adjusting processors, which cannot meet the business requirements of dynamic, real-time processor adjustments, violates the open/closed principle, and reduces the stability of production systems.

Method used

By obtaining a list of processor configuration information, using custom class annotations to identify and load processor classes, instantiating processor instances, and building a processor chain based on the processor configuration information, flexible processor configuration can be achieved.

Benefits of technology

It reduces the complexity of adding and adjusting processors, enables dynamic and real-time adjustment of processors to meet business needs, and improves system stability and flexibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024135585_12022026_PF_FP_ABST
    Figure CN2024135585_12022026_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the present application are a processor loading method and apparatus, a non-volatile storage medium and a computer device. The method comprises: acquiring a processor configuration information list, the processor configuration information list comprising processor configuration information; receiving a startup request; in response to the startup request and on the basis of a customized class annotation, identifying and loading a processor class, the customized class annotation being used for identifying a processor class to be loaded; on the basis of the processor configuration information list, instantiating the processor class to obtain processor instances; and on the basis of the processor instances, constructing a processor chain, the processor chain being used for handling a task corresponding to a payment service.
Need to check novelty before this filing date? Find Prior Art

Description

Processor loading method and device, nonvolatile storage medium and computer equipment

[0001] Related applications

[0002] The present application claims priority to the Chinese patent application No. 202411066467.6, filed on August 5, 2024, and entitled "Processor loading method and device, nonvolatile storage medium and computer equipment", the contents of which are hereby incorporated by reference in its entirety. TECHNICAL FIELD

[0003] The present application relates to the technical field of computers, and in particular to a processor loading method and device, a nonvolatile storage medium and a computer equipment. BACKGROUND

[0004] Currently, in some complex business scenarios, a request may need to be processed by multiple layers of different processors to obtain the final result. In particular, in a payment scenario, the optimal recommendation strategy for a payment tool needs to determine the applicable amount, expiration time and various other scenarios of the payment tool. If the traditional fixed code is used to build a responsibility chain, when a processor needs to be added, deleted or modified, the original responsibility chain construction code needs to be changed, or when the order of the processor needs to be adjusted, the code also needs to be adjusted, resulting in a complex modification process, which cannot meet the business needs of dynamically and real-time adjusting the processor. At the same time, frequent code changes will violate the open-closed principle and reduce the stability of the production system. In view of the above problems, there is currently no effective solution. SUMMARY

[0005] The embodiments of the present application provide a processor loading method and device, a nonvolatile storage medium and a computer equipment to at least solve the technical problem in the related art that using fixed code to build a processor chain cannot meet the business needs of real-time adjusting the processor when a processor needs to be added.

[0006] According to an aspect of an embodiment of the present application, a processor loading method is provided, including: obtaining a processor configuration information list, wherein the processor configuration information list includes processor configuration information; receiving a start request; in response to the start request, identifying and loading a processor class according to a custom class annotation, wherein the custom class annotation is used to identify the processor class to be loaded; instantiating the processor class based on the processor configuration information list to obtain a processor instance; and building a processor chain based on the processor instance, wherein the processor chain is used to process a task corresponding to a payment business.

[0007] In some embodiments, obtaining the processor configuration information list includes: obtaining a business requirement of the processor; and configuring the processor configuration information list based on the business requirement.

[0008] In some embodiments, the processor instances are instantiated based on the processor configuration information list, including: obtaining a configuration quantity of the processor instances; and instantiating the processor class based on the configuration quantity according to the processor configuration information list, to obtain the processor instances corresponding to the configuration quantity.

[0009] In some embodiments, the processor chain is constructed based on the processor instances, including: obtaining attribute values corresponding to the processor instances according to the custom attribute annotation; injecting the attribute values into the corresponding processor instances to obtain target processor instances; and constructing the processor chain based on the target processor instances.

[0010] In some embodiments, the processor chain is constructed based on the processor instances, including: obtaining a processor execution order according to the processor configuration information in the processor configuration information list; and sorting the processor instances according to the processor execution order to obtain the processor chain.

[0011] In some embodiments, the processor configuration information includes: a processor name, a processor type, and a processor execution order.

[0012] According to another aspect of the embodiments of the present application, a processor loading apparatus is further provided, including: an obtaining module configured to obtain a processor configuration information list, wherein the processor configuration information list includes processor configuration information; a receiving module configured to receive a start request; a responding module configured to respond to the start request, identify and load a processor class according to a custom class annotation, wherein the custom class annotation is used to identify the processor class to be loaded; an instantiating module configured to instantiate the processor class based on the processor configuration information list to obtain processor instances; and a constructing module configured to construct a processor chain based on the processor instances, wherein the processor chain is used to process tasks corresponding to payment businesses.

[0013] According to still another aspect of the embodiments of the present application, a nonvolatile computer readable storage medium having a computer program stored thereon is further provided, which causes a processor to implement the processor loading method in any of the above embodiments when the computer program is run by the processor.

[0014] According to yet another aspect of the embodiments of the present application, a computer device is further provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to implement the processor loading method in any of the above embodiments when the computer program is run.

[0015] According to still another aspect of the embodiments of the present application, a computer program product is further provided, including a computer program, which causes a processor to implement the processor loading method in any of the above embodiments when the computer program is executed by the processor.

[0016] In the embodiment of the present application, the processor loading method is adopted, the processor configuration information list is obtained, the processor configuration information list includes processor configuration information, the starting request is received, the processor class is identified and loaded according to the custom class annotation, the custom class annotation is used to identify the processor class to be loaded, the processor class is instantiated based on the processor configuration information list, the processor instance is obtained, and the processor chain is constructed based on the processor instance, wherein the processor chain is used to process the task corresponding to the payment business, so as to achieve the purpose of flexibly configuring the processor, thereby realizing the technical effect of reducing the complexity of adding the processor, and further solving the technical problem that in the related art, the processor chain is constructed by using the fixed code, the code needs to be greatly changed when the processor is added, and the business demand of real-time adjustment of the processor cannot be met. BRIEF DESCRIPTION OF DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the drawings needed to be used in the embodiments or the related art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained without creative labor on the basis of these drawings.

[0018] FIG. 1 shows a hardware structure block diagram of a computer terminal for implementing a processor loading method.

[0019] FIG. 2 is a flow diagram of a processor loading method according to an embodiment of the present application.

[0020] FIG. 3 is a processing flow diagram of a processor loading method according to an embodiment of the present application.

[0021] FIG. 4 is a structure block diagram of a processor loading device according to an embodiment of the present application. DETAILED DESCRIPTION

[0022] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the present application.

[0023] It should be noted that the terms "first", "second", and the like in the description and in the claims of the present application and the above-described accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular sequential or chronological order. It should be understood that the data thus used can be interchanged under appropriate circumstances so that the embodiments of the present application described herein can be implemented in other sequences than those illustrated or described herein. In addition, the terms "comprise" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or device that includes a list of steps or units is not necessarily limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to such processes, methods, products, or devices.

[0024] According to the embodiments of the present application, a method embodiment of a processor loading method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown herein.

[0025] The method embodiment provided by the embodiment of the present application can be executed in a mobile terminal, a computer terminal, or a similar computing device. FIG. 1 shows a hardware structure block diagram of a computer terminal for implementing a processor loading method. As shown in FIG. 1, the computer terminal 10 can include one or more (shown as 102a, 102b,..., 102n in the figure) processors (the processor can include but not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data. In addition, it can also include a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which can be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. Those skilled in the art can understand that the structure shown in FIG. 1 is only schematic, and does not limit the structure of the above-mentioned electronic device. For example, the computer terminal 10 can include more or fewer components than those shown in FIG. 1, or have a different configuration from that shown in FIG. 1.

[0026] It should be noted that the one or more processors and / or other data processing circuits described above can be referred to as "data processing circuits" herein. The data processing circuit can be embodied in whole or in part as software, hardware, firmware or any other combination. In addition, the data processing circuit can be a single independent processing module, or all or part of any of the other elements combined into the computer terminal 10. As referred to in the embodiments of the present application, the data processing circuit serves as a processor control (for example, selection of a variable resistance terminal path connected to an interface).

[0027] The memory 104 can be used to store software programs of application software and modules, such as program instructions / data storage devices corresponding to the processor loading method in the embodiments of the present application. The processor performs various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implements the processor loading method of the application program described above. The memory 104 can include a high-speed random access memory, and can also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 can further include a memory remotely arranged with respect to the processor, which can be connected to the computer terminal 10 through a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0028] The display can be, for example, a touch screen type liquid crystal display (LCD) that can enable a user to interact with the user interface of the computer terminal 10.

[0029] At present, in some complex business scenarios, for a request, it may need to pass through different processors of multiple layers for processing to obtain the final result. In particular, in the payment scenario, the optimal recommendation strategy for the payment tool needs to judge the applicable amount, expiration time and various corresponding processors of the payment tool. If the traditional method of using fixed code to build a processor responsibility chain is used, when a new processor needs to be added, the original processor chain construction code needs to be changed, or when the order of the processor needs to be adjusted, the code also needs to be adjusted, resulting in a long adjustment time and low efficiency, and such a method cannot meet the business needs of dynamically and real-time adjusting the processor. At the same time, frequently changing the code will violate the open-closed principle and reduce the stability of the production system. Based on the above technical problems, the present application provides an embodiment of a processor loading method, and FIG. 2 is a flowchart of the processor loading method according to the embodiment of the present application. As shown in FIG. 2, the method includes the following steps S202 to S210.

[0030] Step S202: Obtain a processor configuration information list, wherein the processor configuration information list includes processor configuration information.

[0031] In this step, the processor configuration information list is acquired, wherein the processor configuration information can exist in the configuration center in advance. The processor configuration information list can be pre-configured at the configuration center according to business requirements. The processor configuration list can be used for subsequent loading of the processor. The processor configuration information can include the type of the processor, the processor name, the processor execution sequence, and the like. Different processors can be suitable for different scenarios, for example, in a payment scenario, a processor for judging the applicable amount of a payment tool, a processor for setting the number of available payment tools, and the like. The corresponding processor is different in different scenarios, and therefore, based on business requirements, the processor to be loaded can be selected in advance, and the corresponding configuration information is written into the processor configuration information list for subsequent loading of the processor class.

[0032] Step S204: receiving a start request.

[0033] In this step, when the application starts, the processor needs to be loaded. Therefore, when the start request for the program is received, it is equivalent to receiving a request to start loading the processor. Therefore, based on the start request, the processor loading based on the processor configuration information can be started.

[0034] Step S206: in response to the start request, identifying and loading the processor class according to the custom class annotation, wherein the custom class annotation is used to identify the processor class to be loaded.

[0035] In this step, in response to the start request, the processor can be loaded. The processor class to be loaded can be identified according to the custom class annotation, and the corresponding loading can be performed. The custom class annotation can be written with the processor name corresponding to the processor class to be loaded. The annotation is a kind of metadata applied to elements such as classes, methods, variables, parameters and packages. They can provide additional information about the code, such as compiler hints, configuration information, code generation, etc. The custom class annotation is a programming technique commonly used in object-oriented programming languages such as Java or.NET, which allows developers to define annotations to provide additional metadata information, which can be used for code analysis, compile-time checking, runtime processing and other purposes. Here, the custom class annotation can be used to identify the processor class to be loaded, and the bytecode information corresponding to the processor class can be loaded after identification. The processor class is a concept in object-oriented programming, which usually refers to a class that implements a specific interface or inherits from a specific abstract class. The object of this class is responsible for performing specific processing tasks or operations. Different processor classes have different functions. The bytecode information of the processor class is the content of the.class file generated after the processor class is compiled, which contains the metadata, fields, methods, attributes, etc. of the class. These information is interpreted and executed by the Java virtual machine (JVM) at runtime. For example, the custom class annotation can be @Rule, and the content after the annotation can be used to obtain the bytecode information corresponding to the processor class to be loaded.

[0036] Step S208: based on the processor configuration information list, the processor class is instantiated to obtain the processor instance.

[0037] In this step, the processor class can be instantiated according to the processor configuration information list. The instantiation of the processor class refers to the process of creating an object using the processor class. Instantiation is a basic concept in object-oriented programming, which involves the process of creating an instance from a class. When a processor class is instantiated, it usually means that it can start processing a specific task or executing specific logic. For example, in the annotation processing framework of Java, the instantiation of the processor class and the application process are usually as follows: the class file of the annotation processor is recognized by the compiler. The compiler creates an instance for each processor class. Instantiation is a basic operation in object-oriented programming, which allows objects in code to have independent states and behaviors. Through instantiation, developers can use the definition of a class to create objects with specific properties and methods. Moreover, a processor class can be instantiated multiple times, and the specific number of instantiations can be determined according to actual conditions. Each instantiation creates a new object. Each object is an independent instance of a class, with its own state and behavior, but shares the same method and property definitions.

[0038] Step S210: Based on the processor instance, a processor chain is constructed, wherein the processor chain is used to process tasks corresponding to the payment business.

[0039] In this step, the processor chain can be obtained by sorting the processor instances according to the configuration order, wherein the processor chain is a chain of responsibility pattern, which is a software design pattern. In the chain of responsibility pattern, each processor holds a reference to the next processor to form a chain. Multiple processors process the same request in turn, and each processor on the chain assumes its own processing responsibilities. Therefore, the processor chain obtained by construction can return the head processor node, which is used to process tasks corresponding to the payment business. By loading the processor class based on the custom class annotation and then instantiating the processor class, the processor chain is constructed, which achieves the technical effect of reducing the complexity of processor modification. Only the processor modification at the custom class annotation, such as adding a processor, can add a new processor class through the custom class annotation, delete a processor by deleting the content after the custom class annotation, and modify a processor by modifying the content after the custom class annotation, without the need for large-scale code changes. This can shorten the time and complexity of adjusting the processor chain, thereby achieving dynamic adjustment of the processor and meeting the demand for real-time adjustment of the processor.

[0040] Through the above steps, the purpose of flexible configuration of the processor is achieved, thereby realizing the technical effect of reducing the complexity of adding the processor, and further solving the technical problem of [key word].

[0041] As an optional embodiment, the obtaining the processor configuration information list comprises: obtaining a service requirement of the processor; and configuring the processor configuration information list based on the service requirement.

[0042] In some embodiments, the obtaining the processor configuration information list can comprise: determining a processor to be used according to the service requirement, and configuring the processor configuration information list based on the processor to be used. The configuration of the processor configuration information list can be performed in the configuration center. For example, the service requirement is to limit the payment tools of the user in the payment scenario, and the related processors can be configured, such as a processor for processing the available number of payment tools, a processor for processing the expiration time of the payment tools, and the like. In the same scenario, a plurality of processors are usually used in combination, and the plurality of processors process the same request in sequence. Therefore, the processor configuration information list can include configuration information corresponding to a plurality of processors, and the configuration information of the processor can include an execution order, i.e., a position of the processor in the processing chain, because the execution order can affect the result of the final task processing.

[0043] As an optional embodiment, the processor class is instantiated based on the processor configuration information list to obtain a processor instance, comprising: obtaining a configuration quantity of the processor instance; and instantiating the processor class based on the configuration quantity and the processor configuration information list to obtain a processor instance corresponding to the configuration quantity.

[0044] In some embodiments, the obtaining the processor configuration information list and instantiating the processor class can comprise: obtaining a configuration quantity of the processor instance. There can be a plurality of processor classes to be instantiated. The configuration quantity corresponding to each processor can be obtained, which can be one or more. Then, the processor class is instantiated in a single instance or a multiple instance mode based on the configuration quantity and the processor configuration information list. The multiple instance mode allows a class to have multiple instances. Each instance can exist independently of other instances and have its own unique state. It is usually used in the case of creating objects multiple times according to different parameters or configurations. For example, the same processor class can obtain a plurality of processor instances after multiple instance instantiation, which can be obtained by instantiating the same processor class and injecting different parameters. The plurality of processor instances can be used to process tasks in different situations. Multiple instance instantiation of the processor class can create customized processor instances for different use cases or requests, and each instance can have different configurations or behaviors. Moreover, multiple instance instantiation can easily expand the system according to the requirements, for example, more processor instances can be created when processing a large number of concurrent requests, which can also help to achieve better concurrent processing because an independent processor instance can be created for each task in a multi-threaded environment.

[0045] As an optional embodiment, based on the processor instance, the processor chain is constructed, including: obtaining the attribute value corresponding to the processor instance according to the custom attribute annotation; injecting the attribute value into the corresponding processor instance to obtain a target processor instance; and constructing the processor chain based on the target processor instance.

[0046] In some embodiments, the processor class is instantiated, and the attribute value corresponding to the processor instance can also be obtained according to the custom attribute annotation. For example, the custom attribute annotation can be @RuleAttr, and the attribute value to be injected can be in the annotation axis. Then the attribute value is injected into the corresponding processor instance to obtain a target processor instance. The custom attribute annotation is used to annotate the attribute value to be injected, and the attribute value can be obtained based on the custom attribute annotation. Injecting the attribute value into the corresponding processor instance is equivalent to configuring the processor instance differently, which can reduce the direct dependency relationship between classes and make each component more independent. Different attribute values can be injected to adapt the processor instance to different use scenarios. For example, for a payment processor, the payment gateway configuration can be injected to make the processor process requests initiated by the corresponding payment software; for a currency conversion processor, the exchange rate of different currencies can be injected. Through the attribute value injection, the behavior of the processor can be more flexible and easier to adapt to different business requirements and environmental changes. At the same time, this also helps to improve the testability and maintainability of the code.

[0047] As an optional embodiment, based on the processor instance, the processor chain is constructed, including: obtaining the attribute value corresponding to the processor instance according to the custom attribute annotation; injecting the attribute value into the corresponding processor instance to obtain a target processor instance; and constructing the processor chain based on the target processor instance.

[0048] In some embodiments, the processor chain is constructed based on the execution order of the processors. The processor chain is a type of chain-of-responsibility pattern, which is a software design pattern in which each processor holds a reference to the next processor to form a chain, and multiple processors process the same request in sequence, with each processor in the chain taking on its own processing responsibilities. The order in the processor chain determines the path of the request through the chain. The task request is first sent to the first processor in the chain, and then passed to the next processor in the chain according to the decision of each processor, so the order in the chain is usually based on the priority or processing capacity of the processors. For example, in a GUI (Graphical User Interface), the order of event handlers may be based on the hierarchy of controls. In some cases, the order of the chain of responsibility can be pre-set through a configuration file, a database, or programming. For example, when obtaining processor configuration information, the processor execution order can be written in the configuration information. The processor execution order can be obtained based on the processor configuration information in the processor configuration information list, and the processor instances can be sorted according to the processor execution order to obtain the processor chain. Moreover, the order of the processor chain can be dynamically adjusted at runtime to adapt to different business requirements or changes in conditions. Therefore, the processor classes that need to be instantiated can be modified by modifying the custom class annotations, and the processor instances in the processor chain can be modified.

[0049] As an optional embodiment, the processor configuration information includes: processor name, processor type, processor execution order.

[0050] In some embodiments, the processor configuration information can include the name of the processor, the type of the processor, the execution order of the processor, and the parameters that need to be injected when instantiated. In different scenarios, depending on the business requirements and processing logic, there may be multiple types of processors. For example, in a payment scenario, the processors can include multiple types, such as a payment gateway processor, which can be responsible for communicating with external payment gateways and processing payment requests and responses. A bank processor can be used to handle bank-related payment operations such as money transfer, credit card payment, etc. An electronic wallet processor can be used to process payment requests from an electronic wallet, etc. The processor configuration information records the name of the processor, and when loading the processor class, the processor name after the custom class annotation can be used to find the corresponding processor configuration information for loading to obtain the processor class. The target processor instance can also be obtained by attribute value injection of the processor instance according to the corresponding parameter values (attribute values) in the processor configuration information.

[0051] It should be noted that, for the foregoing method embodiments, in order to simply describe, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the action sequence described, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily necessary for the present application.

[0052] Through the description of the above embodiments, those skilled in the art can clearly understand that the processor loading method according to the above embodiments can be realized by means of software and the necessary general hardware platform, of course, it can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product in essence or the part that contributes to the prior art, and the computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including a plurality of instructions to make a terminal device (which can be a mobile phone, computer, server, or network device, etc.) execute the method described in each embodiment of the present application.

[0053] Next, a specific embodiment is taken, and Fig. 3 is a processing flowchart of a processor loading method according to an optional embodiment of the present application, as shown in Fig. 3:

[0054] S301: The configuration center preconfigures a processor list according to business requirements, and each processor configuration information contains type, name, execution order, parameter injection, etc.

[0055] S302: When the application starts, the processor class that needs to be loaded is identified through a custom class annotation "@Rule", and the bytecode information of the class is loaded.

[0056] S303: After the class information scanning is completed, the processor class is instantiated as a singleton or multiple instances according to the configuration quantity.

[0057] S304: After the class instantiation is completed, the attribute object that needs to be injected is identified through a custom attribute annotation "@RuleAttr", and the attribute value injection is completed.

[0058] S305: Finally, the processor class is sorted according to the configuration order, the processor chain is constructed, and the head processor node is returned.

[0059] The processor loading method comprises the following steps: obtaining a processor configuration information list, wherein the processor configuration information list comprises processor configuration information; receiving a starting request; in response to the starting request, identifying and loading a processor class according to a custom class annotation, wherein the custom class annotation is used to identify the processor class to be loaded; instantiating the processor class based on the processor configuration information list to obtain a processor instance; and constructing a processor chain based on the processor instance, wherein the processor chain is used to process a task corresponding to a payment service, so that the processor is flexibly configured, the complexity of adding the processor is reduced, and the technical problem of the keyword is solved.

[0060] According to the embodiment of the application, a processor loading device for implementing the processor loading method is also provided. As shown in FIG. 4, the processor loading device comprises an obtaining module 402, a receiving module 404, a responding module 406, an instantiating module 408 and a constructing module 410. The processor loading device is described as follows.

[0061] The obtaining module 402 is configured to obtain a processor configuration information list, wherein the processor configuration information list comprises processor configuration information.

[0062] The receiving module 404 is connected with the obtaining module 402 and is configured to receive a starting request.

[0063] The responding module 406 is connected with the receiving module 404 and is configured to, in response to the starting request, identify and load a processor class according to a custom class annotation, wherein the custom class annotation is used to identify the processor class to be loaded.

[0064] The instantiating module 408 is connected with the responding module 406 and is configured to instantiate the processor class based on the processor configuration information list to obtain a processor instance.

[0065] The constructing module 410 is connected with the instantiating module 408 and is configured to construct a processor chain based on the processor instance, wherein the processor chain is used to process a task corresponding to a payment service.

[0066] In some embodiments, the obtaining module is configured to obtain the processor configuration information list by performing the following steps: obtaining a business requirement of the processor; and configuring the processor configuration information list based on the business requirement.

[0067] In some embodiments, the instantiating module is configured to instantiate the processor class based on the processor configuration information list to obtain the processor instance by performing the following steps: obtaining a configuration quantity of the processor instance; and instantiating the processor class based on the configuration quantity according to the processor configuration information list to obtain the processor instance corresponding to the configuration quantity.

[0068] In some embodiments, the constructing module is configured to construct the processor chain based on the processor instance, including: obtaining attribute values corresponding to the processor instance according to the self-defined attribute annotation; injecting the attribute values into the corresponding processor instance to obtain a target processor instance; and constructing the processor chain based on the target processor instance.

[0069] In some embodiments, the constructing module is configured to construct the processor chain based on the processor instance, including: obtaining a processor execution order according to the processor configuration information in the processor configuration information list; and sorting the processor instances according to the processor execution order to obtain the processor chain.

[0070] In some embodiments, the processor configuration information in the obtaining module includes: a processor name, a processor type, and a processor execution order.

[0071] It should be noted that the obtaining module 402, the receiving module 404, the responding module 406, the instantiating module 408, and the constructing module 410 correspond to steps S202 to S210 in the embodiments, and the multiple modules have the same instances and application scenarios as the corresponding steps, but are not limited to the above disclosed embodiments. It should be noted that the above modules as part of the apparatus can run in the computer terminal 10 provided in the embodiments.

[0072] Embodiments of the present application can provide a computer device, in the present embodiment, the computer device can be located in at least one of the multiple network devices in the computer network. The computer device includes a memory and a processor.

[0073] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the processor loading method and apparatus in the embodiments of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, implements the processor loading method described above. The memory can include a high-speed random access memory, and can also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory can further include a memory remotely arranged with respect to the processor, and the remote memory can be connected to the computer terminal through a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0074] The processor can call information and application programs stored in the memory through the transmission device to execute the following steps: obtaining a processor configuration information list, wherein the processor configuration information list includes processor configuration information; receiving a start request; in response to the start request, identifying and loading a processor class according to a custom class annotation, wherein the custom class annotation is used to identify the processor class to be loaded; instantiating the processor class based on the processor configuration information list to obtain a processor instance; and constructing a processor chain based on the processor instance, wherein the processor chain is used to process a task corresponding to a payment business.

[0075] In some embodiments, the processor can further execute program codes of the following steps: obtaining a processor configuration information list, including: obtaining a business requirement of the processor; and configuring the processor configuration information list based on the business requirement.

[0076] In some embodiments, the processor can further execute program codes of the following steps: instantiating the processor class based on the processor configuration information list to obtain a processor instance, including: obtaining a configuration quantity of the processor instance; and instantiating the processor class based on the configuration quantity according to the processor configuration information list to obtain a processor instance corresponding to the configuration quantity.

[0077] In some embodiments, the processor can further execute program codes of the following steps: constructing a processor chain based on the processor instance, including: obtaining an attribute value corresponding to the processor instance according to a custom attribute annotation; injecting the attribute value into the corresponding processor instance to obtain a target processor instance; and constructing the processor chain based on the target processor instance.

[0078] In some embodiments, the processor can further execute program codes of the following steps: constructing a processor chain based on the processor instance, including: obtaining a processor execution order according to the processor configuration information in the processor configuration information list; and sorting the processor instances according to the processor execution order to obtain the processor chain.

[0079] In some embodiments, the processor configuration information includes: a processor name, a processor type, and a processor execution order.

[0080] The embodiment of the application provides a processor loading method, which comprises the following steps: obtaining a processor configuration information list, wherein the processor configuration information list comprises processor configuration information; receiving a starting request; identifying and loading a processor class according to a self-defined class annotation in response to the starting request, wherein the self-defined class annotation is used for identifying the processor class to be loaded; instantiating the processor class based on the processor configuration information list to obtain a processor instance; and constructing a processor chain based on the processor instance, wherein the processor chain is used for processing a task corresponding to a payment service, so that the processor is flexibly configured, the technical effect of reducing the complexity of adding the processor is achieved, and the technical problem of the keyword is solved.

[0081] Those skilled in the art can understand that all or part of the steps in the above-mentioned various methods of the embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a non-volatile storage medium, and the storage medium can include a flash disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0082] The embodiment of the application further provides a non-volatile computer readable storage medium. In the embodiment, the non-volatile computer readable storage medium can be used to save the program code executed by the processor loading method provided by the above-mentioned embodiment.

[0083] In the embodiment, the non-volatile computer readable storage medium can be located in any one of the computer terminals in the computer terminal group in the computer network or any one of the mobile terminals in the mobile terminal group.

[0084] In the embodiment, the non-volatile computer readable storage medium is configured to store program code for performing the following steps: obtaining a processor configuration information list, wherein the processor configuration information list comprises processor configuration information; receiving a starting request; identifying and loading a processor class according to a self-defined class annotation in response to the starting request, wherein the self-defined class annotation is used for identifying the processor class to be loaded; instantiating the processor class based on the processor configuration information list to obtain a processor instance; and constructing a processor chain based on the processor instance, wherein the processor chain is used for processing a task corresponding to a payment service.

[0085] In the embodiment, the non-volatile computer readable storage medium is configured to store program code for performing the following steps: obtaining a processor configuration information list, comprising: obtaining a business requirement of the processor; and configuring the processor configuration information list based on the business requirement.

[0086] In the embodiment, the nonvolatile computer readable storage medium is configured to store program code for performing the following steps: instantiating a processor class based on a processor configuration information list to obtain a processor instance, including: obtaining a configuration quantity of the processor instance; instantiating the processor class based on the processor configuration information list and the configuration quantity to obtain a processor instance corresponding to the configuration quantity.

[0087] In the embodiment, the nonvolatile computer readable storage medium is configured to store program code for performing the following steps: constructing a processor chain based on the processor instance, including: obtaining an attribute value corresponding to the processor instance according to a custom attribute annotation; injecting the attribute value into the corresponding processor instance to obtain a target processor instance; and constructing the processor chain based on the target processor instance.

[0088] In the embodiment, the nonvolatile computer readable storage medium is configured to store program code for performing the following steps: constructing a processor chain based on the processor instance, including: obtaining a processor execution order according to processor configuration information in the processor configuration information list; and sorting the processor instances according to the processor execution order to obtain the processor chain.

[0089] In the embodiment, the nonvolatile computer readable storage medium is configured to store program code for performing the following steps: the processor configuration information includes: a processor name, a processor type, and a processor execution order.

[0090] The embodiment of the application further provides a computer program product, including a computer program. In the embodiment, the computer program can be executed by a processor to achieve the following: obtaining a processor configuration information list, wherein the processor configuration information list includes processor configuration information; receiving a start request; in response to the start request, identifying and loading a processor class according to a custom class annotation, wherein the custom class annotation is used to identify a processor class to be loaded; instantiating the processor class based on the processor configuration information list to obtain a processor instance; and constructing a processor chain based on the processor instance, wherein the processor chain is used to process a task corresponding to a payment business.

[0091] The above sequence numbers of the embodiments of the application are only for description, and do not represent the advantages and disadvantages of the embodiments.

[0092] In the above embodiments of the application, the description of each embodiment has its own emphasis, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.

[0093] In several embodiments provided in the present application, it should be understood that the disclosed technical contents can be implemented by other manners. Among them, the above-described device embodiments are only illustrative, for example, the division of the units can be a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units or modules shown or discussed can be indirect coupling or communication connection between the units or modules through some interfaces, and can be electrical or other forms.

[0094] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed to multiple units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0095] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present alone, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0096] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a non-volatile storage medium. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various program code storage media.

[0097] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when executed, can include the processes of the above-mentioned embodiment methods. Any reference to memory, storage, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0098] Any combination of the technical features of the above embodiments can be made. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, but as long as the combination of the technical features does not exist, it should be considered as the scope of the present application.

[0099] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent. It should be pointed out that for those skilled in the art, without departing from the concept of the present application, some modifications and improvements can be made, which are all within the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.

Claims

1. A processor loading method, comprising: obtaining a processor configuration information list, wherein the processor configuration information list comprises processor configuration information; receiving a start request; in response to the start request, identifying and loading a processor class according to a custom class annotation, wherein the custom class annotation is used to identify a processor class to be loaded; instantiating the processor class based on the processor configuration information list to obtain a processor instance; constructing a processor chain based on the processor instance, wherein the processor chain is used to process a task corresponding to a payment service.

2. The method of claim 1, wherein the obtaining a processor configuration information list comprises: obtaining a service requirement of a processor; configuring the processor configuration information list based on the service requirement.

3. The method of claim 1, wherein the instantiating the processor class based on the processor configuration information list to obtain a processor instance comprises: obtaining a configuration quantity of a processor instance; instantiating the processor class based on the configuration quantity according to the processor configuration information list to obtain a processor instance corresponding to the configuration quantity.

4. The method of claim 1, wherein the constructing a processor chain based on the processor instance comprises: obtaining an attribute value corresponding to the processor instance according to a custom attribute annotation; injecting the attribute value into a corresponding processor instance to obtain a target processor instance; constructing the processor chain based on the target processor instance.

5. The method of claim 1, wherein the constructing a processor chain based on the processor instance comprises: obtaining a processor execution order according to processor configuration information in the processor configuration information list; sorting the processor instances according to the processor execution order to obtain the processor chain.

6. The method of any of claims 1 to 5, wherein the processor configuration information comprises: processor name, processor type, processor execution order.

7. A processor loading apparatus, comprising: an obtaining module configured to obtain a processor configuration information list, wherein the processor configuration information list comprises processor configuration information; a receiving module configured to receive a start request; a responding module configured to, in response to the start request, identify and load a processor class according to a custom class annotation, wherein the custom class annotation is used to identify a processor class to be loaded; an instantiation module configured to instantiate the processor class based on the processor configuration information list to obtain a processor instance; a construction module configured to construct a processor chain based on the processor instance, wherein the processor chain is used to process a task corresponding to a payment service.

8. A non-volatile computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, causes the processor to implement the processor loading method of any one of claims 1 to 6.

9. A computer device comprising: a memory and a processor, the memory stores a computer program; the processor is configured to implement the processor loading method of any one of claims 1 to 6 when the computer program stored in the memory is executed.

10. A computer program product comprising a computer program, wherein the computer program, when implemented by a processor, implements the processor load method of any one of claims 1 to 6.

Citation Information

Patent Citations

  • Business processing component system based on chain-of-responsibility design mode

    CN114567667A

  • Business flow implementation method and device based on annotation, storage medium and electronic equipment

    CN114647416A

  • Business execution method, system and device based on chain of responsibility and storage medium

    CN114995797A

  • Multi-scene order placing and ordering method and device and readable storage medium

    CN117788120A

  • Processor loading method and device, nonvolatile storage medium and computer equipment

    CN119003030A