Multi-threaded Request Data Integration Method, Apparatus, Electronic Device and Storage Medium

Through the multi-threaded data integration method, the asynchronous thread pool and fusion mechanism are used to solve the problem of time-consuming and unstable connection between the APP background and the partner interface, the system response speed and scalability are improved, and thread suspension is avoided.

CN112527487BActive Publication Date: 2025-05-27CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011510520.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-18
Publication Date
2025-05-27
Estimated Expiration
2040-12-18

AI Technical Summary

Technical Problem

In a high concurrency and high availability environment, it takes a long time to connect the partner interface to the APP background, and the partner interface is unstable, which causes the system response to take a long time, which can easily cause the server and database to be overloaded, resulting in unavailability of the service or affect the associated system.

Method used

The multi-threaded request data integration method is adopted to obtain the related party list through online configuration components, instantiate the process to form a single type of object, and put it into an asynchronous thread pool for asynchronous concurrent processing. Based on the circuit breaker mechanism, the requested data is responded asynchronously, and the return data is integrated and sent to the client.

Benefits of technology

It reduces the time-consuming operation of APP backend to connect to partner interfaces, improves the stability of partner interfaces and the efficiency of integrating data, avoids thread suspension, and facilitates later maintenance and expansion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112527487B_ABST
    Figure CN112527487B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of data processing, and provides a multi-threaded request data integration method. First, the related parties in the related party list are instantiated to form a single class object, and then the single class object is placed into an asynchronous thread pool to generate a list object of the asynchronous thread pool. The single class object interface of the asynchronous thread pool is called for asynchronous concurrency to form request data. Thus, by utilizing the parallel feature of the asynchronous thread pool, requests can be initiated simultaneously without serial waiting, greatly shortening the interface response time. Then, based on the circuit breaker mechanism, asynchronous response is performed on the request data to generate return data, and the return data is transmitted to the single class object interface. The circuit breaker mechanism can promptly eliminate requests with slow responses or exceptions, avoiding thread suspension caused by request congestion. Then, the online configuration component classifies and summarizes the return data at the single class object interface to form integrated data, and the integrated data is sent to the client for the user to compare and select.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to a data integration method, and more particularly to a multi-threaded request data integration method, apparatus, electronic device, and computer-readable storage medium. Background Art

[0002] In today's common environment of high concurrency and high availability of software, the access of a large number of users on some APPs places higher requirements on the interface response time of the system. Currently, in addition to the self-built part of the services presented on the APP, in fact, a large proportion is that the background integrates the interfaces of multiple downstream associated partners. The background integrates the interface information of the partners to enable users to enjoy more extensive and complete services. However, while achieving rapid iterative updates of the product, it also brings many performance problems. For example, in terms of the background technical implementation, the time-consuming for serial queuing to call the interfaces of the partners is relatively long, the interfaces of the partners are unstable, and there are peaks and valleys in the sudden increase of the user volume, etc. It is easy to cause long system response time, and when an exception occurs, it is easy to bring down the server and database, resulting in service unavailability or affecting associated systems.

[0003] Moreover, due to the differences in the interfaces of the associated partners, it is easy to cause repeated code implementation logic, bloated and redundant code volume, which is not conducive to maintenance, not easy to expand, and difficult to troubleshoot problems.

[0004] Therefore, there is an urgent need for a multi-threaded request integration data method that can improve the response speed and scalability, facilitate later maintenance, and avoid causing thread suspension phenomena. Summary of the Invention

[0005] The present invention provides a multi-threaded request data integration method, apparatus, electronic device, and computer-readable storage medium, and its main purpose is to reduce the time-consuming for the APP background to connect to the interfaces of the APP partners, improve the stability of the partner interfaces, and improve the efficiency of integrating the data returned by multiple partners.

[0006] To achieve the above object, a multi-threaded request data integration method provided by the present invention includes:

[0007] Call the online configuration component to obtain the related party list, and instantiate all the related parties in the related party list to form a single class object; wherein, the single class object is the object corresponding to each related party in the related party list; the process of calling the online configuration component to obtain the related party list and instantiating all the related parties in the related party list to form a single class object includes: the client background calls the online configuration component to obtain the related party list; using the factory pattern to classify each related party in the related party list to form a single class component; the factory pattern is a design pattern that generates parallel similar classes from a list; create a single class name for the single class component, and convert the single class component into a format that can communicate with the asynchronous thread pool to form a single class object; wherein, the channel for the single class object to communicate with the asynchronous thread pool is the single class channel;

