Service processing method and device

By splitting the task into subtasks and leveraging the combination of executors and execution units, the problem of asynchronous execution of thread pools is solved, and the flexibility and efficiency of business processing are achieved.

CN120371472APending Publication Date: 2025-07-25CHINABANK PAYMENT (BEIJING) TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510450956.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-10
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

Existing thread pools are inefficient when executing tasks asynchronously and cannot flexibly process task logic.

Method used

Split the task into subtasks, and asynchronous execution is achieved through a combination of executors and execution units, determining the execution order to improve efficiency.

Benefits of technology

Through task splitting and execution unit combination, business execution logic is simplified, processing efficiency and code utilization are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371472A_ABST
    Figure CN120371472A_ABST
Patent Text Reader

Abstract

The invention discloses a business processing method and device, and relates to the technical field of computers. A specific embodiment of the method comprises the steps of splitting a to-be-processed service into at least one subtask, obtaining a corresponding executor according to execution logic of the subtask, determining a first execution sequence of the executor according to a first logic relationship among the subtasks, and further determining a second execution sequence of execution units included in the executor, and finally, determining a final execution sequence of each execution unit so as to carry out business processing. According to the implementation mode, asynchronous execution of the sub-tasks is achieved by splitting the task processing process, the task processing efficiency is improved, meanwhile, multiplexing of service processing logic is achieved through the executor, and the utilization rate of the service processing logic is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular, to a service processing method and apparatus. Background Art

[0002] In a computer network, the service execution logic of a system generally depends on a thread pool. Among them, the core idea of the thread pool is to pre-create a certain number of threads and save them in the thread pool. When a task needs to be executed, the thread pool will take out an idle thread from the thread pool to execute the task. After the task is executed, the thread is not destroyed, but returned to the thread pool, and can be used immediately or later to execute other tasks again. This mechanism can avoid the performance overhead caused by frequent creation and destruction of threads, and at the same time can control the number of threads running simultaneously, thereby improving the performance and resource utilization rate of the system. The main components of the thread pool include working threads, task queues, thread managers, etc. The design of the thread pool helps to optimize the performance and resource utilization of multi-threaded programs, and at the same time simplifies the complexity of thread management and reuse.

[0003] However, currently, when the threads in the thread pool execute asynchronously, they asynchronously execute the complete execution logic corresponding to the task, that is, each task is executed by one thread, and the efficiency is low. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide a service processing method and apparatus, which can flexibly split tasks, and then call an executor to perform service processing on the split subtasks, improving the processing efficiency and flexibility.

[0005] To achieve the above object, according to one aspect of the embodiments of the present invention, a service processing method is provided, including:

[0006] Splitting a to-be-processed task into at least one subtask according to service processing logic, and generating a first logical relationship between the subtasks;

[0007] Obtaining an executor corresponding to each subtask according to the execution logic of each subtask, where the executor includes at least one execution unit, and there is a second logical relationship between the execution units;

[0008] Determining a first execution order of each executor according to the first logical relationship between the subtasks, and determining a second execution order of each execution unit according to the second logical relationship between the execution units included in each executor;

[0009] Based on the first execution order of each executor and the second execution order of each execution unit included in each executor, determining a final execution order of each execution unit included in the to-be-processed task;

[0010] Execute each execution unit included in the to-be-processed task based on the final execution order for business processing.

[0011] Optionally, before obtaining the executor corresponding to each subtask according to the execution logic of each subtask, the method further includes: abstracting the execution logic of a preset task to obtain at least one execution function, and generating a corresponding execution unit according to each execution function; according to the unit combination rule, combining the execution units to generate at least one executor.

[0012] Optionally, the execution functions include: business execution logic function, thread submission logic function, result acquisition logic function, and result processing logic function; the execution units include: business execution logic unit, thread submission logic unit, result acquisition logic unit, and result processing logic unit; the executors include: business execution logic executor, thread submission logic executor, result acquisition logic executor, result processing logic executor, business execution and thread submission logic executor, result acquisition and result processing logic executor, business execution and thread submission and result acquisition logic executor, business execution and thread submission and result acquisition and result processing logic executor.

[0013] Optionally, the method further includes: in response to failing to obtain the executor corresponding to the subtask according to the execution logic of the subtask, modifying the configuration parameters corresponding to the existing execution units according to the execution logic of the subtask to generate an execution unit that conforms to the execution logic of the subtask; and generating the executor corresponding to the subtask according to the generated execution unit.

