The system of cross-system distributed transaction processing method and distributing real time system
Technical field
The present invention relates to distributed transaction processing field more particularly to a kind of cross-system distributed transaction processing methods
With the system and computer equipment and computer readable storage medium of distributing real time system.
Background technique
Cross-system distributing real time system is to solve asking using fractionation bring cross-system business operation atomicity
Topic, such as: mall system is related to marketing system, integral payment system and cashier system etc. can make simultaneously when buying commodity
Use the payment of certificate, integral, electronic account, it is therefore desirable to pass through cross-system distributing real time system, it is ensured that the purchase of user
Multiple payment process that movement is related to are bought all to execute in an affairs.
In cross-system distributed transaction processing method, it will usually using the scheme of TCC, wherein TCC includes three dynamic
Make, is try (attempting operation), confirm (confirmation operation), cancel (rolling back action), the cross-system point of the prior art respectively
Cloth issued transaction scheme can have an affairs coordinator, to control the process of entire TCC, related to distributed transaction
Interface can all rely on this affairs coordinator, once affairs coordinator goes wrong, will lead to entire service exception, there are centers
Change single-point phenomenon.
Therefore it provides a kind of system of cross-system distributed transaction processing method and distributing real time system, to avoid upper
Centralization single-point phenomenon is stated, is this field technical issues that need to address.
Summary of the invention
The object of the present invention is to provide the system of a kind of cross-system distributed transaction processing method and distributing real time system,
And computer equipment and computer readable storage medium, for solving the above problem of the existing technology.
To achieve the goals above, the present invention provides a kind of cross-system distributed transaction processing methods.
The cross-system distributed transaction processing method includes: that main system opens distributed transaction, wherein distributed transaction packet
Several subtransactions are included, each subtransaction is handled by a subsystem;Main system sends the trial for attempting to execute affairs to subsystem
Request;Subsystem executes in response to attempting to request and attempts operation;The implementing result for attempting operation is fed back to principal series by subsystem
System;Main system sends message to message service system according to the implementing result received, wherein when the execution knot that main system receives
When fruit is successfully, is sent to message service system and determine the confirmation message for executing affairs, when main system receives any execution
When as a result to fail, the rollback message that rollback executes affairs is sent to message service system;Message service system publication receives
Message;The message of subsystem monitoring information service system publication executes confirmation operation, works as prison when listening to confirmation message
When hearing rollback message, rolling back action is executed.
To achieve the goals above, the present invention provides a kind of systems of distributing real time system.
The system of the distributing real time system includes main system, subsystem and message service system, wherein main system is used for
Distributed transaction is opened, the trial request for attempting to execute affairs is sent to subsystem, wherein distributed transaction includes several sub- things
Business, each subtransaction are handled by a subsystem;Subsystem is used to execute in response to attempting to request and attempt operation, and will attempt
The implementing result of operation feeds back to main system;Main system is also used to be sent according to the implementing result received to message service system
Message, wherein when the implementing result that main system receives is successfully, is sent to message service system and determine execution affairs really
Recognize message, when main system receives any implementing result to fail, sends rollback to message service system and execute returning for affairs
Roll message;Message service system is for issuing the message received;Subsystem is also used to disappearing for monitoring information service system publication
Breath executes confirmation operation when listening to confirmation message, when listening to rollback message, executes rolling back action.
To achieve the goals above, the present invention provides a kind of computer equipments.
The computer equipment include memory, processor and storage on a memory and the meter that can run on a processor
Calculation machine program, processor realize the step of any one cross-system distributed transaction processing method provided by the invention when executing program
Suddenly.
To achieve the goals above, the present invention provides a kind of computer readable storage mediums.
The computer readable storage medium is stored thereon with computer program, this hair is realized when program is executed by processor
The step of any one cross-system distributed transaction processing method of bright offer.
Compared with prior art, at using cross-system distributed transaction processing method provided by the invention and distributed transaction
System, computer equipment and the storage medium of reason, at least the following technical effects are achieved:
Confirmation message, the confirmation message that subsystem is issued by monitoring information service system are issued by message service system
The each subtransaction of distributed transaction is uniformly processed, when executing the implementing result for attempting operation in any subsystem to fail, lead to
Message service system publication rollback message is crossed, the confirmation rollback message that subsystem is issued by monitoring information service system is unified back
It rolls, to the consistency of distributed transaction between the different subsystems of entirety guarantee, also, message service system only carries out news release,
It is more stable and reliable in cross-system distributing real time system compared to affairs coordinator, it avoids going out using affairs coordinator
The problem of existing centralization single-point.
Detailed description of the invention
Fig. 1 is the step flow chart for the cross-system distributed transaction processing method that the embodiment of the present invention one provides;
Fig. 2 is the flow diagram for the cross-system distributed transaction processing method that the embodiment of the present invention one provides;
Fig. 3 is the step flow chart of cross-system distributed transaction processing method provided by Embodiment 2 of the present invention;
Fig. 4 is the step flow chart for the cross-system distributed transaction processing method that the embodiment of the present invention three provides;
Fig. 5 is the block diagram for the distributing real time system system that the embodiment of the present invention six provides;
Fig. 6 is the schematic diagram for the computer equipment that the embodiment of the present invention seven provides.
Specific embodiment
In order to make the objectives, technical solutions, and advantages of the present invention clearer, with reference to the accompanying drawings and embodiments, right
The present invention is further elaborated.It should be appreciated that described herein, specific examples are only used to explain the present invention, not
For limiting the present invention.Based on the embodiments of the present invention, those of ordinary skill in the art are not before making creative work
Every other embodiment obtained is put, shall fall within the protection scope of the present invention.
Embodiment one
The embodiment of the present invention one provides a kind of cross-system distributed transaction processing method, which is related to principal series
The execution of affairs itself is completed in interaction between system, message service system and several subsystems by main system and several subsystems,
Message service system is used to for the message of main system being broadcast to each subsystem, and each subsystem carries out the monitoring of message.
Specifically, main system is the entrance that distributed transaction is opened, and each subsystem executes the subtransaction in distributed transaction,
Message service system is responsible for issuing confirmation message and rollback message that main system is sent, each subsystem monitoring information service system hair
The message of cloth executes corresponding movement according to the message listened to.For example, main system is store service system, subsystem is related to
Order placement service system, inventory service system etc., store service system occur primary transaction, order placement service system increase are needed to order
Single, inventory service system reduces inventory.
Fig. 1 is the step flow chart for the cross-system distributed transaction processing method that the embodiment of the present invention one provides, and Fig. 2 is this
The flow diagram for the cross-system distributed transaction processing method that inventive embodiments one provide provides interdepartmental about the embodiment
System distributed transaction processing method, specifically includes the following steps:
Step S101: main system opens distributed transaction.
Wherein, the entrance that main system is opened as affairs opens distributed transaction, and a distributed transaction includes several sons
Affairs, each subtransaction are handled by a subsystem, for example, when store service system is traded, based on the service system of store
System, it includes the distributed transaction for increasing order and reducing two subtransactions of inventory that main system, which is opened,.
Step S102: main system sends the trial request for attempting to execute affairs to subsystem.
After main system opens distributed transaction, is sent to the subsystem of each processing subtransaction attempt to execute affairs first
Attempt request, wherein attempting request may include the information such as the Transaction Identifier of subtransaction, for example, store service system is respectively to ordering
Single service system and inventory service system, which are sent, attempts request, and the trial request sent to order placement service system includes that mark " increases
Additional order is single " Transaction Identifier of this subtransaction, the trial request sent to inventory service system include mark " reducing inventory " this
The Transaction Identifier of one subtransaction.
Step S103: subsystem executes in response to attempting to request and attempts operation.
Wherein, it attempts operation (try) namely attempts to execute subtransaction, including completing all business needed for executing subtransaction
It checks, and reserves necessary service resources.Each subsystem carries out after receiving trial request for itself subtransaction
Attempt operation.
Step S104: the implementing result for attempting operation is fed back to main system by subsystem.
Wherein, implementing result includes successfully and failing, and when implementing result is successfully, illustrates that subsystem executes and attempts operation
When, it can complete to operate according to scheduled requirement, it, can not when illustrating that operation is attempted in subsystem execution when implementing result is failure
It completes to operate according to scheduled requirement, scheduled require to include executes the time, logic etc. is executed, for example, inventory service system is held
When trial of going operates, if inventory has been 0, when executing the trial operation of " reducing inventory ", library can be made by continuing reduction inventory
It saves as and negative occurs, be unsatisfactory for executing logic, implementing result is failure.
Attempting operation is not real " dress rehearsal " and " preview " for executing subtransaction, being equivalent to subtransaction is executed, not
Really the data in database are modified, no matter each subsystem has what kind of to execute knot after executing trial operation
Implementing result can be fed back to main system by fruit.
Step S105: main system sends message to message service system according to the implementing result received.
Wherein, when the implementing result that main system receives is successfully, that is, each subsystem can attempted to operate
Middle successful execution subtransaction, each subtransaction for illustrating that distributed transaction includes can be executed normally, can guarantee affairs
Consistency determines the confirmation message for executing affairs at this point, sending to message service system, so that each subsystem executes confirmation behaviour
Make (confirm), really completes the execution of all subtransactions.
When main system receives any implementing result as failure, illustrate exist not in subtransaction that distributed transaction includes
The subtransaction that can normally execute sends rollback to message service system and executes returning for affairs to guarantee the consistency of affairs
Message is rolled, so that subsystem executes rolling back action (cancel), will attempt to operate to carry out rollback, all subsystems return to initial shape
State.
Step S106: message service system issues the message received.
Message service system is different from affairs coordinator in the prior art, does not do the coordination and management of affairs, only does
Affairs coordinator is compared in the publication of message, more stable and reliable in cross-system distributing real time system.Message service system
Only as the publisher of message, the message sent to main system is issued, either confirmation message or rollback message, message
Service system can be issued as news release side.
Step S107: the message of subsystem monitoring information service system publication executes confirmation when listening to confirmation message
Operation executes rolling back action when listening to rollback message.
Each subsystem can integrated message monitor end, by message monitor end monitoring information service system publication message,
In, when carrying out news release, can give out information message service system queue, which is made of multiple message, each
Message may each comprise the Transaction Identifier of a subtransaction, and subsystem is by the Transaction Identifier in monitoring information, to determine whether to
It performs corresponding processing, when certain subsystem listens to the subtransaction that the Transaction Identifier that some message includes is subsystem processing
When Transaction Identifier, which needs to handle this message, specifically, when this message is to confirmation message, executes
Confirmation operation when this message is rollback message, executes rolling back action.That is, subsystem described in the step listens to really
Recognize message, refers to that subsystem listens to the affairs for the subtransaction that the Transaction Identifier that some confirmation message includes is subsystem processing
It identifies, subsystem described in the step listens to rollback message, refers to that subsystem listens to the thing that some rollback message includes
Business is identified as the Transaction Identifier of the subtransaction of subsystem processing.
Subsystem is given out information by monitoring information service system, and Lai Jinhang confirmation operation or rolling back action can guarantee
Distributed transaction is uniformly processed in each subsystem, avoids occurring handling inconsistent situation between different subsystems.
The cross-system distributed transaction processing method provided using the embodiment is disappeared by message service system publication confirmation
The each subtransaction of distributed transaction is uniformly processed by the confirmation message that monitoring information service system is issued in breath, subsystem,
It is to issue rollback message, subsystem by message service system when failing that any subsystem, which executes and attempts the implementing result of operation,
The confirmation rollback message issued by monitoring information service system unifies rollback, integrally to distributed thing between the different subsystems of guarantee
The consistency of business, also, message service system only carries out news release, affairs coordinator is compared, in cross-system distributed transaction
It is more stable and reliable in processing, avoid the problem that centralization single-point occur using affairs coordinator.
Embodiment two
Second embodiment of the present invention provides a kind of cross-system distributed transactions preferred on the basis of the above embodiment 1
Processing method, relevant portion can refer to above-described embodiment, it should be strongly noted that in this embodiment, main system is corresponding
It is provided with the first transaction table in database, decibel is provided with the second transaction table in the corresponding database of each subsystem.First things
The record of several distributed transactions is set in table, the record of every distributed transaction include the Transaction Identifier of distributed transaction with
And transaction status;The record of several subtransactions is set in the second things table, and the record of every subtransaction includes the thing of subtransaction
Business mark and transaction status, the Transaction Identifier of distributed transaction may include the Transaction Identifier of all subtransactions, wherein affairs
State include: affairs start, attempt to complete, in rollback, rollback is completed, confirmation neutralizes confirmation and completes.On this basis, Fig. 3 is
The step flow chart of cross-system distributed transaction processing method provided by Embodiment 2 of the present invention, as shown in figure 3, the embodiment has
Body comprises the following steps that
Step S201: main system is inserted into distributed transaction in the first transaction table.
The note of a new distributed transaction is written when opening distributed transaction in main system first in the first transaction table
Record, and set affairs for the transaction status in the record of the new distributed transaction of this and start.
Step S202: main system sends the trial request for attempting to execute affairs to subsystem.
Step S203: subsystem executes in response to attempting to request and attempts operation.
Step S204: subtransaction is inserted into the second transaction table.
The record of a new subtransaction is written after executing trial operation in subsystem in the second transaction table, and will
Transaction status in the record of the new subtransaction of this is set as attempting to complete.
Step S205: the implementing result for attempting operation is fed back to main system by subsystem.
Step S206: main system receives the implementing result that each subsystem is sent.
Step S207: the status modifier of distributed transaction in the first transaction table is to attempt to complete by main system.
Step S208: main system sends message to message service system.
Step S209: main system modifies the information in the first transaction table.
Wherein, after main system sends confirmation message to message service system, main system modifies the information in the first transaction table,
It is specifically that confirmation is completed by the status modifier of distributed transaction in the first transaction table, main system is sent back to message service system
After rolling message, main system modifies the information in the first transaction table, is specifically rollback completion by the status modifier of distributed transaction.
Step S210: message service system issues the message received.
Step S211: the message of subsystem monitoring information service system publication.
Step S212a: for subsystem after listening to confirmation message, the status modifier by subtransaction in the second transaction table is true
In recognizing.
Step S213a: subsystem executes confirmation operation.
Step S214a: the status modifier of subtransaction in the second transaction table is that confirmation is completed by subsystem.
Step S212b: the status modifier of subtransaction in the second transaction table is back by subsystem after listening to rollback message
In rolling.
Step S213b: subsystem executes rolling back action.
Step S214b: the status modifier of subtransaction in the second transaction table is rollback completion by subsystem.
The cross-system distributed transaction processing method provided using the embodiment, is avoiding occurring using affairs coordinator
On the basis of the problem of centralization single-point, main system safeguards the first transaction table, and subsystem safeguards the second things table, in each movement
When node is completed, modify the transaction status of respective transaction in the first things table and the second transaction table, can from the first transaction table and
The progress of main system and subsystem during distributing real time system is got in second things table.
Embodiment three
The embodiment of the present invention three provides a kind of cross-system distributed transaction preferred on the basis of above-described embodiment two
Processing method, relevant portion can refer to above-described embodiment, it should be strongly noted that in this embodiment, cross-system is distributed
Transaction methods further relate to scheduler task system, which passes through the thing in the first transaction table and the second things table
Business state is scheduled the execution of affairs, wherein completes about between main system, subsystem and message service system three
The part of cross-system distributing real time system can refer to the associated description of above-described embodiment two, and details are not described herein again, in this implementation
In example, the process that scheduler task system is scheduled the execution of affairs is stressed, Fig. 4 is provided by Embodiment 2 of the present invention
The step flow chart of cross-system distributed transaction processing method, on the basis of above-described embodiment two, as shown in figure 4, the implementation
Example three include thes steps that as follows:
Step S215: the state of distributed transaction and the second transaction table neutron in the first transaction table of scheduler task system queries
The state of affairs.
It wherein, can be according to the affairs of subtransaction in the Transaction Identifier of distributed transaction in the first transaction table and the second transaction table
Mark is inquired, for example, the Transaction Identifier of distributed transaction is ABC, corresponding second transaction table neutron in the first transaction table
The Transaction Identifier of affairs is A, B or C.
Step S216: when the state of distributed transaction in the first transaction table is confirmation completion, subtransaction in the second transaction table
State be attempt complete when, scheduler task system to subsystem send execute confirmation operation order.When in the first transaction table
The state of distributed transaction is rollback completion, and the state of subtransaction is scheduler task system when attempting to complete in the second transaction table
The order for executing rolling back action is sent to subsystem.
Namely main system has sent confirmation message to message service system, but subsystem is not carried out confirmation behaviour
Make, at this point, scheduler task system sends the order for executing confirmation operation to subsystem;Main system is sent out to message service system
Rollback message is sent, but subsystem is not carried out rolling back action, at this point, scheduler task system is sent to subsystem executes rollback
The order of operation.
Step S217: subsystem executes confirmation operation, receives and execute back when receiving the order for executing confirmation operation
When rolling the order of operation, rolling back action is executed.
Wherein, the order for the execution confirmation operation that subsystem is sent in response scheduling task system, after executing confirmation operation,
It is that confirmation is completed by the status modifier of subtransaction in the second transaction table;Subsystem is returned in the execution that response scheduling task system is sent
The order of operation is rolled, is rollback completion by the status modifier of subtransaction in the second transaction table after executing rolling back action.
The cross-system distributed transaction processing method supplied using the embodiment, is being avoided using affairs coordinator and in occurring
The problem of heart single-point, and main system and subsystem are got in distributed transaction from the first transaction table and the second things table
On the basis of progress in treatment process, by message service system by main system and subsystem operate inconsistent subtransaction into
Row scheduling executes, and specifically, when the message transmitted by message service system executes failure, is repeated by scheduler task system
It executes, namely subsystem is not executed normally by scheduler task system confirmation operation or rolling back action retransmission life
It enables, ensure that the reliability during cross-system distributing real time system.
Example IV
The embodiment of the present invention four provides a kind of cross-system distributed transaction preferred on the basis of above-described embodiment three
Processing method, wherein identical part can refer to the associated description of above-described embodiment two and embodiment three, and details are not described herein again,
In the example IV, the record of every distributed transaction further includes the number of retries of subtransaction in the second transaction table, wherein
Scheduler task system can repeatedly inquire the state of subtransaction in the state of distributed transaction and the second transaction table in the first transaction table,
And corresponding order is sent according to the difference whereabouts subsystem checked and accepted, subsystem often receives the primary life for executing confirmation operation
It enables or often receives the primary order for executing rolling back action, corresponding subtransaction number of retries adds 1 in the second transaction table.
In above-mentioned steps S217, after subsystem receives the order for executing confirmation operation, before executing confirmation operation, or
Person before executing rolling back action, modifies after subsystem receives the order for executing rolling back action and reads the second transaction table neutron thing
It is engaged in corresponding number of retries, wherein the initial value of the corresponding number of retries of subtransaction is 0 in the second transaction table.Subsystem executes
When confirmation operation, first according to the corresponding number of retries of subtransaction read in the second transaction table, then according to the ladder time
Interval executes confirmation operation;It is first corresponding according to the subtransaction read in the second transaction table when subsystem executes rolling back action
Number of retries, according to ladder time interval execute rolling back action.For example, the interval of ladder time interval is 10*2n, unit is
Second, n is number of retries, when retrying for the first time, it is spaced 20 seconds execution confirmation operations or rolling back action, when retrying for the second time,
It is spaced 40 seconds execution confirmation operations or rolling back action.
The cross-system distributed transaction processing method provided using the embodiment is passing through scheduler task system to subsystem
The confirmation operation or rolling back action not executed normally, which retransmit, orders, during guarantee cross-system distributing real time system
While reliability, ladder time interval is calculated according to number of retries, is adjusted according to ladder time interval and is executed operation
Time, the number retried is more, and the time that interval executes operation is longer, avoids not having in a short time the reason of cannot normally executing
There is change and causes to repeat the order wasting of resources.
Embodiment five
It is distributed that the embodiment of the present invention five provides one kind preferred cross-system on the basis of above-described embodiment two to four
Transaction methods, wherein identical part can refer to the associated description of above-described embodiment two to example IV, no longer superfluous herein
It states, in the embodiment five, is additionally provided with preposition table and main table in the corresponding database of subsystem, wherein preposition table and main table
Identical before carrying out distributing real time system, service inquiry operation all carries out on main table, realizes data strong consistency, business
DML operation (data manipulation language) is operated on preposition table first, complete to all preposition table handlings
Finish, then is synchronized on each autonomous table simultaneously.Specifically:
In step S203, it includes: that subsystem operates data in preposition table that subsystem, which executes the step of attempting operation, packet
How the increase, deletion and modification for including data, specifically modify data, related with the content of subtransaction.
In step S213a, subsystem execute confirmation operation the step of include: that subsystem keeps main table synchronous with preposition table;Step
In rapid S213b, the step of subsystem executes rolling back action, which includes: subsystem, restores preposition table to executing before attempting operation
State, such as UNDO operation is done on preposition table.
Further, operation, confirmation operation and rolling back action can will be attempted and is encapsulated as interface, subsystem is above-mentioned in execution
When each operation, by calling corresponding interface to complete operation.
It is possible to further identify the interface for executing trial and operating in such a way that addition is explained, execute confirmation operation
Interface and the interface for executing rolling back action.
Specifically: subsystem operate the step of data in preposition table include: subsystem call execute attempt operation connect
Mouthful, by executing the data in the preposition table of interface operation for attempting operation;The step packet that subsystem keeps main table synchronous with preposition table
Include: subsystem calls the interface for executing confirmation operation, and the interface by executing confirmation operation keeps main table synchronous with preposition table;Divide and is
The step of preposition table is restored the state to before executing trial operation of uniting includes: that subsystem calls connecing for execution rolling back action
Mouthful, the interface by executing rolling back action restores preposition table to the state executed before attempting operation.
In step S202, when main system sends the trial request for attempting to execute affairs to subsystem, attempting request includes
Allocating time and time-out time;
Subsystem is after executing trial operation, before implementing result is fed back to main system, calculates current time and adjusts
The difference of the allocating time of the interface of operation is attempted with execution, and judges whether the difference is greater than or equal to time-out time, wherein
When difference is greater than or equal to time-out time, the implementing result of operation is attempted for failure, when subsystem can not be according to normally patrolling
When collecting the data in the preposition table of operation, the implementing result of operation is attempted for failure, when subsystem can be according to normal logic operation
When data and above-mentioned difference in preposition table are less than time-out time, the implementing result for attempting operation is successfully.
Embodiment six
The embodiment of the present invention six provides a kind of system of distributing real time system, which corresponds to above-mentioned cross-system distribution
Formula transaction methods, corresponding technical characteristic and technical effect can be referred to mutually, the system packet of the distributing real time system
Include main system 10, subsystem 20 and message service system 30.
Main system 10 sends the trial request for attempting to execute affairs to subsystem 20 for opening distributed transaction, wherein
Distributed transaction includes several subtransactions, and each subtransaction is handled by a subsystem 20.Subsystem 20 is used in response to attempting
Request executes and attempts operation, and the implementing result for attempting operation is fed back to main system 10.Main system 10 is also used to according to reception
The implementing result arrived sends message to message service system 30, wherein when the implementing result that main system 10 receives is successfully,
It is sent to message service system 30 and determines the confirmation message for executing affairs, when main system 10 receives any implementing result as failure
When, the rollback message that rollback executes affairs is sent to message service system 30.Message service system 30 is used to issue to receive
Message.Subsystem 20 is also used to the message of the publication of monitoring information service system 30, when listening to confirmation message, executes confirmation behaviour
Make, when listening to rollback message, executes rolling back action.
Optionally, the first transaction table is provided in the corresponding database of main system 10, in the corresponding database of subsystem 20
It is provided with the second transaction table;The step of unlatching distributed transaction of main system 10 includes: that main system 10 is inserted into the first transaction table
Distributed transaction, and the state that distributed transaction is arranged starts for affairs.Main system 10 is after receiving implementing result, to disappearing
Before ceasing the transmission message of service system 30, it is also used to complete the status modifier of distributed transaction for trial;Main system 10 is also used
It is that confirmation is completed by the status modifier of distributed transaction after Yu Xiang message service system 30 sends confirmation message;Main system 10
It is rollback completion by the status modifier of distributed transaction after being also used to send rollback message to message service system 30;Subsystem
20 are also used to after executing trial operation, and the state that subtransaction is inserted into the second transaction table, and subtransaction is arranged is to have attempted
At;Subsystem 20 is also used to after listening to confirmation message, is confirmation by the status modifier of subtransaction before executing confirmation operation
In;Subsystem 20 is also used to after executing confirmation operation, is that confirmation is completed by the status modifier of subtransaction;Subsystem 20 is also used to
It is in rollback by the status modifier of subtransaction before executing rolling back action after listening to rollback message;Subsystem 20 is also used to
It is rollback completion by the status modifier of subtransaction after executing rolling back action.
Optionally, the system of the distributing real time system further includes scheduler task system, and the scheduler task system is for looking into
The state for asking subtransaction in the state of distributed transaction and the second transaction table in the first transaction table, when distributed in the first transaction table
The state of affairs is that confirmation is completed, and the state of subtransaction is when attempting to complete in the second transaction table, and scheduler task system is to point being
System 20 sends the order for executing confirmation operation;When the state of distributed transaction in the first transaction table is rollback completion, the second affairs
The state of subtransaction is when attempting to complete in table, and scheduler task system sends the order for executing rolling back action to subsystem 20;Point
When system 20 is also used to receive the order for executing confirmation operation, confirmation operation is executed, receives the order for executing rolling back action
When, execute rolling back action.
Optionally, subsystem 20 is also used to after receiving the order for executing confirmation operation, before executing confirmation operation, or
Person after receiving the order for executing rolling back action, before executing rolling back action, modifies and reads subtransaction in the second transaction table corresponding to
Number of retries, wherein subsystem 20, which often receives the primary order for executing confirmation operation or often receives, primary executes rollback
The order of operation, the corresponding number of retries of subtransaction adds 1 in the second transaction table;The step of execution confirmation operation of subsystem 20, wraps
Include: subsystem 20 is held according to the corresponding number of retries of the subtransaction read in the second transaction table according to ladder time interval
Row confirmation operation;The step of execution rolling back action of subsystem 20 includes: that subsystem 20 is read according in the second transaction table
The corresponding number of retries of subtransaction executes rolling back action according to ladder time interval.
Optionally, preposition table and main table are additionally provided in the corresponding database of subsystem 20, wherein preposition table and main table exist
It is identical before carrying out distributing real time system;The step of operation is attempted in the execution of subsystem 20 includes: that subsystem 20 operates preposition table
In data;The step of execution confirmation operation of subsystem 20 includes: that subsystem 20 keeps main table synchronous with preposition table;Subsystem 20 is held
The step of row rolling back action includes: that subsystem 20 restores preposition table to the state executed before attempting operation.
Optionally, subsystem 20 operate the step of data in preposition table include: subsystem 20 call execute attempt operation
Interface, pass through execute attempt operation the preposition table of interface operation in data;When attempting to request to include allocating time and is overtime
Between;Subsystem 20 is also used to after executing trial operation, before implementing result is fed back to main system 10, calculates current time
Whether it is greater than or equal to time-out time with the difference of allocating time, when difference is greater than or equal to time-out time, attempts operation
Implementing result is failure.
Optionally, when subsystem 20 can be less than time-out time according to the data in the preposition table of predetermined logic operations and difference
When, the implementing result for attempting operation is successfully;When subsystem 20 can not be according to data in the preposition table of predetermined logic operations,
The implementing result for attempting operation is failure.
Optionally, the step that subsystem 20 keeps main table synchronous with preposition table includes: that subsystem 20 calls execution confirmation operation
Interface, by execute confirmation operation interface keep main table synchronous with preposition table;Preposition table is restored to execution to taste by subsystem 20
The step of state before examination operation includes: that subsystem 20 calls the interface for executing rolling back action, passes through and executes rolling back action
Interface restores preposition table to the state executed before attempting operation.
Optionally, addition explain by way of identify execute attempt operation interface, execute confirmation operation interface and
Execute the interface of rolling back action.
Embodiment seven
The embodiment of the present invention seven also provides a kind of computer equipment, can such as execute the smart phone of program, tablet computer,
Laptop, desktop computer, rack-mount server, blade server, tower server or Cabinet-type server (including
Server cluster composed by independent server or multiple servers) etc..The computer equipment 02 of the present embodiment is at least wrapped
It includes but is not limited to: memory 021, the processor 022 of connection can be in communication with each other by system bus, as shown in Figure 6.It may be noted that
, Fig. 6 illustrates only the computer equipment 02 with component 021-022, it should be understood that being not required for implementing all
The component shown, the implementation that can be substituted is more or less component.
In the present embodiment, memory 021 (i.e. readable storage medium storing program for executing) includes flash memory, hard disk, multimedia card, card-type memory
(for example, SD or DX memory etc.), random access storage device (RAM), static random-access memory (SRAM), read-only memory
(ROM), electrically erasable programmable read-only memory (EEPROM), programmable read only memory (PROM), magnetic storage, magnetic
Disk, CD etc..In some embodiments, memory 021 can be the internal storage unit of computer equipment 02, such as the calculating
The hard disk or memory of machine equipment 02.In further embodiments, memory 021 is also possible to the external storage of computer equipment 02
The plug-in type hard disk being equipped in equipment, such as the computer equipment 02, intelligent memory card (Smart Media Card, SMC), peace
Digital (Secure Digital, SD) card, flash card (Flash Card) etc..Certainly, memory 21 can also both include meter
The internal storage unit for calculating machine equipment 02 also includes its External memory equipment.In the present embodiment, memory 021 is commonly used in storage
It is installed on the operating system and types of applications software of computer equipment 02, such as the distributing real time system of above-described embodiment is
The program code etc. of system.In addition, memory 021 can be also used for temporarily storing all kinds of numbers that has exported or will export
According to.
Processor 022 can be in some embodiments central processing unit (Central Processing Unit, CPU),
Controller, microcontroller, microprocessor or other data processing chips.The processor 022 is commonly used in control computer equipment
02 overall operation.In the present embodiment, program code or processing number of the processor 022 for being stored in run memory 021
According to, such as the system etc. of operation distributing real time system.
Embodiment eight
The embodiment of the present invention eight also provides a kind of computer readable storage medium, such as flash memory, hard disk, multimedia card, card-type
It is memory (for example, SD or DX memory etc.), random access storage device (RAM), static random-access memory (SRAM), read-only
Memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read only memory (PROM), magnetic storage
Device, disk, CD, server, App are stored thereon with computer program using store etc., real when program is executed by processor
Existing corresponding function.The system that the computer readable storage medium of the present embodiment is used for distributed storage issued transaction, by processor
The cross-system distributed transaction processing method of above-described embodiment is realized when execution.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side
Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases
The former is more preferably embodiment.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field, is included within the scope of the present invention.