[0008] Put the single class object into the asynchronous thread pool to generate a list object of the asynchronous thread pool;

[0009] By triggering the list object, call the single class object interface of the asynchronous thread pool for asynchronous concurrency to form request data; before triggering the list object, it also includes: creating a trigger interface; connecting the trigger interface to the single class channel to form a single class object interface; and the process of calling the single class object interface of the asynchronous thread pool for asynchronous concurrency to form request data by triggering the list object includes: the online configuration component transmits the destination request input by the client to the list object; the list object calls the asynchronous thread pool list for the destination request; judge whether the asynchronous thread pool list is consistent with the request list in the destination request; if consistent, transmit the destination request to the single class object interface at the same time; the single class object interface converts the destination request into destination data, and transmits the destination data to the single class object through the single class channel;

[0010] Based on the circuit breaker mechanism, perform an asynchronous response to the request data to generate return data, and transmit the return data to the single class object interface, so that the online configuration component classifies and summarizes the return data at the single class object interface to form integrated data, and transmits the integrated data to the client;; wherein, the process of performing an asynchronous response to the request data based on the circuit breaker mechanism to generate return data is:

[0011] The single class object receives the destination data based on the circuit breaker mechanism and generates return data according to the destination data; wherein, the circuit breaker mechanism includes a circuit breaker time and a circuit breaker rule;

[0012] The circuit breaker rule is:

[0013] If the time for the target data to reach the single-class object is longer than the fuse time and the single-class object still does not respond to the target data, the online configuration component interrupts the channel between the single-class object and the target data and sends null data to the online configuration component;

[0014] The online configuration component transmits the null data to the client.

[0015] Optionally, the process of putting the single-class object into the asynchronous thread pool to generate a list object of the asynchronous thread pool includes:

[0016] Create an empty list;

[0017] Put the single-class object and the single-class channel into the asynchronous thread pool to form a thread pool object, and put the asynchronous thread pool object into the empty list to form an asynchronous thread pool list;

[0018] Add a category parameter to the asynchronous thread pool list to form a list object.

[0019] Optionally, in the process of putting the asynchronous thread pool object into the empty list to form an asynchronous thread pool list, it further includes:

[0020] Set the list reply threshold;

[0021] When adding the asynchronous thread pool object to the asynchronous thread pool list, if the addition time exceeds the list reply threshold, the asynchronous thread pool list refuses to wait for the asynchronous thread pool object and sends an exception signal to the online configuration component.

[0022] Optionally, if the online configuration component receives the exception signal, an exception handling component is used to perform exception handling; wherein, the process of the exception handling includes:

[0023] The exception handling component identifies the exception signal;

[0024] Obtain the asynchronous thread pool object corresponding to the exception signal;

[0025] Filter out the asynchronous thread pool object corresponding to the exception signal in the asynchronous thread pool.

[0026] To solve the above problems, the present invention further provides a multi-threaded request data integration device, and the device includes:

[0027] An object configuration unit is used to call an online configuration component to obtain a list of associated parties, and perform instantiation processing on all the associated parties in the list of associated parties to form a single-class object; wherein, the single-class object is an object corresponding to each associated party in the list of associated parties; the process of calling the online configuration component to obtain the list of associated parties and performing instantiation processing on all the associated parties in the list of associated parties to form a single-class object includes: the client background calls the online configuration component to obtain the list of associated parties; using the factory pattern to classify each associated party in the list of associated parties to form a single-class component; the factory pattern is a design pattern for generating parallel similar classes from a group of lists; creating a single-class name for the single-class component, and converting the single-class component into a format capable of communicating data with the asynchronous thread pool to form a single-class object; wherein, the channel for the single-class object to communicate data with the asynchronous thread pool is a single-class channel;

[0028] A list object generation unit is used to put the single-class object into the asynchronous thread pool to generate a list object of the asynchronous thread pool;