[0014] Optionally, the first logical relationship and the second logical relationship include parallel execution, serial execution, and series-parallel execution.

[0015] According to another aspect of the embodiments of the present invention, a business processing device is provided, including:

[0016] A splitting module, configured to split a to-be-processed task into at least one subtask according to business processing logic and generate a first logical relationship between the subtasks;

[0017] An obtaining module, configured to obtain the executor corresponding to each subtask according to the execution logic of each subtask, where the executor includes at least one execution unit, and there is a second logical relationship between the execution units;

[0018] A first determination module, configured to determine a first execution order of each executor according to the first logical relationship between the subtasks, and determine a second execution order of each execution unit according to the second logical relationship between the execution units included in each executor;

[0019] A second determination module, configured to determine a final execution order of each execution unit included in the to-be-processed task based on the first execution order of each actuator and the second execution order of each execution unit included in each actuator;

[0020] An execution module, configured to execute each execution unit included in the to-be-processed task based on the final execution order to perform service processing.

[0021] Optionally, the device further includes a modification module, configured to: in response to failing to obtain an actuator corresponding to the subtask according to the execution logic of the subtask, modify configuration parameters corresponding to an existing execution unit according to the execution logic of the subtask to generate an execution unit that conforms to the execution logic of the subtask; and generate an actuator corresponding to the subtask according to the generated execution unit.

[0022] According to another aspect of an embodiment of the present invention, there is provided an electronic device, including: one or more processors; a storage device, configured to store one or more programs, and when the one or more programs are executed by the one or more processors, enable the one or more processors to implement the service processing method provided by the embodiment of the present invention.

[0023] According to another aspect of an embodiment of the present invention, there is provided a computer-readable medium, on which a computer program is stored, and when the program is executed by a processor, the service processing method provided by the embodiment of the present invention is implemented.

[0024] According to still another aspect of an embodiment of the present invention, there is provided a computer program product, including a computer program, and when the computer program is executed by a processor, the service processing method provided by the embodiment of the present invention is implemented.

[0025] One embodiment of the above invention has the following advantages or beneficial effects: After a task can be split into subtasks with a first logical relationship, an actuator including an execution unit can be obtained according to the subtask, and the logical relationship between the execution units can be determined, and then the execution order of the execution units can be determined. Combining the execution order of the actuators determined according to the first logical relationship to determine the final execution order of each execution unit of the final to-be-processed task to complete the service processing operation. The decomposition of the service logic is realized through the execution unit, and flexible combination and matching can be performed based on each decomposed execution unit to realize the corresponding service function, simplify the logic of service execution, and improve the service processing efficiency.

[0026] The further effects of the above non-conventional optional manner will be described in combination with specific embodiments below. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The drawings are used to better understand the present invention and do not constitute an improper limitation to the present invention. Among them:

[0028] Figure 1 is the business process flow chart provided by the embodiments of the present invention;

[0029] Figure 2 is the schematic diagram of the main steps of the business processing method according to the embodiments of the present invention;

[0030] Figure 3 is the schematic diagram of the executor constructed based on the execution function obtained by abstract processing according to the embodiments of the present invention;

[0031] Figure 4 is the schematic diagram of the processing process of the data query task in an embodiment of the present invention;

[0032] Figure 5 is the schematic diagram of the main modules of the business processing device according to the embodiments of the present invention;

[0033] Figure 6 is the exemplary system architecture diagram to which the embodiments of the present invention can be applied;

[0034] Figure 7 is the schematic diagram of the structure of the computer system of the terminal device or server suitable for implementing the embodiments of the present invention. Detailed Embodiments

[0035] The following describes exemplary embodiments of the present invention with reference to the accompanying drawings. Various details of the embodiments of the present invention are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted below.

[0036] It should be noted that in the technical solutions disclosed in the present invention, in terms of the collection, gathering, updating, analysis, processing, use, transmission, storage, etc. of user personal information, they all comply with the provisions of relevant laws and regulations, are used for legal purposes, and do not violate public order and good customs. Necessary measures are taken for user personal information to prevent illegal access to user personal information data, and to safeguard user personal information security, network security, and national security.

