Distributed transaction processing method and device, electronic equipment and storage medium
By using AOP and reflection mechanisms to obtain pointcuts in distributed systems and adding custom annotations to handle transaction requirements, the problem of poor synchronization in transaction processing in distributed systems is solved, achieving flexible and efficient transaction processing.
Patent Information
- Application Number
- CN202410920779.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-11-12
AI Technical Summary
In distributed systems, existing technologies cannot effectively handle newly emerging transaction requirements, resulting in poor transaction processing synchronization.
The system entry point is obtained by using AOP aspect principle and reflection mechanism. Transaction processing methods are added to the interface by adding custom annotations to achieve flexible handling of new transaction requirements.
It improves the timeliness and adaptability of transaction processing, enabling real-time changes in transaction processing methods based on business needs, and achieving synchronous processing of new transaction requirements.
Smart Images

Figure CN118939383A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a method, device, electronic device and storage medium for distributed transaction processing. Background Art
[0002] With the rapid development of the Internet in the past decade, the number of visits to many hot websites has increased. The centralized environment can no longer meet business needs. Data can only be split according to business units, and services can only be provided according to business units, transforming from early centralized systems to distributed systems with service-oriented architectures. Distributed systems involve the processing of distributed transactions. In the current existing technologies, new transaction requirements that arise during transaction processing cannot be effectively processed synchronously. Summary of the invention
[0003] In view of this, embodiments of the present application provide a method, apparatus, electronic device, and storage medium for distributed transaction processing, aiming to achieve effective synchronous processing of newly emerging transaction requirements during the transaction processing process.
[0004] In a first aspect, an embodiment of the present application provides a method for distributed transaction processing, the method comprising:
[0005] Acquire a first method and interface information of a transaction to be added by the application system, wherein the first method is an original method of the transaction to be added;
[0006] In response to the distributed transaction processing request, adding a second transaction processing method during the execution of the first method based on the interface information, wherein the second method is used to process new transaction requirements arising during the execution of the first method;
[0007] Distributed transaction processing is performed according to the second method.
[0008] Optionally, the first method and interface information of obtaining the transaction processing to be added by the application system include:
[0009] Use AOP aspect principles to insert aspect entry points when the application system is executed;
[0010] The first method of the transaction processing to be added and the interface information of the application system are acquired based on the entry point.
[0011] Optionally, the second method of adding transaction processing during the execution of the first method based on the interface information includes:
[0012] Determining a type of the distributed transaction processing request;
[0013] determining a second method of transaction processing based on the type;
[0014] The second method is added to the corresponding interface position in the form of a mark based on the interface information.
[0015] Optionally, adding the second method to the corresponding interface position in a marked form based on the interface information includes:
[0016] Creating a marking plug-in and a section plug-in, wherein the section plug-in has a corresponding relationship with the interface position;
[0017] Marking the control method based on the marking plug-in and sending it to the aspect plug-in;
[0018] The marked second method is added to the corresponding interface position using the aspect plug-in based on the interface information.
[0019] Optionally, marking the second method based on the marking plug-in includes:
[0020] Get the type of the second method;
[0021] Determine a target marking parameter according to the type of the second method, wherein the target marking parameter has a corresponding relationship with the type;
[0022] The second method is marked based on the marking plug-in using the target marking parameter.
[0023] Optionally, performing distributed transaction processing according to the second method includes:
[0024] detecting the target marking parameter marked by the second method;
[0025] Determine, based on the detection result, an operation to be performed corresponding to the type of the second method;
[0026] Execute the operations to be executed to perform distributed transaction processing.
[0027] Optionally, the first method or interface information of obtaining the transaction processing to be added by the application system includes:
[0028] Use AOP aspect principles to insert aspect entry points when the application system is executed;
[0029] A first method for obtaining the interface information and the transaction processing to be added by the application system through a reflection mechanism based on the entry point, wherein the reflection mechanism is used to access and obtain the information in the entry point.
[0030] In a second aspect, an embodiment of the present application provides a distributed transaction processing device, the device comprising: an acquisition module, an addition module and a processing module;
[0031] The acquisition module is used to acquire a first method and interface information of a transaction processing to be added by the application system, wherein the first method is an original method of the transaction processing to be added;
[0032] The adding module is used to, in response to a distributed transaction processing request, add a second transaction processing method during the execution of the first method based on the interface information, wherein the second method is used to process new transaction requirements arising during the execution of the first method;
[0033] The processing module is used to perform distributed transaction processing according to the second method.
[0034] In a third aspect, the present application provides an electronic device, the device comprising: a processor, a memory, and a system bus;
[0035] The processor and the memory are connected via the system bus;
[0036] The memory is used to store one or more programs, and the one or more programs include instructions, which, when executed by the processor, enable the processor to execute the method described in the first aspect.
[0037] In a fourth aspect, an embodiment of the present application provides a computer storage medium, in which a code is stored. When the code is executed, a device executing the code implements any method described in the first aspect.
[0038] The present application provides a method, device, electronic device and storage medium for distributed transaction processing. When executing the method, first obtain the first method and interface information of the transaction processing to be added to the application system, the first method is the original method of the transaction processing to be added, and then respond to the distributed transaction processing request, add the second method of transaction processing based on the interface information during the execution of the first method, and the second method is used to process the new transaction requirements that appear during the execution of the first method. Finally, distributed transaction processing is performed according to the second method. In this way, by using AOP to cut into the system and obtain relevant information at the entry point, business personnel can flexibly cut into the system according to needs and obtain data at the specified entry point, which has flexibility and adaptability. At the same time, the second method can be added to the interface position in the form of a tag, which can realize the real-time change of the transaction processing method according to business needs, which can improve the timeliness and adaptability of transaction processing, and the change method is convenient and easy for users to operate, so that the new transaction requirements can be synchronously and effectively processed during the transaction processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in this embodiment or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0040] Figure 1 A flowchart of a distributed transaction processing method provided in an embodiment of the present application;
[0041] Figure 2 A flowchart of a method for adding a transaction processing provided in an embodiment of the present application;
[0042] Figure 3 A schematic diagram of the structure of a distributed transaction processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0044] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0045] In the study of related technologies, it was found that distributed systems involve the processing of distributed transactions. In the current existing technologies, new transaction requirements that arise during the transaction processing process cannot be effectively processed synchronously.
[0046] Based on this, the present application proposes a method, device, electronic device and storage medium for distributed transaction processing. It can adopt reflection and AOP principles to horizontally cut into the target interface or method in the target system to achieve seamless business operations, and adopt custom annotations to allow users to achieve transaction control more concisely and quickly, and can freely switch the required mode in a complex business system, and can achieve synchronous and effective processing of new transaction requirements during transaction processing.
[0047] The method, device, electronic device and storage medium for distributed transaction processing provided by the present invention can be used in the financial field or other fields, for example, it can be used in application scenarios where workers in the financial field process distributed transactions. Other fields are any fields other than the financial field, for example, the field of big data. The above is only an example and does not limit the application field of the method, device, electronic device and storage medium for distributed transaction processing provided by the present invention.
[0048] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0049] Figure 1 A flowchart of a distributed transaction processing method provided in an embodiment of the present application is provided in Figure 1 As shown, a distributed transaction processing method provided by an embodiment of the present application includes:
[0050] S11: Acquire a first method and interface information of a transaction processing to be added by the application system, wherein the first method is an original method of the transaction processing to be added.
[0051] Step S11 mentions "obtaining the first method and interface information of transaction processing to be added to the application system". The specific acquisition method may include: first using the AOP aspect principle to insert the aspect entry point when the application system is executed, and then obtaining the first method and interface information of the transaction processing to be added to the application system based on the entry point.
[0052] The AOP mentioned above is the abbreviation of Aspect Oriented Programming, which means aspect-oriented programming. It is a technology that implements unified maintenance of program functions through pre-compilation and dynamic proxy during runtime. In OOP, we use classes as the basic unit, while in AOP, the basic unit is the aspect. AOP is an extension of OOP. It separates some cross-cutting logic (such as logging, security, etc.) from business logic, and inserts it into the object when needed to change its original behavior. In an embodiment of the present application, AOP is used to obtain the entry point of the system that needs to execute distributed transactions, and based on the entry point, the transaction processing method to be added and the corresponding interface information can be obtained.
[0053] Through the acquisition method mentioned above, by using AOP to cut into the system and obtain relevant information at the entry point, the entry method enables business personnel to flexibly cut into the system according to needs and obtain data at the specified entry point, which is flexible and adaptable.
[0054] Regarding the "obtaining the first method and interface information of the transaction processing to be added to the application system" mentioned in step S11, the specific acquisition method may also include: firstly, using the AOP aspect principle to insert the aspect entry point when the application system is executed. Then, based on the entry point, the interface information and the first method of the transaction processing control to be added to the application system are obtained through a reflection mechanism, and the reflection mechanism is used to access and obtain the information in the entry point.
[0055] In the embodiment of the present application, the transaction processing method can be implemented based on Java. The purpose of the reflection mechanism mentioned above is to access and obtain the information in the entry point. The reflection mechanism can give the program the ability to introspect (official terminology) at runtime. Through the reflection mechanism, we can directly operate the class or object in the transaction processing method, such as obtaining the class definition of an object, obtaining the properties and methods declared by the class, calling methods or constructing objects, and even modifying the class definition at runtime. In the embodiment of the present application, by using the reflection mechanism, the information in the entry point can be accessed and obtained. The information obtained can be the information of the class or object of the program corresponding to the transaction processing method, and can also include but is not limited to the following information: the method name, number and type of parameters, return value, etc. on the corresponding interface method.
[0056] The acquisition method mentioned above can access and acquire the information in the entry point based on the AOP aspect principle and reflection mechanism, and can also acquire the information of the program class or object corresponding to the transaction processing method, so that the transaction processing method can be directly operated and changed later.
[0057] S12: In response to the distributed transaction processing request, a second transaction processing method is added during the execution of the first method based on the interface information, where the second method is a method for processing new transaction requirements arising during the execution of the first method.
[0058] Step S12 mentions "adding a second method of transaction processing during the execution of the first method based on the interface information". Figure 2 A flowchart of a transaction processing method provided in an embodiment of the present application is shown in FIG. Figure 2 The method specifically includes:
[0059] S121: Determine the type of the distributed transaction processing request.
[0060] The types of distributed transaction processing requests may include, but are not limited to, the following: transactions requiring consistency, transactions requiring high availability, etc. In addition, there are other types of transactions that can also apply the distributed transaction processing method provided in the embodiments of the present application.
[0061] S122: Determine a second transaction processing method based on the type.
[0062] Specifically, taking the transactions requiring consistency and high availability as examples, for businesses with high consistency requirements, you can switch to Consistency mode, in which the hmily framework based on the TCC solution is used. For businesses that focus on high availability, you can switch to Availability mode, in which RocketMQ is used to implement the eventual consistency solution for transactions, thereby improving program performance and availability.
[0063] S123: Add the second method to the corresponding interface position in the form of a mark based on the interface information.
[0064] The above-mentioned markup implementation can be implemented in the Java jar package corresponding to the present application. By adding marks (i.e., custom annotations) to classes or methods, transactions can be controlled. The specific process is to create a custom annotation class and a custom aspect class. The annotation logic is processed in the aspect class, which can include: pre-notification, post-notification, exception notification, final notification, and surround notification. The reason why custom annotations can affect the transaction processing process is that it uses the principle of AOP aspect-oriented programming to implement specific transaction logic of committing or rolling back in the five notifications mentioned above, thereby achieving transaction control.
[0065] Through the above-mentioned method of adding transaction processing, the type of distributed transaction processing request is first determined, and then the corresponding second processing method is determined according to the type, and then the second method is added to the interface position in the form of a tag. When the transaction is processed, the tag obtained at the interface position can be used to obtain the second method corresponding to the tag, thereby realizing control over the newly added transaction.
[0066] The above mentioned "adding the second method to the corresponding interface position in the form of a mark based on the interface information" can be specifically implemented as follows: first, a marking plug-in and a section plug-in are created, and the section plug-in has a corresponding relationship with the interface position. Then, the control method is marked based on the marking plug-in and sent to the section plug-in. Finally, based on the interface information, the marked second method is added to the corresponding interface position using the section plug-in.
[0067] The marker plug-in mentioned above can be understood as a custom annotation class. An annotation can be understood as a kind of mark that can be marked on key nodes (classes, methods, variables, parameters, packages) in the program code. Then the program can detect these marks at compile time or runtime to perform some special operations. The aspect plug-in mentioned above can be understood as an aspect class. The aspect class is mainly used to process the processing logic corresponding to the marker plug-in's mark.
[0068] The above mentioned "marking the second method based on the marking plug-in" can be specifically implemented by first obtaining the type of the second method, then determining a target marking parameter according to the type of the second method, the target marking parameter having a corresponding relationship with the type, and finally marking the second method based on the marking plug-in using the target marking parameter.
[0069] Specifically, the target tag parameter can be determined according to the type of the second method. For example, in scenarios with high consistency requirements, @TransactionalAll(mode='Consistence') can be used, and in high availability scenarios, @TransactionalAll(mode='Availability') can be used. The aforementioned @TransactionalAll(mode='Consistence') and @TransactionalAll(mode='Availability') can be understood as target tag parameters. When it is necessary to switch methods, it can be done by modifying the target tag parameters. The specific method switching standards can be determined by the specific business requirements implemented by each business system, and are not limited here.
[0070] By marking the second method using the marking plug-in mentioned above, it is possible to change the transaction processing method in real time according to business needs, which can improve the timeliness and adaptability of transaction processing, and the change method is convenient and easy for users to operate.
[0071] S13: Perform distributed transaction processing according to the second method.
[0072] In step S13, it is mentioned that "distributed transaction processing is performed according to the second method". The specific processing method may include: firstly detecting the target marking parameter marked on the second method. Then determining the operation to be performed corresponding to the type of the second method based on the detection result. Finally, executing the operation to be performed to perform distributed transaction processing.
[0073] Specifically, the target tag parameter may be detected to obtain the operation to be executed corresponding to the target tag parameter, and then the execution operation may be taken to process the distributed transaction.
[0074] In this embodiment, a method for distributed transaction processing is proposed. The method first obtains the first method and interface information of the transaction processing to be added to the application system, the first method is the original method of the transaction processing to be added, and then responds to the distributed transaction processing request, adds the second method of transaction processing based on the interface information during the execution of the first method, and the second method is used to process the new transaction requirements that appear during the execution of the first method. Finally, distributed transaction processing is performed according to the second method. In this way, by using AOP to cut into the system and obtain relevant information at the entry point, business personnel can flexibly cut into the system according to needs and obtain data at the specified entry point, which has flexibility and adaptability. At the same time, the second method can be added to the interface position in the form of a tag, which can realize the real-time change of the transaction processing method according to business needs, which can improve the timeliness and adaptability of transaction processing, and the change method is convenient and easy for users to operate, so that the new transaction requirements can be synchronously and effectively processed during the transaction processing.
[0075] Figure 3 A schematic diagram of a distributed transaction processing device provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, a distributed transaction processing device specifically includes: an acquisition module 100, an adding module 200 and a processing module 300;
[0076] The acquisition module 100 is used to acquire a first method and interface information of a transaction processing to be added to the application system, wherein the first method is an original method of the transaction processing to be added;
[0077] The adding module 200 is used to, in response to a distributed transaction processing request, add a second transaction processing method during the execution of the first method based on the interface information, wherein the second method is used to process new transaction requirements that arise during the execution of the first method;
[0078] The processing module 300 is used to perform distributed transaction processing according to the second method.
[0079] In a possible implementation, the acquisition module 100 is specifically used to:
[0080] Use AOP aspect principles to insert aspect entry points when the application system is executed;
[0081] The first method of the transaction processing to be added and the interface information of the application system are acquired based on the entry point.
[0082] In a possible implementation, the adding module 200 is specifically used for:
[0083] Determining a type of the distributed transaction processing request;
[0084] determining a second method of transaction processing based on the type;
[0085] The second method is added to the corresponding interface position in the form of a mark based on the interface information.
[0086] In a possible implementation, a module 200 is added, specifically used for:
[0087] Creating a marking plug-in and a section plug-in, wherein the section plug-in has a corresponding relationship with the interface position;
[0088] Marking the control method based on the marking plug-in and sending it to the aspect plug-in;
[0089] The marked second method is added to the corresponding interface position using the aspect plug-in based on the interface information.
[0090] In a possible implementation, the adding module 200 is specifically used for:
[0091] Get the type of the second method;
[0092] Determine a target marking parameter according to the type of the second method, wherein the target marking parameter has a corresponding relationship with the type;
[0093] The second method is marked based on the marking plug-in using the target marking parameter.
[0094] In a possible implementation, the processing module 300 is specifically used to:
[0095] detecting the target marking parameter marked by the second method;
[0096] Determine, based on the detection result, an operation to be performed corresponding to the type of the second method;
[0097] Execute the operations to be executed to perform distributed transaction processing.
[0098] In a possible implementation, the acquisition module 100 is specifically used to:
[0099] Use AOP aspect principles to insert aspect entry points when the application system is executed;
[0100] A first method for obtaining the interface information and the transaction processing to be added by the application system through a reflection mechanism based on the entry point, wherein the reflection mechanism is used to access and obtain the information in the entry point.
[0101] In this embodiment, a distributed transaction processing device is proposed, which includes: an acquisition module, an addition module and a processing module. The acquisition module is used to acquire the first method and interface information of the transaction processing to be added to the application system, and the first method is the original method of the transaction processing to be added; the addition module is used to respond to the distributed transaction processing request, and add the second method of transaction processing based on the interface information during the execution of the first method, and the second method is used to process according to the new transaction requirements that appear during the execution of the first method; the processing module is used to perform distributed transaction processing according to the second method. In this way, by using AOP to cut into the system and obtain relevant information at the entry point, business personnel can flexibly cut into the system according to needs and obtain data at the specified entry point, which has flexibility and adaptability. At the same time, the second method can be added to the interface position in the form of a tag, which can realize the real-time change of the transaction processing method according to business needs, which can improve the timeliness and adaptability of transaction processing, and the change method is convenient and easy for users to operate, so that the new transaction requirements that appear in the transaction processing process can be synchronously and effectively processed.
[0102] The present application embodiment also proposes a distributed transaction processing method in an application scenario, specifically:
[0103] 1. Use AOP to cut into the application system horizontally, obtain the method name, number and type of parameters, and return value of the corresponding interface method through reflection, and then use the annotation of the surrounding notification to add transaction logic before, during, and after the method execution, so that the business can achieve seamless operation. The transaction logic can specifically include: transaction submission, rollback, and cancellation, and the specific logic is determined by the exception type provided by the target system.
[0104] 2. For complex scenarios with high consistency requirements, use the Consistence mode. In this mode, you can use the hmily framework based on the TCC solution, which is developed based on the Java language and supports RPC frameworks such as Dubbo and SpringCloud for transaction control. In this mode, Hmily uses AOP to intercept local methods participating in distributed transactions. Through multi-party interception, transaction participants can transparently call the Try, Confirm, and Cancel methods of the other party; the specific process is as follows:
[0105] ①Create a log table in the database of the target system
[0106] ②Create the discover-server service registration center
[0107] ③Add Maven dependency in the target system and configure Hmily
[0108] ④Add a scan item for hmily in the startup class
[0109] ⑤Write the specific logic of try and cancel methods in the target system.
[0110] The implemented TCC service is the same as a common service, and only needs to expose one interface, namely the try service. The Confirm / Concel business logic is provided only because of the need for global transaction commit / rollback. Therefore, the Confirm / Cancel service only needs to be discovered by the transaction framework and does not need to be perceived by other business services that call it.
[0111] The Availability mode used in high-availability scenarios uses the best-effort notification solution to achieve asynchronous execution between threads to resolve the problems caused by synchronization blocking in the current 2PC framework. At the same time, the Consistency mode used in scenarios with high consistency requirements uses the hmily framework based on the TCC solution to solve problems such as single point failures and data inconsistency.
[0112] 3. For business scenarios that require high availability but not high real-time requirements, you can switch to Availability mode, in which RocketMQ is used to implement the eventual consistency solution of transactions, thereby improving the performance and availability of the program.
[0113] a) This solution means that after executing a local transaction and sending a message, the transaction participants (message consumers) must be able to receive the message and process the transaction successfully. This solution emphasizes that as long as the message is sent to the transaction participants, the transaction must be agreed upon. This solution is completed using rocketMq message middleware. The transaction initiator (message producer) sends the message to the message middleware, and the transaction participants receive the message from the message middleware. The transaction initiator and the message middleware, as well as the transaction participants (message consumers) and the message middleware communicate through the network. Due to the uncertainty of the network, it will cause distributed problems. Therefore, this solution needs to solve the following problems:
[0114] i. Atomicity issues of local transactions and message sending
[0115] ii. Reliability of message reception by transaction participants
[0116] iii. Message duplicate consumption problem
[0117] Solution:
[0118] ① Local message table solution: First, use transaction atomicity to ensure that business operations and sending logs are persisted at the same time. Then use the message producer mode, the application reads the message and sends it to the message middleware. If the delivery is successful, the message sending status is modified to success. If the delivery fails, the sending status is modified to failure, and a task is manually added to the compensation message sending.
[0119] ②RocketMq transaction message solution: RocketMq provides a feature called "distributed transaction message" for implementing distributed transactions. Distributed transaction messages can ensure the reliability of messages and the principle of transactions, that is, either all related messages are rolled back or all related messages are correctly processed and committed, thereby achieving consistency and reliability of distributed transactions.
[0120] The Availability mode uses the best effort notification solution, which is different from TCC in that it does not lock resources, thus ensuring that program performance is not affected to the greatest extent. At the same time, the aspect programming mode also avoids intrusion into business code and improves the scalability of the program.
[0121] The above method can realize the effective synchronous processing of newly emerged transaction requirements during the transaction processing.
[0122] The flow chart and block diagram in the accompanying drawings illustrate the possible implementation architecture, function and operation of the device and method according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the module, the 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 implementations as replacements, the functions marked in the box can also occur in a sequence different from that 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 and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart 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.
[0123] The embodiments of the present application also provide corresponding devices and computer-readable storage media for implementing the solutions provided by the embodiments of the present application.
[0124] The device includes a memory and a processor, the memory is used to store instructions or codes, and the processor is used to execute the instructions or codes so that the device executes a distributed transaction processing method described in any embodiment of the present application.
[0125] In practical applications, the computer-readable storage medium can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present embodiment, the 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.
[0126] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. 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 a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0127] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0128] Computer program code for performing the operations of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0129] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0130] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A distributed transaction processing method, characterized in that: The method comprises: Acquire a first method and interface information of a transaction to be added by the application system, wherein the first method is an original method of the transaction to be added; In response to the distributed transaction processing request, adding a second transaction processing method during the execution of the first method based on the interface information, wherein the second method is a method for processing new transaction requirements arising during the execution of the first method; Distributed transaction processing is performed according to the second method.
2. The method according to claim 1, characterized in that The first method and interface information for obtaining transaction processing to be added to the application system include: Use AOP aspect principles to insert aspect entry points when the application system is executed; The first method of the transaction processing to be added and the interface information of the application system are acquired based on the entry point.
3. The method according to claim 2, characterized in that The second method of adding transaction processing during the execution of the first method based on the interface information includes: Determining a type of the distributed transaction processing request; determining a second method of transaction processing based on the type; The second method is added to the corresponding interface position in the form of a mark based on the interface information.
4. The method according to claim 3, characterized in that The adding the second method to the corresponding interface position in the form of a mark based on the interface information comprises: Creating a marking plug-in and a section plug-in, wherein the section plug-in has a corresponding relationship with the interface position; Marking the second method based on the marking plug-in and sending the mark to the aspect plug-in; The marked second method is added to the corresponding interface position using the aspect plug-in based on the interface information.
5. The method according to claim 4, characterized in that The marking the second method based on the marking plug-in includes: Get the type of the second method; Determine a target marking parameter according to the type of the second method, wherein the target marking parameter has a corresponding relationship with the type; The second method is marked based on the marking plug-in using the target marking parameter.
6. The method according to claim 5, characterized in that The performing distributed transaction processing according to the second method includes: detecting the target marking parameter marked by the second method; Determine, based on the detection result, an operation to be performed corresponding to the type of the second method; Execute the operations to be executed to perform distributed transaction processing.
7. The method according to claim 1, characterized in that The first method or interface information of obtaining the transaction processing to be added by the application system includes: Use AOP aspect principles to insert aspect entry points when the application system is executed; A first method for obtaining the interface information and the transaction processing to be added by the application system through a reflection mechanism based on the entry point, wherein the reflection mechanism is used to access and obtain the information in the entry point.
8. A distributed transaction processing device, characterized in that: The device comprises: an acquisition module, an adding module and a processing module; The acquisition module is used to acquire a first method and interface information of a transaction processing to be added by the application system, wherein the first method is an original method of the transaction processing to be added; The adding module is used to, in response to a distributed transaction processing request, add a second transaction processing method based on the interface information during the execution of the first method, wherein the second method is a method for processing a new transaction requirement arising during the execution of the first method; The processing module is used to perform distributed transaction processing according to the second method.
9. An electronic device, characterized in that: The device includes: a processor, a memory, and a system bus; The processor and the memory are connected via the system bus; The memory is used to store one or more programs, wherein the one or more programs include instructions, and when the instructions are executed by the processor, the processor executes the distributed transaction processing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores an implementation program for implementing a method for distributed transaction processing, and when the implementation program for implementing a method for distributed transaction processing is executed by a processor, the steps of the method as described in any one of claims 1 to 7 are implemented.