[0029] An asynchronous request unit is used to trigger the list object to call the single-class object interface of the asynchronous thread pool for asynchronous concurrency to form request data; before triggering the list object, it further includes: creating a trigger interface; connecting the trigger interface to the single-class channel to form a single-class object interface; and the process of triggering the list object to call the single-class object interface of the asynchronous thread pool for asynchronous concurrency to form request data includes: the online configuration component transmits the destination request input by the client to the list object; the list object calls the asynchronous thread pool list for the destination request; determining whether the asynchronous thread pool list is consistent with the request list in the destination request; if consistent, simultaneously transmitting the destination request to the single-class object interface; the single-class object interface converts the destination request into destination data, and transmits the destination data to the single-class object through the single-class channel;

[0030] A data integration unit is used to perform asynchronous response on the request data based on a circuit breaker mechanism to generate return data, and transmit the return data to the single-class object interface, so that the online configuration component classifies and summarizes the return data at the single-class object interface to form integrated data, and transmits the integrated data to the client; wherein, the process of performing asynchronous response on the request data based on the circuit breaker mechanism to generate return data is:

[0031] The single-class object receives the destination data based on the circuit breaker mechanism and generates return data according to the destination data; wherein, the circuit breaker mechanism includes a circuit breaker time and a circuit breaker rule;

[0032] The fusing rule is as follows:

[0033] If the time for the target data to reach the single-class object is longer than the fusing time and the single-class object still does not respond to the target data, the online configuration component interrupts the channel between the single-class object and the target data and sends null data to the online configuration component;

[0034] The online configuration component transmits the null data to the client.

[0035] To solve the above problems, the present invention further provides an electronic device, which includes:

[0036] A memory that stores at least one instruction; and

[0037] A processor that executes the instructions stored in the memory to implement the steps in the multi-threaded request data integration method described above.

[0038] To solve the above problems, the present invention further provides a computer-readable storage medium, in which at least one instruction is stored, and the at least one instruction is executed by a processor in an electronic device to implement the multi-threaded request data integration method described above.

[0039] In the embodiment of the present invention, the online configuration component is first called to obtain a list of associated parties, and the associated parties in the list of associated parties are instantiated to form single-class objects, that is, all the lists of cooperation parties are converted into objects in the client background, so that users can send requests to the cooperation parties through the client, and then the single-class objects are put into an asynchronous thread pool to generate a list object of the asynchronous thread pool. By triggering the list object, the single-class object interface of the asynchronous thread pool is called for asynchronous concurrency to form request data. Therefore, by using the parallel characteristics of the asynchronous thread pool, requests can be initiated simultaneously without serial waiting, which greatly shortens the interface response time. Then, based on the fusing mechanism, an asynchronous response is made to the request data to generate return data, and the return data is transmitted to the single-class object interface. The fusing mechanism can timely eliminate requests with slow responses or exceptions, avoiding thread suspension caused by request congestion. Then, the online configuration component classifies and summarizes the return data at the single-class object interface to form integrated data, and sends the integrated data to the client. The client can clearly understand the data returned by each single-class object, which is convenient for comparison and selection, and can conveniently expand the cooperation party interface for later maintenance. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a schematic flowchart of a multi-threaded request data integration method provided by an embodiment of the present invention;

[0041] Figure 2Schematic diagram of modules of the multi-threaded request data integration device provided by an embodiment of the present invention;

[0042] Figure 3 Internal structure schematic diagram of an electronic device for implementing the multi-threaded request data integration method provided by an embodiment of the present invention;

[0043] The realization, functional features and advantages of the object of the present invention will be further described with reference to the embodiments and the accompanying drawings. Specific embodiments

[0044] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0045] The present invention provides a multi-threaded request data integration method. Refer to Figure 1 As shown, it is a flowchart of the multi-threaded request data integration method provided by an embodiment of the present invention. This method can be executed by a device, and the device can be implemented by software and / or hardware.

[0046] In this embodiment, the multi-threaded request data integration method includes:

[0047] S1: Call the online configuration component to obtain the list of related parties, and perform instantiation processing on all related parties in the list of related parties to form a single class object; wherein, the single class object is the object corresponding to each related party in the list of related parties;

[0048] The process of step S1 includes:

[0049] S11: The client background calls the online configuration component to obtain the list of related parties; in this embodiment, the online configuration component uses the Apollo component;