[0037] It should be noted that in the technical solutions of the present invention, the processing of the collection, use, preservation, sharing, and transfer, etc. of user personal information all comply with the provisions of relevant laws and regulations, and it is necessary to inform users and obtain their consent or authorization. When applicable, technical processing such as de-identification and / or anonymization and / or encryption is performed on user personal information.

[0038] The business processing flow of the existing thread pool processing solution usually executes the corresponding business logic according to the business class within the thread pool. This method can only perform asynchronous processing on the complete task logic and is not flexible enough for task processing. Based on this, the present invention proposes a business processing method for splitting tasks based on task execution steps, specifically as Figure 1 shown. Within the thread pool, the task execution logic is abstracted through an abstract class to obtain a business execution logic function, a thread submission logic function, a result acquisition logic function, and a result processing logic function. Among them, each execution function corresponds to each sub-task obtained by splitting the task.

[0039] Figure 2 is a schematic diagram of the main steps of the business processing method according to an embodiment of the present invention. As Figure 2 shown, the business processing method of the embodiment of the present invention mainly includes the following steps S201 to step S205.

[0040] Step S201, split the task to be processed according to the business processing logic to obtain at least one sub-task, and generate a first logical relationship between the sub-tasks.

[0041] After receiving the task to be processed, it is necessary to split the task according to the business processing logic corresponding to the task to obtain at least one sub-task. Specifically, the business processing logic includes the execution steps of tasks in the thread pool. For example, when the task is to query commodity price data, four sub-tasks of commodity price query logic, thread submission, query result acquisition, and result processing are obtained according to the business processing logic. Establish a first logical relationship for the obtained sub-tasks, specifically including the relationship of the execution order of the sub-tasks.

[0042] Step S202, obtain the executor corresponding to each sub-task according to the execution logic of each sub-task. The executor includes at least one execution unit, and there is a second logical relationship between the execution units.

[0043] Obtain the executor according to the execution logic of the sub-task for executing the corresponding sub-task. Among them, each executor contains at least one execution unit. Specifically, the types of execution units in the executor can be set according to actual task requirements, and the present invention does not limit this; there is a second logical relationship between the execution units in the executor for determining the execution order of the execution units.

[0044] According to an embodiment of the present invention, the number and types of execution units included in the actuator are related to the way of splitting tasks. For example, when the task is to query commodity price data, according to the business processing logic, four subtasks of the smallest processing units, namely, commodity price query logic, thread submission, obtaining query results, and result processing, can be obtained. Each subtask can correspond to an actuator, and each actuator includes one execution unit; alternatively, the split subtasks are the commodity price query logic and the thread submission task, and the two subtasks of obtaining query results and result processing tasks. Each actuator includes two execution units, that is, the first actuator includes the execution unit corresponding to the commodity price query logic and the execution unit corresponding to the thread submission, and the same is true for the second actuator. The specific task splitting method and the number and types of execution units included in the actuator can be set according to the actual situation, and there is no limitation on this. However, when there are multiple execution units in the actuator, the logical relationship of the execution units needs to be defined to determine their execution order.

[0045] Step S203, determine the first execution order of each actuator according to the first logical relationship between the subtasks, and determine the second execution order of each execution unit according to the second logical relationship between the execution units included in each actuator.

[0046] Determine the first execution order of the actuator corresponding to the subtask according to the execution order of the subtask obtained from the logical relationship of the subtasks, and at the same time determine the second execution order of the execution unit in the actuator. Among them, the second logical relationship of the execution unit is pre-stored in the actuator, and according to this logical relationship, the execution order of the execution unit can be determined, and this order is fixed in the actuator.

[0047] Illustrate the process of determining the order: When the task is to query commodity price data, according to the subtasks in its split result, it is determined that the corresponding actuators include the first actuator and the second actuator. According to the logical relationship of the subtasks, it is determined that the commodity price query operation needs to be executed first, and then the query results are obtained and processed, so that the execution order from the first actuator to the second actuator can be obtained. In the first actuator, according to the preset second logical relationship of the execution unit, the second execution order from the execution unit corresponding to the commodity price query logic to the execution unit corresponding to the thread submission is determined.

[0048] According to an embodiment of the present invention, each actuator can be reused according to the splitting result of the task. For example, when the task is to query product price and inventory data, the first actuator needs to be used separately when querying product price data and inventory data respectively, that is, the first actuator needs to be called repeatedly twice. The repeatedly used actuators can be executed according to the execution order of subtasks (or the execution order of actuators), where the execution order of each subtask is, for example, parallel execution or serial execution at the same time, that is, product price data and inventory data can be queried simultaneously, or product price data can be queried first and then inventory data.

