CN106598761B - Transaction connection establishing method and device based on middleware - Google Patents

Transaction connection establishing method and device based on middleware Download PDF

Info

Publication number
CN106598761B
CN106598761B CN201611178260.3A CN201611178260A CN106598761B CN 106598761 B CN106598761 B CN 106598761B CN 201611178260 A CN201611178260 A CN 201611178260A CN 106598761 B CN106598761 B CN 106598761B
Authority
CN
China
Prior art keywords
state operation
connection
transaction
operation instruction
kth
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201611178260.3A
Other languages
Chinese (zh)
Other versions
CN106598761A (en
Inventor
邓怡豪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201611178260.3A priority Critical patent/CN106598761B/en
Publication of CN106598761A publication Critical patent/CN106598761A/en
Application granted granted Critical
Publication of CN106598761B publication Critical patent/CN106598761B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues

Abstract

The invention discloses a method and a device for establishing transaction connection based on a middleware, wherein a transaction comprises n state operation instructions, and the method comprises the following steps: receiving a kth state operation instruction of an affair, and establishing a kth connection with a server; acquiring and analyzing the 1 st result to the k-1 st result corresponding to the 1 st state operation to the k-1 st state operation of the transaction, and respectively reconstructing the 1 st state operation instruction to the k-1 st state operation instruction of the transaction; sequentially transmitting the reconstructed 1 st state operation instruction to the k-1 st state operation instruction and the k state operation instruction to the server through the k connection; and receiving a kth item result corresponding to the kth state operation instruction returned by the server, storing the kth item result and releasing the kth connection. The scheme is completed based on the middleware, the execution speed is high, the time spent is short, and the problems that the transaction connection is occupied for a long time and the like are effectively solved.

Description

Transaction connection establishing method and device based on middleware
Technical Field
The invention relates to the field of computer software, in particular to a transaction connection establishing method and device based on middleware.
Background
In the transaction, a connection with the server needs to be established first. After the connection is established, relevant state operation instructions are executed, and corresponding results are received. And if the connection with the server is established, executing the query instruction and receiving a corresponding query return result. And after receiving the result, if the operation instructions in the transaction are all executed, releasing the connection with the server. When a plurality of transactions exist, it is time-consuming to frequently establish connection with the server, and a middleware mode is adopted, wherein the middleware is established on the server, and the middleware establishes a connection pool. When there is a transaction, a connection can be taken from the connection pool of the middleware to directly establish connection with the server.
The transaction can contain a plurality of state operation instructions, and if one connection is taken from the connection pool of the middleware and the plurality of state operation instructions in the transaction are processed in sequence, the connection cannot be released for a long time and is kept in a connection state all the time. When a plurality of transactions need to be processed, a plurality of connections in the connection pool are always kept in a connection state, so that the connection pool occupies a larger memory, and the memory occupied by the connection pool is suddenly expanded, thereby affecting the transaction processing speed.
Disclosure of Invention
In view of the above, the present invention is proposed to provide a middleware based transaction connection establishment method and apparatus that overcomes or at least partially solves the above problems.
According to one aspect of the present invention, there is provided a middleware-based transaction connection establishment method, where a transaction includes n state operation instructions, the method including:
receiving a kth state operation instruction of an affair, and establishing a kth connection with a server;
acquiring and analyzing the 1 st result to the k-1 st result corresponding to the 1 st state operation to the k-1 st state operation of the transaction, and respectively reconstructing the 1 st state operation instruction to the k-1 st state operation instruction of the transaction;
sequentially transmitting the reconstructed 1 st state operation instruction to the k-1 st state operation instruction and the k state operation instruction to the server through the k connection; and
receiving a kth item result corresponding to the kth state operation instruction returned by the server, storing the kth item result and releasing the kth connection;
wherein n and k are natural numbers, and n is not less than k.
According to another aspect of the present invention, there is provided a middleware-based transaction connection establishing apparatus, where a transaction includes n state operation instructions, the apparatus including:
the connection module is suitable for receiving the kth state operation instruction of the transaction and establishing the kth connection with the server;
the reconstruction module is suitable for acquiring and analyzing the 1 st result to the k-1 st result corresponding to the 1 st state operation to the k-1 st state operation of the transaction, and respectively reconstructing the 1 st state operation instruction to the k-1 st state operation instruction of the transaction;
the result module is suitable for transmitting the reconstructed 1 st state operation instruction to the k-1 st state operation instruction and the k state operation instruction to the server in sequence through the k connection; and
receiving a kth item result corresponding to the kth state operation instruction returned by the server, storing the kth item result and releasing the kth connection;
wherein n and k are natural numbers, and n is not less than k.
According to the method and the device for establishing the transaction connection based on the middleware, provided by the invention, the kth state operation instruction of a transaction is received, and the kth connection with a server is established; acquiring and analyzing the 1 st result to the k-1 st result corresponding to the 1 st state operation to the k-1 st state operation of the transaction, and respectively reconstructing the 1 st state operation instruction to the k-1 st state operation instruction of the transaction; sequentially transmitting the reconstructed 1 st state operation instruction to the k-1 st state operation instruction and the k state operation instruction to the server through the k connection; and receiving a kth item result corresponding to the kth state operation instruction returned by the server, storing the kth item result and releasing the kth connection. According to the scheme, the 1 st state operation to the k-1 st state operation before the k state operation instruction are reconstructed according to the obtained 1 st result to the k-1 st result, and the reconstructed state operation instruction and the k state operation instruction are sequentially transmitted to the server, so that the integrity of the whole transaction is ensured. Meanwhile, the connection establishment, the reconstruction of the state operation instruction and the transmission of the reconstructed state operation instruction are all based on the middleware, and the middleware is arranged on the server, so that compared with the prior method that the state operation instruction is directly transmitted to the server, the speed is higher, the time spent is shorter, and the problems of the sudden expansion of a connection pool memory, low execution efficiency and the like caused by the fact that the transaction connection is occupied for a long time are effectively solved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flow diagram illustrating a middleware based transaction connection establishment method according to one embodiment of the present invention;
FIG. 2 is a flow diagram illustrating a middleware based transaction connection establishment method according to another embodiment of the present invention;
FIG. 3 is a flowchart illustrating a middleware based transaction connection establishment method according to yet another embodiment of the present invention;
FIG. 4 shows a functional block diagram of a middleware based transaction connection setup apparatus according to one embodiment of the present invention;
fig. 5 shows a functional block diagram of a middleware-based transaction connection setup apparatus according to another embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Fig. 1 shows a flow diagram of a middleware-based transaction connection establishment method according to an embodiment of the invention. As shown in fig. 1, the method for establishing a transaction connection based on middleware specifically includes the following steps:
and step S101, receiving a kth state operation instruction of the transaction, and establishing a kth connection with the server.
The transaction is a complete execution unit and comprises n state operation instructions, and the n state operation instructions have a front-back execution sequence. Wherein n is a natural number. And when the transaction is executed, n state operation instructions are executed in sequence. Take the k-th status operation command of the received transaction as an example, where n is not less than k.
And receiving a kth state operation instruction of the transaction, and establishing a kth connection with the server, wherein the kth connection is a free connection selected from a connection pool and used as the kth connection with the server. The connection pool is provided by middleware arranged on the server, and a plurality of connections exist in the connection pool and are all connected with the server. The kth connection connects the middleware to the server.
Step S102, obtaining and analyzing the 1 st item result to the k-1 st item result corresponding to the 1 st item state operation to the k-1 st item state operation of the transaction, and respectively reconstructing the 1 st item state operation instruction to the k-1 st item state operation instruction of the transaction.
After the kth connection with the server is established, the 1 st result to the k-1 st result corresponding to the 1 st state operation to the k-1 st state operation of the transaction are obtained. And storing the 1 st result to the (k-1) th result in the middleware, and acquiring the 1 st result to the (k-1) th result from the middleware. And analyzing the 1 st result to the k-1 st result, and reconstructing the 1 st state operation instruction to the k-1 st state operation instruction corresponding to the transaction. And during reconstruction, reversely acquiring the 1 st state operation instruction to the k-1 st state operation instruction according to the 1 st result to the k-1 st result, and completing reconstruction.
And step S103, sequentially transmitting the reconstructed 1 st state operation instruction to the k-1 st state operation instruction and the k state operation instruction to the server through the k connection.
And step S104, receiving a kth item result corresponding to the kth state operation instruction returned by the server, saving the kth item result and releasing the kth connection.
And through the kth connection with the server, sequentially transmitting the reconstructed 1 st state operation instruction to the kth-1 st state operation instruction and the current kth state operation instruction to the server. Because the k state operation instructions in the transaction have a front-back execution relation, before the current k state operation instruction is executed, the server sequentially executes the 1 st state operation instruction to the k-1 st state operation instruction, and then executes the current k state operation instruction. After the server executes, since the 1 st to k-1 st results corresponding to the 1 st to k-1 st state operations have been previously saved, only the kth result corresponding to the kth state operation instruction returned by the server is received and saved this time, for example, the kth result may be saved in the middleware. When saving, the number of data in the k item result, the data length of the k item result, each data type of the k item result, the transaction ID, and the like, which are included in the k item result, are saved. The transaction ID is the identification of the transaction, and the transaction IDs of the results corresponding to the n state operation instructions in the transaction are consistent. And saving the kth item result and releasing the current kth connection. When releasing, for example, sending a connection release message to the server to put the kth connection back into the connection pool, so that the state of the kth connection is changed into an idle state.
And executing the steps to finish the operation corresponding to the current k state operation instruction. And circularly executing the steps until the operations corresponding to the n state operation instructions contained in the transaction are completed.
According to the transaction connection establishing method based on the middleware, provided by the invention, a kth state operation instruction of a transaction is received, and a kth connection with a server is established; acquiring and analyzing the 1 st result to the k-1 st result corresponding to the 1 st state operation to the k-1 st state operation of the transaction, and respectively reconstructing the 1 st state operation instruction to the k-1 st state operation instruction of the transaction; sequentially transmitting the reconstructed 1 st state operation instruction to the k-1 st state operation instruction and the k state operation instruction to the server through the k connection; and receiving a kth item result corresponding to the kth state operation instruction returned by the server, storing the kth item result and releasing the kth connection. According to the scheme, the 1 st state operation to the k-1 st state operation before the k state operation instruction are reconstructed according to the obtained 1 st result to the k-1 st result, and the reconstructed state operation instruction and the k state operation instruction are sequentially transmitted to the server, so that the integrity of the whole transaction is ensured. Meanwhile, the connection establishment, the reconstruction of the state operation instruction and the transmission of the reconstructed state operation instruction are all based on the middleware, and the middleware is arranged on the server, so that compared with the prior method that the state operation instruction is directly transmitted to the server, the speed is higher, the time spent is shorter, and the problems of the sudden expansion of a connection pool memory, low execution efficiency and the like caused by the fact that the transaction connection is occupied for a long time are effectively solved.
Fig. 2 is a flowchart illustrating a transaction connection establishment method based on middleware according to another embodiment of the present invention.
When k =1, the middleware-based transaction connection establishing method specifically includes the steps shown in fig. 2:
step S201, receiving the 1 st state operation instruction of the transaction, and establishing the 1 st connection with the server.
Step S202, the 1 st state operation instruction is transmitted to the server through the 1 st connection.
Step S203, receiving the 1 st result corresponding to the 1 st state operation instruction returned by the server, saving the 1 st result and releasing the 1 st connection.
Receiving a 1 st state operation instruction of a transaction, and selecting a free connection from a connection pool of the middleware as a 1 st connection with the server so as to establish the 1 st connection with the server. And transmitting the 1 st state operation instruction to the server through the 1 st connection. The 1 st state operation instruction of the transaction is directly executed by the server because no other state operation instruction exists before the 1 st state operation instruction. Receiving the 1 st result corresponding to the 1 st state operation instruction returned by the server, and storing the 1 st result in the middleware. When saving, the number of data in the 1 st result, the data length of the 1 st result, the data types of the 1 st result, the transaction ID, and the like, which are included in the 1 st result, are saved. The transaction ID is the identification of the transaction, and the transaction IDs of the results corresponding to the n state operation instructions in the transaction are consistent.
According to the transaction connection establishment method based on the middleware, provided by the invention, the 1 st state operation instruction of a transaction is received, and the 1 st connection with a server is established; transmitting the 1 st state operation instruction to a server through the 1 st connection; receiving the 1 st result corresponding to the 1 st state operation instruction returned by the server, saving the 1 st result and releasing the 1 st connection. And after the stored 1 st result can be analyzed, reconstructing to generate a 1 st state operation instruction so as to be sequentially transmitted to the server with a k state operation instruction later, and ensuring the integrity of the whole transaction during execution. Meanwhile, the connection establishment and the state transmission operation instructions are all based on the middleware, and the middleware is arranged on the server, so that the speed is higher and the time spent is shorter compared with the original method that the state operation instructions are directly transmitted to the server, thereby effectively solving the problems that the internal memory of a connection pool is burst and the execution efficiency is low due to the fact that the business connection is occupied for a long time.
Fig. 3 is a flowchart illustrating a transaction connection establishment method based on middleware according to another embodiment of the present invention. As shown in fig. 3, the method for establishing a transaction connection based on middleware specifically includes the following steps:
step S301, receiving the kth state operation instruction of the transaction, and establishing the kth connection with the server.
And receiving a kth state operation instruction of the transaction, and establishing a kth connection with the server, wherein the kth connection is a free connection selected from a connection pool and used as the kth connection with the server. The connection pool is provided by middleware arranged on the server, and a plurality of connections exist in the connection pool and are all connected with the server. The kth connection connects the middleware to the server.
Step S302, according to the transaction ID carried by the kth state operation instruction, searching the saved item 1 result to item k-1 result which are consistent with the transaction ID.
And searching a result of the transaction ID which is consistent with the transaction ID in the result stored by the middleware according to the transaction ID carried by the kth state operation instruction, namely the result from the item 1 to the item k-1 of the transaction.
The middleware may have multiple results stored simultaneously for multiple different transactions, with different transactions having different transaction IDs. In the two embodiments of the method described above, it has been described that after the receiving server returns the result, the result is saved. The transaction ID is included in the saved results. And searching a plurality of results of the transaction corresponding to the kth state operation instruction according to the transaction ID included in the results and the transaction ID carried by the kth state operation instruction.
Step S303, the 1 st result to the k-1 st result corresponding to the 1 st state operation to the k-1 st state operation of the transaction are obtained and analyzed, and the 1 st state operation instruction to the k-1 st state operation instruction of the transaction are respectively reconstructed.
And step S304, sequentially transmitting the reconstructed 1 st state operation instruction to the k-1 st state operation instruction and the k state operation instruction to the server through the k connection.
Step S305, receiving the kth item result corresponding to the kth state operation instruction returned by the server, saving the kth item result and releasing the kth connection.
The above steps can refer to steps S102-S104 in the embodiment of fig. 1, and are not described herein again.
In step S306, it is determined whether k is equal to n.
If k is equal to n, i.e. the k-th operation instruction is the last operation instruction of the transaction, step S306 is executed, otherwise, steps S301 to S305 are executed in a loop, and the operation instruction of the next transaction is received continuously.
Step S307, returning the kth result corresponding to the kth state operation instruction of the transaction to the initiator of the transaction.
And returning the kth result corresponding to the kth state operation instruction of the transaction to the initiator of the transaction to finish the execution of the transaction.
According to the transaction connection establishing method based on the middleware, provided by the invention, a kth state operation instruction of a transaction is received, and a kth connection with a server is established; searching a saved item 1 result to an item k-1 result which are consistent with the transaction ID according to the transaction ID carried by the state operation instruction of the item k; acquiring and analyzing the 1 st result to the k-1 st result corresponding to the 1 st state operation to the k-1 st state operation of the transaction, and respectively reconstructing the 1 st state operation instruction to the k-1 st state operation instruction of the transaction; sequentially transmitting the reconstructed 1 st state operation instruction to the k-1 st state operation instruction and the k state operation instruction to the server through the k connection; and receiving a kth item result corresponding to the kth state operation instruction returned by the server, storing the kth item result and releasing the kth connection. And when k = n, namely when the last state operation instruction of the transaction is received, returning the k item result corresponding to the k item state operation instruction of the transaction to the initiator of the transaction. And finishing the processing of the whole transaction, and returning a corresponding transaction processing result to the initiator of the transaction. The method comprises the steps that the state operation instructions of connection establishment, reconstruction and reconstruction transmission are all based on the middleware, and the middleware is arranged on a server, so that the method is higher in speed and less in spent time compared with the method that the state operation instructions are directly transmitted to the server, and the problems that the business connection is occupied for a long time, the memory of a connection pool is burst, the execution efficiency is low and the like are effectively solved. Meanwhile, before the kth state operation instruction is executed, the 1 st state operation instruction to the kth-1 st state operation instruction are all reconstructed and are sequentially transmitted to the server and executed by the server, so that the integrity of the whole transaction is ensured.
Fig. 4 shows a functional block diagram of a middleware based transaction connection setup apparatus according to an embodiment of the present invention. As shown in fig. 4, the middleware-based transaction connection establishing apparatus includes the following modules:
the connection module 410 is adapted to receive a kth state operation instruction of the transaction and establish a kth connection with the server.
The transaction is a complete execution unit and comprises n state operation instructions, and the n state operation instructions have a front-back execution sequence. Wherein n is a natural number. When executed, the transaction executes n state operation instructions in sequence. The connection module 410 is illustrated by receiving the kth state operation instruction of the transaction, where n is not less than k.
The connection module 410 receives the kth state operation instruction of the transaction, and establishes the kth connection with the server, where the kth connection is a connection selected by the connection module 410 from the connection pool as the kth connection with the server. The connection pool is provided by middleware arranged on the server, and a plurality of connections exist in the connection pool and are all connected with the server. The kth connection connects the middleware to the server.
The reconstruction module 420 is adapted to obtain and analyze the 1 st to k-1 st results corresponding to the 1 st to k-1 st state operations of the transaction, and reconstruct the 1 st to k-1 st state operation instructions of the transaction, respectively.
After the connection module 410 establishes the kth connection with the server, the reconstruction module 420 obtains the 1 st to the k-1 st results corresponding to the 1 st to the k-1 st state operations of the transaction. The 1 st result to the (k-1) th result are stored in the middleware, and the reconstruction module 420 acquires the 1 st result to the (k-1) th result from the middleware. The reconstruction module 420 analyzes the 1 st to k-1 st results, and reconstructs the 1 st to k-1 st state operation instructions corresponding to the transaction. When the reconstruction module 420 reconstructs the data, the 1 st to the k-1 st state operation instructions are reversely acquired according to the 1 st to the k-1 st results, and the reconstruction is completed.
The result module 430 is adapted to sequentially transmit the reconstructed 1 st to k-1 st state operation instructions and the k state operation instruction to the server through the k connection; and receiving a kth item result corresponding to the kth state operation instruction returned by the server, storing the kth item result and releasing the kth connection.
The result module 430 sequentially transmits the reconstructed 1 st state operation instruction to the k-1 st state operation instruction and the current k state operation instruction to the server through the k connection with the server. Because the k state operation instructions in the transaction have a front-back execution relation, before the server executes the current k state operation instruction, the server sequentially executes the 1 st state operation instruction to the k-1 st state operation instruction, and then executes the current k state operation instruction. After the server executes, since the 1 st to k-1 st results corresponding to the 1 st to k-1 st state operations have been previously saved, the result module 430 only receives the kth result corresponding to the kth state operation instruction returned by the server for saving, for example, the kth result may be saved in the middleware. When saving, the result module 430 saves the number of data in the kth item result, the data length of the kth item result, each data type of the kth item result, the transaction ID, and the like, which are included in the kth item result. The transaction ID is the identification of the transaction, and the transaction IDs of the results corresponding to the n state operation instructions in the transaction are consistent. The result module 430 saves the kth result and releases the kth connection this time. When the result module 430 releases, for example, a connection release message is sent to the server to place the kth connection back into the connection pool, so that the state of the kth connection is changed to an idle state.
And executing the modules to complete the operation corresponding to the current state operation instruction. And circularly executing the modules until the operations corresponding to the n state operation instructions contained in the transaction are completed.
When k =1, the connection module 410 is further adapted to receive the 1 st state operation instruction of the transaction, select a free connection from the connection pool of the middleware as the 1 st connection with the server, and thereby establish the 1 st connection with the server. The results module 430 is further adapted to communicate the 1 st state operation instruction to the server over the 1 st connection. The 1 st state operation instruction of the transaction is directly executed by the server because no other state operation instruction exists before the 1 st state operation instruction. The result module 430 receives the 1 st result corresponding to the 1 st state operation instruction returned by the server, saves the 1 st result, and releases the 1 st connection. The 1 st result is saved in the middleware. When the result module 430 saves the 1 st result, the number of data in the 1 st result, the data length of the 1 st result, the data types of the 1 st result, the transaction ID, and the like included in the 1 st result are saved. The transaction ID is the identification of the transaction, and the transaction IDs of the results corresponding to the n state operation instructions in the transaction are consistent.
According to the transaction connection establishing device based on the middleware, provided by the invention, a kth state operation instruction of a transaction is received, and a kth connection with a server is established; acquiring and analyzing the 1 st result to the k-1 st result corresponding to the 1 st state operation to the k-1 st state operation of the transaction, and respectively reconstructing the 1 st state operation instruction to the k-1 st state operation instruction of the transaction; sequentially transmitting the reconstructed 1 st state operation instruction to the k-1 st state operation instruction and the k state operation instruction to the server through the k connection; and receiving a kth item result corresponding to the kth state operation instruction returned by the server, storing the kth item result and releasing the kth connection. According to the scheme, the 1 st state operation to the k-1 st state operation before the k state operation instruction are reconstructed according to the obtained 1 st result to the k-1 st result, and the reconstructed state operation instruction and the k state operation instruction are sequentially transmitted to the server, so that the integrity of the whole transaction is ensured. Meanwhile, the connection establishment, the reconstruction of the state operation instruction and the transmission of the reconstructed state operation instruction are all based on the middleware, and the middleware is arranged on the server, so that compared with the prior method that the state operation instruction is directly transmitted to the server, the speed is higher, the time spent is shorter, and the problems of the sudden expansion of a connection pool memory, low execution efficiency and the like caused by the fact that the transaction connection is occupied for a long time are effectively solved.
Fig. 5 shows a functional block diagram of a middleware-based transaction connection setup apparatus according to another embodiment of the present invention. As shown in fig. 5, compared with fig. 4, the middleware-based transaction connection establishing apparatus further includes the following modules:
the searching module 440 is adapted to search the saved item 1 result to item k-1 result which are consistent with the transaction ID according to the transaction ID carried by the kth state operation instruction.
The searching module 440 searches for a result that the transaction ID is consistent with the transaction ID in the result stored in the middleware, that is, the result of item 1 to item k-1 of the transaction, according to the transaction ID carried in the kth state operation instruction.
The middleware may have multiple results stored simultaneously for multiple different transactions, with different transactions having different transaction IDs. As described in the above device embodiment, the result module 430 saves the result after the receiving server returns the result. The transaction ID is included in the saved results. The searching module 440 may search multiple results of the transaction corresponding to the kth state operation instruction according to the transaction ID included in the result and the transaction ID carried by the kth state operation instruction.
Further, when k = n, the middleware based transaction connection establishing apparatus further includes a returning module 450.
The returning module 450 is adapted to return the kth result corresponding to the kth state operation instruction of the transaction to the initiator of the transaction, so as to complete the execution of the transaction.
According to the transaction connection establishing device based on the middleware, provided by the invention, a kth state operation instruction of a transaction is received, and a kth connection with a server is established; searching a saved item 1 result to an item k-1 result which are consistent with the transaction ID according to the transaction ID carried by the state operation instruction of the item k; acquiring and analyzing the 1 st result to the k-1 st result corresponding to the 1 st state operation to the k-1 st state operation of the transaction, and respectively reconstructing the 1 st state operation instruction to the k-1 st state operation instruction of the transaction; sequentially transmitting the reconstructed 1 st state operation instruction to the k-1 st state operation instruction and the k state operation instruction to the server through the k connection; and receiving a kth item result corresponding to the kth state operation instruction returned by the server, storing the kth item result and releasing the kth connection. And when k = n, namely when the last state operation instruction of the transaction is received, returning the k item result corresponding to the k item state operation instruction of the transaction to the initiator of the transaction. And finishing the processing of the whole transaction, and returning a corresponding transaction processing result to the initiator of the transaction. The method comprises the steps that the state operation instructions of connection establishment, reconstruction and reconstruction transmission are all based on the middleware, and the middleware is arranged on a server, so that the method is higher in speed and less in spent time compared with the method that the state operation instructions are directly transmitted to the server, and the problems that the business connection is occupied for a long time, the memory of a connection pool is burst, the execution efficiency is low and the like are effectively solved. Meanwhile, before the kth state operation instruction is executed, the 1 st state operation instruction to the kth-1 st state operation instruction are all reconstructed and are sequentially transmitted to the server and executed by the server, so that the integrity of the whole transaction is ensured.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in a middleware based transaction connection establishment apparatus according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (12)

1. A middleware-based transaction connection establishment method, wherein a transaction comprises n state operation instructions, and the method comprises the following steps:
receiving a kth state operation instruction of the transaction, and establishing a kth connection with a server;
searching a saved item 1 result to an item k-1 result which are consistent with the transaction ID according to the transaction ID carried by the state operation instruction of the kth item;
acquiring and analyzing the 1 st result to the k-1 st result corresponding to the 1 st state operation to the k-1 st state operation of the transaction, and respectively reconstructing the 1 st state operation instruction to the k-1 st state operation instruction of the transaction;
sequentially transmitting the reconstructed 1 st state operation instruction to the k-1 st state operation instruction and the k state operation instruction to a server through a k connection; and
receiving a kth item result corresponding to the kth state operation instruction returned by the server, storing the kth item result and releasing the kth connection;
wherein n and k are natural numbers, and n is not less than k.
2. The method of claim 1, wherein when k =1, the method comprises:
receiving a 1 st state operation instruction of the transaction, and establishing a 1 st connection with a server;
transmitting the 1 st state operation instruction to a server through a 1 st connection; and
receiving the 1 st result corresponding to the 1 st state operation instruction returned by the server, saving the 1 st result and releasing the 1 st connection.
3. The method according to claim 2, wherein the establishing of the 1 st connection or the kth connection with the server is specifically: and selecting one free connection from the connection pool as the 1 st connection or the k-th connection with the server.
4. The method of claim 2, wherein the releasing the 1 st connection or the kth connection further comprises: a connection release message is sent to the server to place the 1 st connection or the kth connection back into the connection pool.
5. The method of any of claims 1-4, wherein the item 1 result and the item k result each include a number of data, a length of data, a type of data, and/or a transaction ID.
6. The method of claim 1, wherein when k = n, the method further comprises:
and returning the kth item result corresponding to the kth state operation instruction of the transaction to the initiator of the transaction.
7. A middleware-based transaction connection establishment apparatus, the transaction including n state operation instructions, the apparatus comprising:
the connection module is suitable for receiving the kth state operation instruction of the transaction and establishing the kth connection with the server;
the searching module is suitable for searching the stored item 1 result to item k-1 result which are consistent with the transaction ID according to the transaction ID carried by the kth state operation instruction;
the reconstruction module is suitable for acquiring and analyzing the 1 st result to the k-1 st result corresponding to the 1 st state operation to the k-1 st state operation of the transaction, and reconstructing the 1 st state operation instruction to the k-1 st state operation instruction of the transaction respectively;
the result module is suitable for transmitting the reconstructed 1 st state operation instruction to the k-1 st state operation instruction and the k state operation instruction to the server in sequence through the k connection; and
receiving a kth item result corresponding to the kth state operation instruction returned by the server, storing the kth item result and releasing the kth connection;
wherein n and k are natural numbers, and n is not less than k.
8. The apparatus of claim 7, wherein when k =1,
the connection module is further adapted to: receiving a 1 st state operation instruction of the transaction, and establishing a 1 st connection with a server;
the results module is further adapted to: transmitting the 1 st state operation instruction to a server through a 1 st connection; and
receiving the 1 st result corresponding to the 1 st state operation instruction returned by the server, saving the 1 st result and releasing the 1 st connection.
9. The apparatus of claim 8, wherein the connection module is further adapted to:
and selecting one free connection from the connection pool as the 1 st connection or the k-th connection with the server.
10. The apparatus of claim 8, wherein the results module is further adapted to:
a connection release message is sent to the server to place the 1 st connection or the kth connection back into the connection pool.
11. The apparatus of any of claims 7-10, wherein the item 1 result and the item k result each comprise a number of data, a length of data, a type of data, and/or a transaction ID.
12. The apparatus of claim 7, wherein when k = n, the apparatus further comprises:
and the return module is suitable for returning the kth result corresponding to the kth state operation instruction of the transaction to the initiator of the transaction.
CN201611178260.3A 2016-12-19 2016-12-19 Transaction connection establishing method and device based on middleware Expired - Fee Related CN106598761B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611178260.3A CN106598761B (en) 2016-12-19 2016-12-19 Transaction connection establishing method and device based on middleware

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611178260.3A CN106598761B (en) 2016-12-19 2016-12-19 Transaction connection establishing method and device based on middleware

Publications (2)

Publication Number Publication Date
CN106598761A CN106598761A (en) 2017-04-26
CN106598761B true CN106598761B (en) 2020-07-14

Family

ID=58599457

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611178260.3A Expired - Fee Related CN106598761B (en) 2016-12-19 2016-12-19 Transaction connection establishing method and device based on middleware

Country Status (1)

Country Link
CN (1) CN106598761B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1786963A (en) * 2005-07-21 2006-06-14 曾致中 Method for searching data base ciphertext
CN103827822A (en) * 2011-09-29 2014-05-28 甲骨文国际公司 System and method for supporting automatically deploying/undeploying application components in a transactional middleware machine environment
CN104778083A (en) * 2015-03-27 2015-07-15 华为技术有限公司 Method and device for task scheduling on heterogeneous multi-core reconfigurable computing platform

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7974204B2 (en) * 2007-11-07 2011-07-05 The Boeing Company Quality of service management for message flows across multiple middleware environments

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1786963A (en) * 2005-07-21 2006-06-14 曾致中 Method for searching data base ciphertext
CN103827822A (en) * 2011-09-29 2014-05-28 甲骨文国际公司 System and method for supporting automatically deploying/undeploying application components in a transactional middleware machine environment
CN104778083A (en) * 2015-03-27 2015-07-15 华为技术有限公司 Method and device for task scheduling on heterogeneous multi-core reconfigurable computing platform

Also Published As

Publication number Publication date
CN106598761A (en) 2017-04-26

Similar Documents

Publication Publication Date Title
CN104881494B (en) The methods, devices and systems synchronous with Redis server progress data
CN105653630B (en) Data migration method and device for distributed database
CN109951547B (en) Transaction request parallel processing method, device, equipment and medium
US10614148B2 (en) Reconfigurable convolution accelerator
CN110704173A (en) Task scheduling method, scheduling system, electronic device and computer storage medium
US10871918B2 (en) Writing composite objects to a data store
CN105045632A (en) Method and device for implementing lock free queue in multi-core environment
US9684711B2 (en) System and method for providing agent service to user terminal
CN110351161B (en) Business end-to-end test method, device, storage medium and computer equipment
CN102999423A (en) Multi-core testing method and device
CN106598761B (en) Transaction connection establishing method and device based on middleware
CN107426138A (en) A kind of method for accelerating data remote access, server apparatus
CN110990116B (en) Method, device and system for transmitting data between intelligent network card and virtual machine
CN106649584B (en) Index processing method and device in master-slave database system
CN105354052B (en) flash game loading method and device
US20200050456A1 (en) Method for Processing Information, and Processor
CN112764897B (en) Task request processing method, device and system and computer readable storage medium
CN105630889B (en) Universal caching method and device
CN111367868B (en) File acquisition request processing method and device
US20130151817A1 (en) Method, apparatus, and computer program product for parallel functional units in multicore processors
CN110532099B (en) Resource isolation method and apparatus, electronic device, and medium
CN113535338A (en) Interaction method, system, storage medium and electronic device for data access
CN106649720B (en) Data processing method and server
CN109408063B (en) Instruction pile inserting method and device based on virtual machine
CN106202141A (en) A kind of resource loading method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20200714