[0050] S12: Use the factory mode to classify each related party in the list of related parties to form a single class component; the factory mode is a design pattern for generating parallel similar classes from a group of lists;

[0051] S13: Create a single class name for the single class component, and convert the single class component into a format that can communicate with the asynchronous thread pool to form a single class object; wherein, the channel for the single class object to communicate with the asynchronous thread pool is the single class channel.

[0052] Specifically, in one embodiment, this solution is applied to a parking scheduling system. In this embodiment, the above-mentioned disclosed client can be a parking software. The background of the parking software calls an online configuration component to obtain a list of associated parties. The list of associated parties can include multiple associated parties. For example, it includes five associated parties (parking space merchants), named A, B, C, D, and E respectively. When a full parking request is initiated to the parking software, the background of the parking software calls the online configuration component to obtain a list of all parking space merchants, and uses the factory mode to classify each merchant in the parking merchant list to form five parallel and non-interfering merchant components, namely ServiceA, ServiceB, ServiceC, ServiceD, and ServiceE. Then, parking merchant names are created for the five independent merchant components, and a single type of channel (parking channel) is created for each parking merchant name. Moreover, the five channels are independent of each other and do not interfere with each other.

[0053] S2: Put the single-class object into an asynchronous thread pool to generate a list object of the asynchronous thread pool;

[0054] The process of putting the single-class object into the asynchronous thread pool to generate a list object of the asynchronous thread pool includes:

[0055] S21: Establish an empty list in the client background;

[0056] S22: Put the single-class object and the single-class channel into the asynchronous thread pool to form a thread pool object, and put the asynchronous thread pool object into the empty list to form an asynchronous thread pool list;

[0057] S23: Add a category parameter to the asynchronous thread pool list to form a list object;

[0058] In the process of putting the asynchronous thread pool object into the empty list to form an asynchronous thread pool list, it also includes:

[0059] S22-1: Set the list reply threshold;

[0060] S22-2: When adding an asynchronous thread pool object to the asynchronous thread pool list, if the addition time exceeds the list reply threshold, the asynchronous thread pool list refuses to wait for the asynchronous thread pool object and sends an exception signal to the online configuration component;

[0061] If the online configuration component receives the exception signal, an exception handling component is used to perform exception handling; among them, the process of exception handling includes:

[0062] The exception handling component identifies the exception signal;

[0063] Obtain the asynchronous thread pool object corresponding to the exception signal;

[0064] Filter out the asynchronous thread pool object corresponding to the exception signal in the asynchronous thread pool.

[0065] Specifically, when adding an asynchronous thread pool object to the asynchronous thread pool list, if the reply threshold is exceeded, the asynchronous thread pool list refuses to wait for the asynchronous thread pool object and sends an exception signal to the online configuration component. For example, if the reply threshold is 3 seconds, if it exceeds 3 seconds, the entire asynchronous thread pool list will no longer wait for the return of a certain asynchronous thread object and will throw a timeout exception.

[0066] Moreover, in this embodiment, a try-catch component is used as the exception handling component. The try-catch component includes a try statement and a catch statement. By compiling the exception acquisition statement in the try statement and the error handling method in the catch statement, it can lock the request exception when an exception occurs and perform exception handling for the request exception. As mentioned in the previous steps, the asynchronous thread pool list is specified to have a 3-second timeout when loading the asynchronous thread pool object. So as long as 3 seconds are reached, the asynchronous thread pool list will trigger a timeout exception. The try-catch component will continuously detect whether an exception is thrown. The timeout exception is a type of exception. If it is detected that it is the timeout exception category, such as the interface part of associated party A's user is slow and then triggers the set timeout time during loading, a timeout exception will be thrown at this time. Then it will be caught and recognized by the trt-catch component. Then the try-catch component uses the exception mechanism to filter out the asynchronous thread pool object corresponding to associated party A in time, that is, tells the asynchronous thread pool list that this asynchronous thread pool object has a timeout exception and does not need to wait for it to do integration anymore. Just return other data for integration first, so as to avoid affecting the waiting requests of the subsequent asynchronous thread pool object queue.

[0067] S3: Trigger the list object and call the single-class object interface of the asynchronous thread pool for asynchronous concurrency to form request data; and in this embodiment, the trigger list object is triggered simultaneously.