[0049] Step S204, based on the first execution order of each actuator and the second execution order of each execution unit included in each actuator, determine the final execution order of each execution unit included in the task to be processed.

[0050] Perform sorting on the execution units according to the obtained first execution order and second execution order to obtain the final execution order of all execution units required for the final task to be processed. For example, the first execution order is from the first actuator to the second actuator, and the second execution order is from the first execution unit in the first actuator to the second execution unit and from the third execution unit in the second actuator to the fourth execution unit. Through summary sorting, the final execution order of all execution units can be obtained as: the first execution unit - the second execution unit - the third execution unit - the fourth execution unit.

[0051] Step S205, based on the final execution order, execute each execution unit included in the task to be processed for business processing.

[0052] After obtaining the final execution order, execute each execution unit in this order until all execution units are executed, and the task is considered completed.

[0053] According to an embodiment of the present invention, each execution unit can be executed asynchronously. For example, when the task is to query product price and inventory data, it includes the execution logic for querying product price data and the execution logic for querying product inventory data. The two parts of execution logic can be executed asynchronously, and only the final query results need to be summarized.

[0054] According to an embodiment of the present invention, taking the task of querying product price and inventory data as an example, before executing the query for product price or inventory data, it is necessary to query the basic information of the product so as to subsequently query the product price or inventory data based on this basic information. Therefore, a subtask for querying the basic information of the product can be obtained when splitting the subtasks, and the subtask for querying product price or inventory data will be executed only after this subtask is completed.

[0055] According to the service processing method provided by an embodiment of the present invention, after splitting a task into subtasks with a first logical relationship, an executor including execution units can be obtained according to the subtasks, and the logical relationship between the execution units can be determined. Furthermore, the execution order of the execution units can be determined, and the final execution order of each execution unit of the final task to be processed can be determined in combination with the execution order of the executors determined according to the first logical relationship to complete the service processing operation. The splitting of the service logic is realized through the execution units, and flexible combination and matching can be performed based on the split execution units to implement corresponding service functions, simplifying the logic of service execution and improving the service processing efficiency.

[0056] According to an embodiment of the present invention, before obtaining the executors corresponding to each subtask according to the execution logic of each subtask, the service processing method further includes: abstracting the execution logic of a preset task to obtain at least one execution function, and generating corresponding execution units according to each execution function; combining the execution units according to the unit combination rule to generate at least one executor.

[0057] Before obtaining the executor corresponding to the subtask, it is necessary to abstract the execution logic of the preset task in the system in advance to obtain the execution function of the smallest unit, and generate corresponding execution units according to each execution function, which are used to execute the service operation implemented by the execution function. Here, the preset task is, for example, a large number of tasks that have been processed previously. Through abstraction, the service steps can be split into relatively atomic operations, and the obtained execution functions can be combined and used according to different task requirements. In this way, not only can developers only focus on the service logic without paying too much attention to the execution framework, but also the present invention utilizes the characteristics of abstraction and inheritance, and personalized processes can also be realized through rewriting and other methods. Combine the execution units according to the combination of the execution functions and create executors corresponding to each combination.

[0058] According to an embodiment of the present invention, the execution function obtained through abstraction is a general execution function, and parameter configuration is required when implementing specific services subsequently, including configuration of the data type to be queried, etc. For example, after abstracting to obtain the service execution logic function and generating the corresponding execution unit, after parameter configuration, an execution unit for querying the commodity price is obtained, which is used to execute the subtask of querying the commodity price.

[0059] According to the service processing method provided by an embodiment of the present invention, the service execution logic can be split into relatively atomic operations, that is, execution units, through the way of abstraction, reducing the limitation of the service execution logic on task implementation. The flexible combination of the execution units helps to improve the synchronous and asynchronous execution efficiency of each execution unit and enhances the flexibility of service execution.

[0060] According to an embodiment of the present invention, the execution function may include, for example: business execution logic function, thread submission logic function, result acquisition logic function, and result processing logic function. Correspondingly, the corresponding execution units include, for example: business execution logic unit, thread submission logic unit, result acquisition logic unit, and result processing logic unit. Finally, the executor obtained by combining the execution units may include: business execution logic executor, thread submission logic executor, result acquisition logic executor, result processing logic executor, business execution and thread submission logic executor, result acquisition and result processing logic executor, business execution and thread submission and result acquisition logic executor, business execution and thread submission and result acquisition and result processing logic executor.

