To-be-processed transaction processing method and system, electronic equipment and storage medium
By unlocking and locking processing threads in software development, the problem of pending transaction processing exceptions is solved, ensuring the normal processing and efficiency of each transaction are improved.
Patent Information
- Application Number
- CN202411127059.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-11-12
AI Technical Summary
During software development, multiple pending transactions have dependencies. If the next transaction is started during processing one transaction, it may lead to abnormal, confusing or failure in processing.
Ensure normal processing of each pending transaction is ensured by unlocking the processing thread after receiving the end processing instruction when processing the current pending transaction and locking the processing thread when processing the next pending transaction to avoid the impact of other pending transactions.
It effectively avoids the mess or failure of pending transactions, improves processing efficiency, and saves the processing time between serial pending transactions.
Smart Images

Figure CN118939385A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software, and in particular to a method, system, electronic device and storage medium for processing pending transactions. Background Art
[0002] In the current software development process, there are corresponding dependencies among multiple pending transactions. If the next pending transaction is processed at the same time as the current pending transaction, the next pending transaction may be processed before the current pending transaction is completed because the next transaction depends on the current pending transaction. This will cause the two pending transactions to be processed abnormally, resulting in processing confusion or failure. Summary of the invention
[0003] In view of the above problems, the present application provides a method, system, electronic device and storage medium for processing pending transactions, which are used to lock the processing thread when processing each pending transaction to ensure normal processing of each pending transaction.
[0004] According to one aspect of the present application, a method for processing pending transactions is provided, the method comprising: when processing a current pending transaction, if an end processing instruction is received, unlocking the processing thread to end processing of the current pending transaction, and when processing the next pending transaction, locking the processing thread to avoid the influence of other pending transactions; wherein the current pending transaction and the next pending transaction are in an adjacent serial relationship.
[0005] In an optional manner, the unlocking operation on the processing thread further includes: inputting the lock data corresponding to the processing thread into a designated lock queue to complete the unlocking operation on the processing thread; wherein the container size of the designated lock queue is the same as the size of the lock data, and the lock data is fixed data used to lock or unlock the processing thread.
[0006] In an optional manner, locking the processing thread further includes: taking out lock data from a designated lock queue so that the lock queue is in an empty state, so that the processing thread is in a locked state; wherein the container size of the designated lock queue is the same as the size of the lock data, and the lock data is fixed data used to lock or unlock the processing thread.
[0007] In an optional manner, the processing method also includes: if the current pending transaction is the last pending transaction in the serial pending transaction queue, then upon receiving the end processing instruction or completing the processing of the current pending transaction, unlocking the processing thread; wherein, each pending transaction in the serial pending transaction queue is in a serial relationship.
[0008] In an optional manner, the processing method also includes: encapsulating corresponding transaction types and transaction objects according to a preset encapsulation method to obtain multiple encapsulated transactions; sending the multiple encapsulated transactions to the serial pending transaction queue as pending transactions in the serial pending transaction queue in the serial pending transaction queue.
[0009] According to another aspect of the present application, a system for processing pending transactions is provided, the processing system comprising: a processing module, for terminating the processing of the current pending transaction if an end processing instruction is received when processing the current pending transaction; a loop detection module, for unlocking the processing thread to terminate the processing of the current pending transaction if the processing module receives the end processing instruction when processing the current pending transaction, and locking the processing thread to avoid the influence of other pending transactions when processing the next pending transaction; wherein the current pending transaction and the next pending transaction are in an adjacent serial relationship.
[0010] According to another aspect of the present application, a processing device for pending transactions is provided, the processing device comprising: an unlocking module, for unlocking a processing thread when processing a current pending transaction, if an end processing instruction is received, to end processing of the current pending transaction, and for locking the processing thread when processing a next pending transaction, to avoid the influence of other pending transactions; wherein the current pending transaction and the next pending transaction are in an adjacent serial relationship.
[0011] According to one aspect of the present application, an electronic device is provided, including: a controller; and a memory for storing one or more programs, wherein when the one or more programs are executed by the controller, the above-mentioned processing method is executed.
[0012] According to one aspect of the present application, a computer-readable storage medium is also provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the above-mentioned processing method.
[0013] According to one aspect of the present application, a computer program product or a computer program is also provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above-mentioned processing method.
[0014] The present application locks the processing thread when processing each pending transaction, avoiding the influence of other pending transactions, avoiding the occurrence of confusion and failure in the processing of pending transactions, and thus ensuring the normal processing of each pending transaction. When receiving the end processing instruction, the present application can directly end the processing of the current pending transaction and unlock the processing thread, without waiting for the current pending transaction to be processed before processing the next pending transaction, saving the processing time between serial pending transactions, thereby improving processing efficiency.
[0015] The above description is only an overview of the technical solution of the embodiment of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0017] Figure 1 It is a flowchart of a method for processing a pending transaction shown in an exemplary embodiment of the present application.
[0018] Figure 2 is based on Figure 1 The exemplary embodiment shown is a flowchart of another method for processing a transaction to be processed.
[0019] Figure 3 is based on Figure 1 The exemplary embodiment shown is a flowchart of another method for processing a transaction to be processed.
[0020] Figure 4 It is a structural diagram of a system for processing transactions to be processed, shown as an exemplary embodiment of the present application.
[0021] Figure 5 It is a schematic diagram of a processing flow in a processing system for a transaction to be processed, shown in a preferred embodiment of the present application.
[0022] Figure 6 It is a structural diagram of a processing device for a transaction to be processed shown in an exemplary embodiment of the present application.
[0023] Figure 7 It is a structural diagram of a computer system of an electronic device shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0024] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
[0025] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0026] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0027] The term "multiple" as used in this application refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.
[0028] In the existing software development process, there are corresponding dependencies among multiple pending transactions. If the next pending transaction is processed at the same time as the current pending transaction, the next pending transaction may be processed before the current pending transaction is completed because the next transaction depends on the current pending transaction. This will cause the two pending transactions to be processed abnormally, resulting in processing confusion or failure.
[0029] To this end, one aspect of the present application provides a method for processing pending transactions. Figure 1 , Figure 1 1 is a flowchart of a method for processing a pending transaction shown in an exemplary embodiment of the present application. The processing method at least includes S110, which is described in detail as follows:
[0030] S110: When processing the current pending transaction, if an end processing instruction is received, the processing thread is unlocked to end the processing of the current pending transaction, and when processing the next pending transaction, the processing thread is locked to avoid the influence of other pending transactions; wherein the current pending transaction and the next pending transaction are in an adjacent serial relationship.
[0031] The pending transactions are transactions that need to be processed urgently, for example, transactions that are time-consuming to process. In this embodiment, the number of pending transactions is multiple, and this embodiment does not limit the specific number. In this embodiment, adjacent pending transactions are in a serial relationship, and the processing order of the two is closely connected, not in a parallel processing relationship.
[0032] For the routine processing of pending transactions, the CPU usually schedules thread resources for processing. Even if an end processing instruction is received, it is necessary to wait until the current pending transaction is completed before processing the next pending transaction. That is, transaction processing is not stopped immediately. However, the present application can stop processing the current pending transaction in time, reducing unnecessary transaction processing time and thus improving processing efficiency.
[0033] It is worth noting that when processing each pending transaction, this embodiment will lock the processing thread to avoid the influence of other pending transactions, thereby ensuring the normal processing of the pending transaction being processed, thereby avoiding the occurrence of confusion, failure, etc. in the processing of the pending transaction. At the same time, when the processing of the pending transaction is finished, this embodiment unlocks the processing thread to facilitate the processing flow of the next pending transaction.
[0034] This embodiment locks the processing thread when processing each pending transaction, avoiding the influence of other pending transactions, avoiding the occurrence of confusion, failure, etc. in the processing of pending transactions, thereby ensuring the normal processing of each pending transaction. When receiving the end processing instruction, this embodiment can directly end the processing of the current pending transaction and unlock the processing thread, without waiting for the current pending transaction to be processed before processing the next pending transaction, saving the processing time between serial pending transactions, thereby improving processing efficiency.
[0035] In another exemplary embodiment of the present application, how to unlock the processing thread is described in detail. Figure 2 , Figure 2 is based on Figure 1 The exemplary embodiment shown is a flow chart of another method for processing a pending transaction. Figure 1 The S110 shown further includes S210, which is described in detail as follows:
[0036] S210: inputting the lock data corresponding to the processing thread into the designated lock queue to complete the unlocking operation on the processing thread; wherein the container size of the designated lock queue is the same as the size of the lock data, and the lock data is fixed data used to lock or unlock the processing thread.
[0037] Because the size of the lock data is the same as the container size of the lock queue, and the lock data is fixed, when the lock data is in the lock queue, the lock queue is full of data, and the processing thread is in an unlocked state; when the lock data does not exist in the lock queue, the lock queue is empty, and the processing thread is in a locked state.
[0038] This embodiment unlocks the processing thread by inputting the lock data into the lock queue. For example, lockQueue (lock queue) is unlocked by combining the put method (lockQueue.put()), the container size of lockQueue can be set to 1, and the size of the lock data is also 1. When the container of lockQueue is full (i.e., the lock data is placed in lockQueue), the processing thread is in the unlocked state.
[0039] Accordingly, the lock data is taken out from the designated lock queue, so that the lock queue is in an empty state, so that the processing thread is in a locked state; wherein the container size of the designated lock queue is the same as the size of the lock data, and the lock data is fixed data used to lock or unlock the processing thread.
[0040] When lockQueue has lock data (the processing thread is in unlocked state), the take method (lockQueue.take()) can take the lock data out of it to apply for a lock to lock the processing thread, thereby blocking other pending transactions.
[0041] For example, when the current pending transaction is completed, lockQueue.put() is called to unlock the processing thread, and when processing the next pending transaction, lockQueue.take() blocks the processing thread to lock the processing thread to ensure the smooth processing of the next pending transaction, and realize the serial processing between pending transactions. Among them, both locking and unlocking methods can be implemented by code, which is more lightweight. At the same time, the application and release of the lock are determined by the pending business, without waiting for CPU scheduling, making it more scalable.
[0042] In another exemplary embodiment of the present application, the prerequisite for unlocking the processing thread in the process of processing the current pending transaction is described in detail, that is, based on Figure 1 The processing method shown in the figure, the processing method of this embodiment further includes S120, which is described in detail as follows:
[0043] S120: If the current pending transaction is the last pending transaction in the serial pending transaction queue, unlocking the processing thread is performed when an end processing instruction is received or the current pending transaction is completed; wherein the pending transactions in the serial pending transaction queue are in a serial relationship.
[0044] In the process of processing the current pending transaction in this embodiment, there are two prerequisites for unlocking the processing thread: one is that the current pending transaction is processed, and the other is that an end processing instruction is received.
[0045] If it is the first condition, that is, when all pending transactions are processed, the processing thread is unlocked, and a prompt is given that all pending transactions in the serial pending transaction queue have been processed. Among them, the serial pending transaction queue is a queue for storing pending transactions, which is similar to a container, and its capacity can be adjusted to adjust the storage resources corresponding to the pending transactions. The management mode of pending transactions in the serial pending transaction queue is "first in, first out", that is, the pending transactions first stored in the serial pending transaction queue are output from the transaction queue first. It can be seen that the processing order corresponding to each pending transaction has been determined when it is stored in the transaction queue, and there is a serial relationship between each pending transaction.
[0046] According to the first-in-first-out management mode of the transaction queue, the pending transaction first stored in the serial pending transaction queue is processed, and each pending transaction is processed in sequence, and the processing thread is locked when processing each pending transaction until all pending transactions are processed, thereby ensuring the normal processing of each pending transaction and achieving the purpose of serial processing of multiple pending transactions. Among them, the serial processing order is the order in which the serial pending transaction queue outputs the pending transactions.
[0047] In the existing processing of multiple pending transactions, one pending transaction needs to be completely processed before the next pending transaction can be processed. However, in the process of processing the current pending transaction, if an end instruction is recognized, the processing of the current pending transaction is ended and the processing thread is unlocked in time.
[0048] This embodiment flexibly adjusts the processing time and processing degree of each pending transaction through the end instruction, and can end the processing of the corresponding pending transaction in advance. There is no need to wait for the entire pending transaction to be processed before processing the next pending transaction, thereby ensuring the smooth processing of the next pending transaction.
[0049] Further, in another exemplary embodiment of the present application, the origin of pending transactions in the serial pending transaction queue is described in detail. Figure 3 , Figure 3 is based on Figure 1The exemplary embodiment shown is a flow chart of another method for processing a pending transaction. Figure 1 Before S110 shown, it also includes S310 to S320, which are described in detail as follows:
[0050] S310: Encapsulate corresponding transaction types and transaction objects according to a preset encapsulation method to obtain multiple encapsulated transactions.
[0051] The preset encapsulation method may be to call a preset encapsulation function or method to perform transaction encapsulation, so that each encapsulated transaction includes a transaction type (transactionType) and a transaction object (transactionInvoker).
[0052] S320: Send the multiple encapsulated transactions to the serial pending transaction queue to serve as pending transactions in a serial relationship in the serial pending transaction queue.
[0053] For example, encapsulated transactions transaction1, transaction2...transactionN are sent to the serial pending transaction queue in sequence as corresponding pending transactions. According to the first-in-first-out management mode of the serial pending transaction queue, the processing order of the pending transactions is transaction1, transaction2...transactionN. The serial pending transaction queue (transactionQueue) can be implemented with LinkedBlockingQueue, and the container size defaults to Integer.MAX_VALUE.
[0054] This embodiment further illustrates that pending transactions are composed of at least a transaction type and a transaction object, and according to the first-in-first-out management mode of the serial pending transaction queue, the processing order of the corresponding pending transactions is determined when each encapsulated transaction enters the serial pending transaction queue.
[0055] One aspect of the present application provides a system for processing pending transactions, including a processing module and a loop detection module, which are described in detail as follows:
[0056] The processing module is used to end the processing of the current pending transaction if an end processing instruction is received while processing the current pending transaction. After processing a pending transaction, the processing thread will be unlocked to facilitate the processing of the next pending transaction. The processing module can be a defined HandlerThread, which is used to consume all pending transactions. This pending transaction is a time-consuming operation and does not involve UI operations. MainHandler is generally used, but time-consuming operations will cause ANR. This pending transaction processing is only performed for time-consuming operations.
[0057] In some embodiments, the processing system also includes: a production module, which is used to encapsulate the corresponding transaction type and transaction object according to a preset encapsulation method to obtain multiple encapsulated transactions, and send the multiple encapsulated transactions to the serial pending transaction queue as pending transactions in a serial relationship in the serial pending transaction queue.
[0058] The loop detection module is used to unlock the processing thread when processing the current pending transaction, if the processing module receives an end processing instruction, so as to end the processing of the current pending transaction, and lock the processing thread when processing the next pending transaction to avoid the influence of other pending transactions; wherein the current pending transaction and the next pending transaction are in an adjacent serial relationship.
[0059] In some embodiments, the loop detection module is further used to send each pending transaction to the processing module for processing when detecting that there are pending transactions in the serial pending transaction queue, and lock the processing thread when the processing module processes each pending transaction.
[0060] Specifically, the loop detection module is a defined child thread, which contains a while(true) loop to loop and detect whether there are pending transactions in the transactionQueue (serial pending transaction queue); if there are, the first pending transaction data will be taken out from the transactionQueue, and the transaction1 transaction will be sent to the child thread to perform operations through the transactionHandler event driver, which may take some time, and call lockQueue.take() to block the current thread, which means that the transaction1 transaction processing has applied for a lock and is still executing tasks. Other transactions cannot be dispatched to achieve the locking of the processing thread. Until the transaction1 transaction is processed, the lock is released (lockQueue.put(new Object)). If there are still pending transactions in the transactionQueue, the next pending transaction will be processed similarly. If there are no pending transactions in the transactionQueue, it will be blocked until a new pending transaction is generated.
[0061] The unlocking and locking methods of this embodiment are both implemented by code, which is different from the system-level lock (Synchronized) and has the following advantages:
[0062] (1) More lightweight and completely controlled by code.
[0063] (2) Stronger scalability: lock application and release are determined by the business, without waiting for CPU scheduling.
[0064] In another exemplary embodiment, please refer to Figure 4 , Figure 4 This is a structural diagram of a processing system for pending transactions shown in an exemplary embodiment of the present application. Among them, Looper is a loop detection module; Handler is a processing module; Producer is a production module, which is used to encapsulate the corresponding transaction type and transaction object according to a preset encapsulation method to obtain multiple encapsulated transactions, and send the multiple encapsulated transactions to the transaction queue as pending transactions in the transaction queue.
[0065] Specifically, the beginTransaction method is called to push the encapsulated transaction into the transaction queue to form a pending transaction in the transaction queue, wherein each pending transaction is composed of at least a transaction type and a transaction object.
[0066] Looper dispatches pending transactions to Handler in sequence, and Handler consumes and processes pending transactions. For example, after transaction1 is processed, the endTransaction method is called to notify Looper that transaction1 has been processed and release the lock, waiting for Looper to dispatch the next pending transaction. Looper will poll the transactionQueue until all pending transactions are processed and blocked.
[0067] In another exemplary embodiment, the processing module is also used to end the processing of the current pending transaction if an end instruction is recognized, so that the loop detection module unlocks the processing thread according to a preset unlocking method, and locks the processing thread according to a preset locking method when sending the next pending transaction.
[0068] See also Figure 5 , Figure 5 FIG. 1 is a schematic diagram of a processing flow in a processing system for a transaction to be processed, shown in a preferred embodiment of the present application. Figure 5 As shown in the figure, the end transaction in the producer can send the corresponding end instruction to the Handler. When the Handler recognizes the end instruction, it ends the processing of the current pending transaction. The Looper releases the lock to unlock the processing thread and processes the next pending transaction. It is not necessary to completely process a pending transaction before processing the next pending transaction, which improves flexibility.
[0069] At the same time, the processing order of pending transactions can be determined by the producer. Based on the first-in-first-out principle of the transaction queue, the pending transactions produced first will be processed first.
[0070] The introduction of beginning a transaction (beginTransaction) and ending a transaction (endTransaction) is as follows:
[0071] The beginTransaction method contains two parameters, the first is the transaction type (transactionType), int, and the second is the transaction object (transactionInvoker), which can cache transactions in the form of an interface. The internal implementation is to cache the transactionInvoker object in the transactionQueue.
[0072] The endTransaction method contains a parameter, which is the transaction type (transactionType). The internal implementation is to cache an object in the lockQueue to represent the release of resource locks, unblock the current thread, and wait for the next pending transaction to be processed. Calling this method can end the current pending transaction in advance. The timing of ending the pending transaction is determined by the business.
[0073] Another aspect of the present application also provides a processing device for a transaction to be processed, such as Figure 6 As shown, Figure 6 It is a structural diagram of a processing device for a transaction to be processed shown in an exemplary embodiment of the present application.
[0074] The processing device 600 includes:
[0075] The unlocking module 610 is used to unlock the processing thread when processing the current pending transaction and to end the processing of the current pending transaction if an end processing instruction is received, and to lock the processing thread when processing the next pending transaction to avoid the influence of other pending transactions; wherein the current pending transaction and the next pending transaction are in an adjacent serial relationship.
[0076] In another exemplary embodiment, the unlocking module 610 further includes:
[0077] The unlocking unit is used to input the lock data corresponding to the processing thread into the specified lock queue to complete the unlocking operation on the processing thread; wherein the container size of the specified lock queue is the same as the size of the lock data, and the lock data is fixed data used to lock or unlock the processing thread.
[0078] In another exemplary embodiment, the unlocking module 610 further includes:
[0079] The locking unit is used to take out lock data from the specified lock queue, so that the lock queue is in an empty state, so that the processing thread is in a locked state; wherein the container size of the specified lock queue is the same as the size of the lock data, and the lock data is fixed data used to lock or unlock the processing thread.
[0080] In another exemplary embodiment, the processing device 600 further includes:
[0081] The end processing module is used to unlock the processing thread when receiving the end processing instruction or completing the processing of the current pending transaction if the current pending transaction is the last pending transaction in the serial pending transaction queue; wherein the pending transactions in the serial pending transaction queue are in a serial relationship.
[0082] In another exemplary embodiment, the processing device 600 further includes:
[0083] The encapsulation module is used to encapsulate the corresponding transaction type and transaction object according to a preset encapsulation method to obtain multiple encapsulated transactions.
[0084] The sending module is used to send multiple encapsulated transactions to the serial pending transaction queue as pending transactions in a serial relationship in the serial pending transaction queue.
[0085] The processing device of the present application locks the processing thread when processing each pending transaction, avoiding the influence of other pending transactions, so as to avoid the occurrence of confusion and failure in the processing of pending transactions, thereby ensuring the normal processing of each pending transaction. When receiving the end processing instruction, the present application can directly end the processing of the current pending transaction and unlock the processing thread, without waiting for the current pending transaction to be processed before processing the next pending transaction, saving the processing time between serial pending transactions, thereby improving processing efficiency.
[0086] It should be noted that the processing device provided in the above embodiment and the processing method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment and will not be repeated here.
[0087] Another aspect of the present application provides an electronic device, including: a controller; a memory for storing one or more programs, and when the one or more programs are executed by the controller, the above-mentioned processing method is executed.
[0088] See also Figure 7 , Figure 7 1 is a schematic diagram of the structure of a computer system of an electronic device shown in an exemplary embodiment of the present application, which shows a schematic diagram of the structure of a computer system of an electronic device suitable for implementing an embodiment of the present application.
[0089] It should be noted that Figure 7 The computer system 700 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0090] like Figure 7 As 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 part 708 to the random access memory (RAM) 703, such as executing the method in the above embodiment. In the RAM 703, various programs and data required for system operation are also stored. The CPU 701, ROM 702 and RAM 703 are connected to each other through a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0091] 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 (Local Area Network) 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 needed. 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 needed so that a computer program read therefrom is installed into the storage section 708 as needed.
[0092] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 709, and / or installed from a removable medium 711. When the computer program is executed by a central processing unit (CPU) 701, various functions defined in the system of the present application are executed.
[0093] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media 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), a 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 application, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium can include a data signal propagated in a baseband or as a part of a carrier wave, wherein a computer-readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0094] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0095] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0096] Another aspect of the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the processing method as described above is implemented. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.
[0097] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the processing method provided in each of the above embodiments.
[0098] According to one aspect of an embodiment of the present application, a computer system is also provided, including a central processing unit (CPU), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) or a program loaded from a storage portion into a random access memory (RAM), such as executing the method in the above embodiment. In RAM, various programs and data required for system operation are also stored. CPU, ROM and RAM are connected to each other via a bus. An input / output (I / O) interface is also connected to the bus.
[0099] The following components are connected to the I / O interface: an input part including a keyboard, a mouse, etc.; an output part including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage part including a hard disk, etc.; and a communication part including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication part performs communication processing via a network such as the Internet. A drive is also connected to the I / O interface as needed. Removable media, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., are installed on the drive as needed so that the computer program read therefrom is installed into the storage part as needed.
[0100] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.
Claims
1. A method for processing pending transactions, characterized in that: The processing method comprises: When processing the current pending transaction, if an end processing instruction is received, the processing thread is unlocked to end processing of the current pending transaction, and when processing the next pending transaction, the processing thread is locked to avoid the influence of other pending transactions; wherein the current pending transaction and the next pending transaction are in an adjacent serial relationship.
2. The processing method according to claim 1, characterized in that: The unlocking operation on the processing thread further includes: The lock data corresponding to the processing thread is input into the designated lock queue to complete the unlocking operation on the processing thread; wherein the container size of the designated lock queue is the same as the size of the lock data, and the lock data is fixed data used to lock or unlock the processing thread.
3. The processing method according to claim 1, characterized in that: The locking of the processing thread further comprises: Lock data is taken out from a designated lock queue, so that the lock queue is in an empty state, so that the processing thread is in a locked state; wherein the container size of the designated lock queue is the same as the size of the lock data, and the lock data is fixed data used to perform locking or unlocking operations on the processing thread.
4. The processing method according to claim 1, characterized in that: The processing method also includes: If the current pending transaction is the last pending transaction in the serial pending transaction queue, the processing thread is unlocked when the end processing instruction is received or the current pending transaction is completed; wherein the pending transactions in the serial pending transaction queue are in a serial relationship.
5. The processing method according to claim 4, characterized in that: The processing method also includes: Encapsulate corresponding transaction types and transaction objects according to a preset encapsulation method to obtain multiple encapsulated transactions; The multiple encapsulated transactions are sent to the serial pending transaction queue to serve as pending transactions in the serial pending transaction queue in the serial pending transaction queue.
6. A system for processing pending transactions, characterized in that: The processing system comprises: A processing module, configured to terminate the processing of a current pending transaction if an end processing instruction is received during the processing of the current pending transaction; A loop detection module is used to unlock the processing thread when processing the current pending transaction, if the processing module receives the end processing instruction, so as to end the processing of the current pending transaction, and lock the processing thread when processing the next pending transaction to avoid the influence of other pending transactions; wherein the current pending transaction and the next pending transaction are in an adjacent serial relationship.
7. The processing system according to claim 6, characterized in that The processing system further comprises: The production module is used to encapsulate the corresponding transaction type and transaction object according to a preset encapsulation method to obtain multiple encapsulated transactions, and send the multiple encapsulated transactions to a serial pending transaction queue as pending transactions in a serial relationship in the serial pending transaction queue.
8. The processing system according to claim 6, characterized in that The cycle detection module is also used to send each pending transaction to the processing module for processing when detecting that there are pending transactions in the serial pending transaction queue, and lock the processing thread when the processing module processes each pending transaction.
9. An electronic device, characterized in that: include: Controller; A memory for storing one or more programs, which, when executed by a controller, enables the controller to implement the processing method described in any one of claims 1 to 5.
10. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processing module of a computer, the computer is caused to execute the processing method described in any one of claims 1 to 5.