[0068] In step S3, before triggering the list object, it also includes:

[0069] S31-1: Create a trigger interface.

[0070] S31-2: Connect the trigger interface to a single-class channel to form a single-class object interface; and,

[0071] The process of triggering the list object and calling the single-class object interface of the asynchronous thread pool for asynchronous concurrency to form request data includes:

[0072] S32-1: The online configuration component transmits the destination request input by the client to the list object.

[0073] S32-2: The list object calls the asynchronous thread pool list for the target request;

[0074] S32-3: Determine whether the asynchronous thread pool list is consistent with the request list in the target request;

[0075] S32-4: If they are consistent, simultaneously transmit the target request to the single-class object interface;

[0076] S32-5: The single-class object interface converts the target request into target data and transmits the target data to the single-class object through the single-class channel.

[0077] Specifically, in this embodiment, the parking software is still used as the client. There are five parking merchants in the parking software. Before the user sends a request, it is necessary to create a trigger interface for these five users. Only through this trigger interface can the user's request be transmitted to the parking merchant;

[0078] When the user sends a parking request on the client of the parking software, the parking request first reaches the trigger component. The trigger component inputs the list of parking lots to be parked entered by the parking software client to the list object (i.e., the list containing all merchants). If the user only wants to park in three accessible merchants, then the list object calls the asynchronous thread pool list for the target request of parking in three merchants, and then determines whether the asynchronous thread pool list is consistent with the request list in the target request. If they are consistent, simultaneously transmit the target request of parking in three merchants to the single-class object interface. The single-class object interface converts the target request of parking in three merchants into target data and transmits the target data to the single-class object through the single-class channel.

[0079] S4: Asynchronously respond to the request data based on the circuit breaker mechanism to generate return data, and transmit the return data to the single-class object interface, so that the online configuration component classifies and summarizes the return data at the single-class object interface to form integrated data, and sends the integrated data to the client;

[0080] In step S4, the process of asynchronously responding to the request data based on the circuit breaker mechanism to generate return data is as follows:

[0081] S41: The single-class object receives the target data based on the circuit breaker mechanism and generates return data according to the target data; among them, the circuit breaker mechanism includes the circuit breaker time and the circuit breaker rule;

[0082] The circuit breaker rule is:

[0083] If the time for the target data to reach the single-class object is longer than the circuit breaker time and the single-class object still has not responded to the target data, the online configuration component interrupts the channel between the single-class object and the target data and sends null data to the online configuration component;

[0084] The online configuration component transfers empty data to the client.

[0085] In this embodiment, the fuse time is 5000 milliseconds. Generally, if it exceeds 10 seconds, the timeout will always hang in the thread pool, occupying server resources until the request is interrupted after a long time. If 5000 milliseconds is set as the fuse time, then when it exceeds 5000 milliseconds, this request will be actively cut off, empty data will be returned, and the thread resources of the thread pool will be released to avoid blocking subsequent requests. At the same time, it also avoids affecting the overall duration of the integrated data.

[0086] The process of transferring the returned data to a single-class object interface, enabling the online configuration component to classify and summarize the returned data at the single-class object interface to form integrated data, and sending the integrated data to the client includes:

[0087] S42: Transfer the returned data to a single-class object interface;

[0088] S43: The online configuration component receives all the returned data in the single-class object interface and organizes and summarizes the returned data to form integrated data;

[0089] S44: The online configuration component sends the integrated data to the client to complete the integration of multi-threaded requests for data.

[0090] Specifically, still taking the parking software as an example, when the user's target request reaches a single-class object (parking merchant), if the parking merchant fails to process it in time, the response path of this merchant will be cut off automatically. If some merchants are processed normally, they will send back data such as the remaining parking spaces and the unit price of parking spaces to the client according to this target request. The online configuration component organizes and summarizes all the returned data responded by the three merchants requested by the user, and organizes it into parking space information such as the remaining parking space quantity, the geographical location of the parking space, and the unit price of the parking space corresponding to each of the three merchants to form parking space integrated data, and sends this integrated data to the client for the user to select.