[0061] The execution function obtained by abstracting the execution logic of a preset task includes four functions: business execution logic function, thread submission logic function, result acquisition logic function, and result processing logic function. The generated corresponding execution units include a business execution logic unit (G), a thread submission logic unit (S), a result acquisition logic unit (R), and a result processing logic unit (P). As Figure 3 shown is the executor constructed based on the execution function obtained by abstract processing. The executor may include only one execution unit, or may be a combination of two or more execution units. According to business needs, the executor may include a business execution logic executor (G), a thread submission logic executor (S), a result acquisition logic executor (R), a result processing logic executor (P), a business execution and thread submission logic executor (GS), a result acquisition and result processing logic executor (RP), a business execution and thread submission and result acquisition logic executor (GSR), a business execution and thread submission and result acquisition and result processing logic executor (GSRP).

[0062] According to an embodiment of the present invention, the combination manner of the above executors is only one implementation example. In actual applications, the execution units can be freely combined according to business requirements to generate executors, and the present invention does not make specific restrictions on the combination manner.

[0063] According to an embodiment of the present invention, when the task is to query commodity price and inventory data, the basic commodity information is the basic information. The commodity price and the commodity inventory data information are independent of each other but both depend on the basic information. Using the present invention, it is possible to only implement the logic for obtaining price and inventory data and the processing of the obtained data, and then achieve different logics according to different requirements through configuration, so that the relevant functional logics can be aggregated to improve the code reuse rate and reduce the development cost.

[0064] According to an embodiment of the present invention, the service processing method may further include: in response to failing to obtain an executor corresponding to a subtask according to the execution logic of the subtask, modifying the configuration parameters corresponding to the existing execution unit according to the execution logic of the subtask to generate an execution unit that conforms to the execution logic of the subtask; and generating an executor corresponding to the subtask according to the generated execution unit.

[0065] If the executor corresponding to the subtask cannot be obtained, for example, when the subtask is to query the commodity price and the executor including the commodity price query execution unit cannot be obtained, it is necessary to modify the configuration parameters of the existing execution unit. Specifically, a general execution unit obtained after abstract processing can be selected for parameter configuration, and the configured execution unit can implement the commodity price query operation. And an executor is generated according to the configured execution unit.

[0066] According to the service processing method provided by the embodiment of the present invention, an execution unit can be obtained through abstract processing. When executing a subtask, the corresponding configuration parameters are modified to complete the corresponding operation, simplifying the service execution logic, reducing the duplication of a large amount of code in the service execution process, and improving the utilization rate of the code.

[0067] According to an embodiment of the present invention, the first logical relationship and the second logical relationship may include, for example, parallel execution, serial execution, and series-parallel execution.

[0068] The first logical relationship between the split subtasks includes various relationships such as parallel execution, serial execution, and series-parallel execution. Specifically, the subtasks can be executed in parallel without interference, such as querying the commodity price and querying the commodity inventory; while for some subtasks with a sequential order, they need to be executed in series, such as querying the commodity price and obtaining the commodity price query result. The second logical relationship is similar to the first logical relationship and can also include parallel execution, serial execution, and series-parallel execution.

[0069] Taking the display of interest-free on the commodity details page as an example according to an embodiment of the present invention: The display elements on the commodity details page include multi-dimensional commodity information such as commodity basic information, price information, interest-free information, and inventory information of the current address. Since price information, interest-free information, inventory information, etc. depend on the commodity basic information, the tasks mainly include the following steps: (1) Query the commodity basic information rpc (Remote Procedure Call) call implementation (service logic execution function) and basic information result processing (result processing function), (2) Query the price information rpc call implementation and price information result processing, (3) Query the interest fee rpc call implementation and interest fee information processing, (4) Query the inventory information rpc call implementation and inventory information processing. Next, the following chain configuration is performed:

[0070] Set (1) GSRP;

[0071] Set (2) GS;

[0072] Set (3) GS;

[0073] Set (4) GS;

[0074] Set (2) RP;

[0075] Set (3) RP;

[0076] Set (4) RP;

[0077] The configuration is completed here. Chain operation description: When the service is called, it first queries the basic information of the commodity, parses the returned information and then assigns values. Then it executes the setting of the price information query parameters and submits them to the thread pool for execution. Then it encapsulates the interest fee query information and submits it to the thread pool for execution. Then it encapsulates the information required for inventory query and submits it to the thread pool for execution. Next, it obtains the rpc operation result of querying the price, parses the result and assigns it to the object. Then it obtains the rpc operation result of the interest fee, parses the result and assigns it to the object. Then it obtains the inventory rpc result and copies it to the object. Finally, it returns the object, and the execution process of this business is completed here.

[0078] Figure 4 It is a schematic diagram of the processing process of the data query task in an embodiment of the present invention. As Figure 4 shown is the implementation process when the task is to query the commodity price and inventory data. First, the basic information of the commodity is queried, and the atomic execution logics for price query and inventory query are respectively determined according to the queried basic information of the commodity. After determination, thread submission is performed, and the results are obtained. Then the atomic execution logics for price processing and inventory processing are executed, and the final returned results are processed.

[0079] According to the service processing method provided by the embodiment of the present invention, the task can be split into at least one subtask. At the same time, the service execution logic is disassembled in advance through abstract processing to obtain execution units and executors for executing corresponding subtasks. Specifically, the executor containing the execution unit is obtained according to the subtask, and the execution order of the execution unit is determined. Combining the execution order of the executor determined according to the first logical relationship, the final execution order of each execution unit of the final task to be processed is determined to complete the service processing operation. The execution units obtained by disassembling the service logic can be flexibly combined to implement corresponding service functions, simplifying the logic of service execution and improving the processing efficiency of the subtasks included in each task. At the same time, inheritance and other methods are used to simplify the need to copy a large amount of duplicate and useless code for similar processes with repeated code, improving the utilization rate of the code.

[0080] As Figure 5The following is a schematic diagram of the main modules of the service processing apparatus 500 provided by an embodiment of the present invention. The service processing apparatus 500 mainly includes: a splitting module 501, an obtaining module 502, a first determination module 503, a second determination module 504, and an execution module 505.

[0081] The splitting module 501 is configured to split a to-be-processed task into at least one subtask according to service processing logic, and generate a first logical relationship between the subtasks.

[0082] The obtaining module 502 is configured to obtain an executor corresponding to each subtask according to the execution logic of each subtask. The executor includes at least one execution unit, and there is a second logical relationship between the execution units.

[0083] The first determination module 503 is configured to determine a first execution order of each executor according to the first logical relationship between the subtasks, and determine a second execution order of each execution unit according to the second logical relationship between the execution units included in each executor.

[0084] The second determination module 504 is configured to determine a final execution order of each execution unit included in the to-be-processed task based on the first execution order of each executor and the second execution order of each execution unit included in each executor.

[0085] The execution module 505 is configured to execute each execution unit included in the to-be-processed task based on the final execution order to perform service processing.

[0086] According to an embodiment of the present invention, the service processing apparatus 500 may further include: a processing module 506 (not shown in the figure), configured to abstract the execution logic of a preset task to obtain at least one execution function, and generate a corresponding execution unit according to each execution function; a combination module 507 (not shown in the figure), configured to combine the execution units according to a unit combination rule to generate at least one executor.

[0087] According to an embodiment of the present invention, the execution functions include: a service execution logic function, a thread submission logic function, a result acquisition logic function, and a result processing logic function. The execution units include: a service execution logic unit, a thread submission logic unit, a result acquisition logic unit, and a result processing logic unit. The executors include: a service execution logic executor, a thread submission logic executor, a result acquisition logic executor, a result processing logic executor, a service execution and thread submission logic executor, a result acquisition and result processing logic executor, a service execution and thread submission and result acquisition logic executor, and a service execution and thread submission and result acquisition and result processing logic executor.

[0088] According to an embodiment of the present invention, the service processing apparatus 500 may further include: a modification module 508 (not shown in the figure), configured to, in response to failure to obtain an executor corresponding to a subtask according to the execution logic of the subtask, modify the configuration parameters corresponding to the existing execution unit according to the execution logic of the subtask to generate an execution unit that conforms to the execution logic of the subtask; and generate an executor corresponding to the subtask according to the generated execution unit.

[0089] According to an embodiment of the present invention, the first logical relationship and the second logical relationship include parallel execution, serial execution, and series-parallel execution.