[0091] As described above, the multi-threaded request data integration method provided by the present invention first calls the online configuration component to obtain the associated party list, and instantiates the associated parties in the associated party list to form a single class object, that is, converts all the partner lists into objects in the client background, so that the user can send requests to the partners through the client, and then puts the single class object into the asynchronous thread pool to generate a list object of the asynchronous thread pool. By triggering the list object, the single class object interface of the asynchronous thread pool is called for asynchronous concurrency to form request data. Thus, by utilizing the parallel feature of the asynchronous thread pool, requests can be initiated simultaneously without serial waiting, greatly shortening the interface response time. Then, based on the circuit breaker mechanism, asynchronous response is performed on the request data to generate return data, and the return data is transmitted to the single class object interface. The circuit breaker mechanism can promptly eliminate requests with slow responses or exceptions, avoiding thread suspension caused by request congestion. Then, the online configuration component classifies and summarizes the return data at the single class object interface to form integrated data, and sends the integrated data to the client. The client can clearly understand the data returned by each single class object, facilitating comparison and selection, and can conveniently expand the partner interface, facilitating later maintenance.

[0092] As Figure 2 shown, the present invention provides a multi-threaded request data integration device 100, which can be installed in an electronic device. According to the implemented functions, the multi-threaded request data integration device 100 may include an object configuration unit 101, a list object generation unit 102, an asynchronous request unit 103, and a data integration unit 104. The modules in the present invention may also be referred to as units, which refer to a series of computer program segments that can be executed by the processor of the electronic device and can complete fixed functions, and are stored in the memory of the electronic device.

[0093] In this embodiment, the functions of each module / unit are as follows:

[0094] The object configuration unit 101 is used to call the online configuration component to obtain the associated party list, and instantiate all the associated parties in the associated party list to form a single class object; wherein, the single class object is the object corresponding to each associated party in the associated party list;

[0095] The list object generation unit 102 is used to put the single class object into the asynchronous thread pool to generate a list object of the asynchronous thread pool;

[0096] The asynchronous request unit 103 is used to call the single class object interface of the asynchronous thread pool for asynchronous concurrency to form request data by triggering the list object;

[0097] The data integration unit 104 is configured to asynchronously respond to the request data based on the fusing mechanism to generate return data, and transmit the return data to the single-class object interface, so that the online configuration component classifies and summarizes the return data at the single-class object interface to form integrated data, and sends the integrated data to the client.

[0098] As Figure 3 shown, the present invention provides an electronic device 1 capable of implementing a multi-threaded request data integration method.

[0099] The electronic device 1 may include a processor 10, a memory 11, and a bus, and may further include a computer program stored in the memory 11 and executable on the processor 10, such as a multi-threaded request data integration program 12.

[0100] Among them, the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (such as SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 11 may be an internal storage unit of the electronic device 1 in some embodiments, such as the mobile hard disk of the electronic device 1. The memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. equipped on the electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 can be used not only to store application software installed on the electronic device 1 and various types of data, such as the code of the multi-threaded request data integration program, but also to temporarily store data that has been output or will be output.

[0101] The processor 10 may be composed of integrated circuits in some embodiments. For example, it may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits with the same or different functions, including a combination of one or more Central Processing Units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 10 is the control core of the electronic device, connecting various components of the entire electronic device through various interfaces and lines, and by running or executing programs or modules stored in the memory 11 (such as the multi-threaded request data integration program, etc.), and calling data stored in the memory 11, to perform various functions of the electronic device 1 and process data.

[0102] The bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to enable connection communication between the memory 11 and at least one processor 10, etc.

[0103] Figure 3 Only the electronic device with components is shown. Those skilled in the art can understand that Figure 3 the shown structure does not constitute a limitation on the electronic device 1, and it may include fewer or more components than shown, or combine certain components, or have different component arrangements.

[0104] For example, although not shown, the electronic device 1 may further include a power source (such as a battery) for supplying power to each component. Preferably, the power source can be logically connected to the at least one processor 10 through a power management device, so as to implement functions such as charge management, discharge management, and power consumption management through the power management device. The power source may also include any components such as one or more DC or AC power sources, a recharge device, a power failure detection circuit, a power converter or inverter, and a power status indicator. The electronic device 1 may also include a variety of sensors, a Bluetooth module, a Wi-Fi module, etc., which will not be elaborated here.

[0105] Furthermore, the electronic device 1 may further include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device 1 and other electronic devices.

[0106] Optionally, the electronic device 1 may further include a user interface. The user interface may be a display, an input unit (such as a keyboard), and optionally, the user interface may also be a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch liquid crystal display, and an OLED (Organic Light-Emitting Diode) toucher, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display the information processed in the electronic device 1 and to display a visual user interface.

[0107] It should be understood that the above embodiments are only for illustration purposes and are not limited by this structure in the scope of the patent application.

[0108] The multi-threaded request data integration program 12 stored in the memory 11 in the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can achieve:

[0109] Call the online configuration component to obtain the related party list, and perform instantiation processing on all related parties in the related party list to form a single class object; wherein, the single class object is the object corresponding to each related party in the related party list;

[0110] Put the single class object into the asynchronous thread pool to generate a list object of the asynchronous thread pool;

[0111] By triggering the list object, call the single class object interface of the asynchronous thread pool for asynchronous concurrency to form request data;

[0112] Based on the fuse mechanism, perform asynchronous response on the request data to generate return data, and transmit the return data to the single class object interface, so that the online configuration component classifies and summarizes the return data at the single class object interface to form integrated data, and sends the integrated data to the client.

[0113] Furthermore, if the modules / units integrated in the electronic device 1 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM, Read-Only Memory).

[0114] In several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

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

[0116] In addition, in each embodiment of the present invention, the functional modules can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware, or in the form of hardware plus software functional modules.

[0117] It will be apparent to those skilled in the art that the present invention is not limited to the details of the above-described exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0118] Therefore, in all respects, the embodiments should be considered exemplary and non-limiting. The scope of the present invention is defined by the appended claims rather than the above description. Accordingly, all changes that fall within the meaning and scope of the equivalent elements of the claims are intended to be embraced within the present invention. Any reference signs in the claims should not be construed as limiting the claims involved.

[0119] In addition, it is obvious that the term "comprising" does not exclude other units or steps, and the singular does not exclude the plural. The multiple units or devices recited in the system claims can also be implemented by one unit or device through software or hardware. The terms such as "second" are used to denote names and do not denote any particular order.

[0120] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. A multi-threaded request data integration method, characterized in that, it includes: Call the online configuration component to obtain the related party list, and perform instantiation processing on all related parties in the related party list to form a single class object; wherein, the single class object is the object corresponding to each related party in the related party list; the process of calling the online configuration component to obtain the related party list and performing instantiation processing on all related parties in the related party list to form a single class object includes: the client background calls the online configuration component to obtain the related party list; use the factory pattern to classify each related party in the related party list to form a single class component; the factory pattern is a design pattern that generates parallel similar classes from a group of lists; create a single class name for the single class component, and convert the single class component into a format that can communicate data with the asynchronous thread pool to form a single class object; wherein, the channel for the single class object to communicate data with the asynchronous thread pool is the single class channel; Put the single class object into the asynchronous thread pool to generate a list object of the asynchronous thread pool; By triggering the list object, call the single class object interface of the asynchronous thread pool for asynchronous concurrency to form request data; before triggering the list object, it also includes: creating a trigger interface; connecting the trigger interface to the single class channel to form a single class object interface; and, the process of calling the single class object interface of the asynchronous thread pool for asynchronous concurrency to form request data by triggering the list object includes: the online configuration component transmits the destination request input by the client to the list object; the list object calls the asynchronous thread pool list for the destination request; judge whether the asynchronous thread pool list is consistent with the request list in the destination request; if consistent, transmit the destination request to the single class object interface at the same time; the single class object interface converts the destination request into destination data, and transmits the destination data to the single class object through the single class channel; Based on the circuit breaker mechanism, perform asynchronous response on the request data to generate return data, and transmit the return data to the single class object interface, so that the online configuration component classifies and summarizes the return data at the single class object interface to form integrated data, and transmits the integrated data to the client; wherein, the process of performing asynchronous response on the request data based on the circuit breaker mechanism to generate return data is: The single class object receives the destination data based on the circuit breaker mechanism and generates return data according to the destination data; wherein, the circuit breaker mechanism includes a circuit breaker time and a circuit breaker rule; The circuit breaker rule is: If the time for the destination data to reach the single class object is longer than the circuit breaker time and the single class object still does not respond to the destination data, the online configuration component interrupts the channel between the single class object and the destination data and sends null data to the online configuration component; The online configuration component transmits the null data to the client.