[0090] The service processing apparatus provided by the embodiment of the present invention can split a task into at least one subtask, and at the same time, disassemble the service execution logic through abstract processing in advance to obtain an execution unit and an executor for executing the corresponding subtask. Specifically, an executor including an execution unit is obtained according to the subtask, and the execution order of the execution unit is determined. The final execution order of each execution unit of the final task to be processed is determined in combination with the execution order of the executor determined according to the first logical relationship to complete the service processing operation. The execution units obtained by disassembling the service logic can be flexibly combined to achieve the corresponding service function, simplify the logic of service execution, and improve the processing efficiency of the subtasks included in each task. At the same time, inheritance and other methods are used to simplify the need to copy a large amount of redundant and useless code for similar processes with repeated code, improving the utilization rate of the code.

[0091] Figure 6 An exemplary system architecture 600 to which the service processing method or the service processing apparatus according to the embodiment of the present invention can be applied is shown.

[0092] As Figure 6 shown, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 is used to provide a medium for a communication link between the terminal devices 601, 602, 603 and the server 605. The network 604 may include various connection types, such as a wired, wireless communication link, or a fiber optic cable, etc.

[0093] Users can use the terminal devices 601, 602, 603 to interact with the server 605 through the network 604 to receive or send messages, etc. Various communication client applications may be installed on the terminal devices 601, 602, 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as an example).

[0094] The terminal devices 601, 602, and 603 can be various electronic devices with a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop computers, desktop computers, and the like.

[0095] The server 605 can be a server that provides various services. For example, it can be a background management server (only an example) that supports the websites browsed by users using the terminal devices 601, 602, and 603. The background management server can perform operations such as querying on data such as the received task requests to be processed, and feedback the processing results (such as query results - only an example) to the terminal devices.

[0096] It should be noted that the service processing method provided by the embodiments of the present invention is generally executed by the server 605. Correspondingly, the service processing device is generally disposed in the server 605.

[0097] It should be understood that Figure 6 the numbers of terminal devices, networks, and servers in

[0098] are merely illustrative. According to the implementation requirements, there can be any number of terminal devices, networks, and servers. Figure 7 Shown below is a schematic structural diagram of a computer system 700 of a terminal device or a server suitable for implementing the embodiments of the present invention. Figure 7 The shown terminal device or server is merely an example and should not impose any limitations on the functions and usage scope of the embodiments of the present invention.

[0099] As Figure 7 shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 702 or the program loaded from the storage section 708 into the random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, ROM 702, and RAM 703 are connected to each other through a bus 704. The input / output (I / O) interface 705 is also connected to the bus 704.

[0100] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as required. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is installed on the drive 710 as required so that a computer program read therefrom is installed into the storage section 708 as required.

[0101] Specifically, according to the embodiments disclosed by the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed by the present invention include a computer program product which includes a computer program carried on a computer-readable medium, and the computer program includes program codes for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 709, and / or installed from the removable medium 711. When the computer program is executed by a central processing unit (CPU) 701, the above functions defined in the system of the present invention are executed.

[0102] It should be noted that the computer-readable medium shown in the present invention can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, apparatus, or device. In the present invention, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, in which the computer-readable program code is carried. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, and this computer-readable medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0103] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order from that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0104] The units or modules involved in the embodiments of the present invention can be implemented in software or in hardware. The described units or modules can also be provided in a processor. For example, it can be described as: a processor includes a splitting module, an obtaining module, a first determining module, a second determining module, and an executing module. Among them, the names of these units or modules do not constitute a limitation to the units or modules themselves in some cases. For example, the splitting module can also be described as "a module for splitting a task to be processed according to business processing logic to obtain at least one subtask and generating a first logical relationship between the subtasks".

[0105] As another aspect, the present invention also provides a computer-readable medium. The computer-readable medium can be included in the device described in the above embodiments; or it can exist alone without being assembled into the device. The above computer-readable medium carries one or more programs. When the one or more programs are executed by the device, the device includes: splitting a task to be processed according to business processing logic to obtain at least one subtask and generating a first logical relationship between the subtasks; obtaining an executor corresponding to each subtask according to the execution logic of each subtask, the executor including at least one execution unit, and there is a second logical relationship between the execution units; determining a first execution order of each executor according to the first logical relationship between the subtasks, and determining a second execution order of each execution unit according to the second logical relationship between the execution units included in each executor; determining a final execution order of each execution unit included in the task to be processed based on the first execution order of each executor and the second execution order of each execution unit included in each executor; and executing each execution unit included in the task to be processed based on the final execution order to perform business processing.

[0106] According to the technical solution of the embodiments of the present invention, after splitting a task into subtasks with a first logical relationship, an executor including execution units can be obtained according to the subtasks, and the logical relationship between the execution units can be determined. Furthermore, the execution order of the execution units can be determined. Combining the execution order of the executors determined according to the first logical relationship, the final execution order of each execution unit of the final task to be processed is determined to complete the business processing operation. The decomposition of business logic is realized through the execution units, and flexible combination and matching can be performed based on the decomposed execution units to achieve corresponding business functions, simplifying the logic of business execution and improving business processing efficiency.

[0107] The above specific embodiments do not constitute a limitation on the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A service processing method, characterized in that Including: Splitting the task to be processed into at least one subtask according to the service processing logic, and generating a first logical relationship between the subtasks; Obtaining an executor corresponding to each subtask according to the execution logic of each subtask, where the executor includes at least one execution unit, and there is a second logical relationship between the execution units; Determining a first execution order of each executor according to the first logical relationship between the subtasks, and determining a second execution order of each execution unit according to the second logical relationship between the execution units included in each executor; Based on the first execution order of each executor and the second execution order of each execution unit included in each executor, determining a final execution order of each execution unit included in the task to be processed; Executing each execution unit included in the task to be processed based on the final execution order to perform service processing.

2. The method according to claim 1, wherein Before obtaining an executor corresponding to each subtask according to the execution logic of each subtask, the method further includes: Abstracting the execution logic of a preset task to obtain at least one execution function, and generating a corresponding execution unit according to each execution function; Combining the execution units according to the unit combination rule to generate at least one executor.

3. The method according to claim 2, wherein The execution function includes: a service execution logic function, a thread submission logic function, a result acquisition logic function, and a result processing logic function; The execution unit includes: a service execution logic unit, a thread submission logic unit, a result acquisition logic unit, and a result processing logic unit; The executor includes: a service execution logic executor, a thread submission logic executor, a result acquisition logic executor, a result processing logic executor, a service execution and thread submission logic executor, a result acquisition and result processing logic executor, a service execution and thread submission and result acquisition logic executor, a service execution and thread submission and result acquisition and result processing logic executor.

4. The method according to claim 1, wherein The method further includes: In response to failing to obtain an executor corresponding to the subtask according to the execution logic of the subtask, modifying the configuration parameters corresponding to the existing execution units according to the execution logic of the subtask to generate an execution unit that conforms to the execution logic of the subtask; And generating an executor corresponding to the subtask according to the generated execution unit.

5. The method according to any one of claims 1-4, characterized in that The first logical relationship and the second logical relationship include parallel execution, serial execution, and series-parallel execution.

6. A service processing device, characterized in that, Including: A splitting module, configured to split the task to be processed into at least one subtask according to the service processing logic, and generate a first logical relationship between the subtasks; An obtaining module, configured to obtain an executor corresponding to each subtask according to the execution logic of each subtask, where the executor includes at least one execution unit, and there is a second logical relationship between the execution units; A first determining module, configured to determine a first execution order of each executor according to the first logical relationship between the subtasks, and determine a second execution order of each execution unit according to the second logical relationship between the execution units included in each executor; A second determination module, configured to determine a final execution order of each execution unit included in the to-be-processed task based on the first execution order of each actuator and the second execution order of each execution unit included in each actuator; An execution module, configured to execute each execution unit included in the to-be-processed task based on the final execution order to perform service processing.

7. The device according to claim 6, wherein The apparatus further includes a modification module, configured to: In response to failing to obtain an actuator corresponding to the subtask according to the execution logic of the subtask, modify configuration parameters corresponding to an existing execution unit according to the execution logic of the subtask to generate an execution unit that conforms to the execution logic of the subtask; And generate an actuator corresponding to the subtask according to the generated execution unit.

8. An electronic device, characterized in that, Including: One or more processors; A storage device, configured to store one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1-5.

9. A computer-readable medium having a computer program stored thereon, characterized in that, The computer program, when executed by a processor, implements the method according to any one of claims 1-5.

10. A computer program product comprising a computer program, characterized in that, The computer program, when executed by a processor, implements the method according to any one of claims 1-5.