2. The multi-threaded request data integration method according to claim 1, characterized in that the process of putting the single-class object into the asynchronous thread pool to generate a list object of the asynchronous thread pool includes: establishing an empty list; putting the single-class object and the single-class channel into the asynchronous thread pool to form a thread pool object, and putting the asynchronous thread pool object into the empty list to form an asynchronous thread pool list; adding a category parameter to the asynchronous thread pool list to form a list object.

3. The multi-threaded request data integration method according to claim 2, characterized in that in the process of putting the asynchronous thread pool object into the empty list to form an asynchronous thread pool list, it further includes: setting a list response threshold; when adding the asynchronous thread pool object to the asynchronous thread pool list, if the addition time exceeds the list response threshold, the asynchronous thread pool list refuses to wait for the asynchronous thread pool object and sends an exception signal to the online configuration component.

4. The multi-threaded request data integration method according to claim 3, characterized in that if the online configuration component receives the exception signal, an exception handling component is used to perform exception handling; wherein, the process of the exception handling includes: the exception handling component identifies the exception signal; obtaining the asynchronous thread pool object corresponding to the exception signal; filtering out the asynchronous thread pool object corresponding to the exception signal in the asynchronous thread pool.

5. A multi-threaded request data integration device, characterized in that the device includes: an object configuration unit, configured to call an online configuration component to obtain a list of associated parties, and perform instantiation processing on all the associated parties in the list of associated parties to form a single-class object; wherein, the single-class object is an object corresponding to each associated party in the list of associated parties; the process of calling an online configuration component to obtain a list of associated parties and performing instantiation processing on all the associated parties in the list of associated parties includes: the client background calls the online configuration component to obtain a list of associated parties; using the factory pattern to classify each associated party in the list of associated parties to form a single-class component; the factory pattern is a design pattern for generating parallel similar classes from a group of lists; creating a single-class name for the single-class component, and converting the single-class component into a format capable of communicating data with the asynchronous thread pool to form a single-class object; wherein, the channel for the single-class object to communicate data with the asynchronous thread pool is a single-class channel; a list object generation unit, configured to put the single-class object into the asynchronous thread pool to generate a list object of the asynchronous thread pool; An asynchronous request unit, which is used to trigger the list object and call the single-class object interface of the asynchronous thread pool to perform asynchronous concurrency to form request data; before triggering the list object, it further includes: creating a trigger interface; connecting the trigger interface to the single-class channel to form a single-class object interface; and, the process of triggering the list object and calling the single-class object interface of the asynchronous thread pool to perform asynchronous concurrency to form request data includes: the online configuration component transmits the destination request input by the client to the list object; the list object calls the asynchronous thread pool list for the destination request; determines whether the asynchronous thread pool list is consistent with the request list in the destination request; if they are consistent, the destination request is simultaneously transmitted to the single-class object interface; the single-class object interface converts the destination request into destination data and transmits the destination data to the single-class object through the single-class channel; A data integration unit, which is used to perform asynchronous response to the request data based on a fusing mechanism to generate return data, and transmit the return data to the single-class object interface, so that the online configuration component classifies and summarizes the return data at the single-class object interface to form integrated data, and sends the integrated data to the client; among them, the process of performing asynchronous response to the request data based on the fusing mechanism to generate return data is: The single-class object receives the destination data based on the fusing mechanism and generates return data according to the destination data; among them, the fusing mechanism includes a fusing time and a fusing rule; The fusing rule is: If the time when the destination data arrives at the single-class object is longer than the fusing time and the single-class object still does not respond to the destination data, the online configuration component interrupts the channel between the single-class object and the destination data and sends null data to the online configuration component; The online configuration component transmits the null data to the client.

6. An electronic device, characterized in that, the electronic device includes: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the steps in the multi-threaded request data integration method according to any one of claims 1 to 4.

7. A computer-readable storage medium storing a computer program, characterized in that, the computer program, when executed by a processor, implements the multi-threaded request data integration method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Jedis-based method for combination and batch submission of multi-thread concurrent requests and distribution of results

    CN108073414A

  • Request processing method and device, electronic equipment and medium

    CN111796936A