主权项 |
1. A method of implementing atomic transactions in a system, said method comprising:
requesting in a user program a transaction identifier for an atomic transaction; generating said transaction identifier in a transaction manager in response to said requesting; specifying in said user program a plurality of combinations, wherein each of said plurality of combinations contains said transaction identifier, a task procedure, and a rollback procedure, wherein each combination indicates that the rollback procedure is to be executed if the execution of the corresponding task procedure in the combination is completed and if said atomic transaction is to be aborted, wherein said task procedure implements a part of said atomic transaction and said rollback procedure is designed to rollback said task procedure; executing a set of task procedures in a sequential order according to said user program, wherein said set of task procedures are contained in said task procedures specified in said plurality of combinations; keeping track of a set of rollback procedures corresponding to said set of task procedures, each of said set of rollback procedures being determined based on a combination corresponding to an executed task procedure contained in said set of task procedures, said combination being contained in said plurality of combinations specified in said user program, wherein said set of rollback procedures are kept track of external to said user program in response to said executing of the corresponding task procedures; and executing said set of rollback procedures in a reverse order of said sequential order if said atomic transaction is to be aborted, wherein said rollback procedure is specified as a separate procedure from said task procedure in said user program, wherein said user program contains groups of instructions to implement respective program logic for each of said task procedure and said rollback procedure, and whereby each user program has corresponding custom logic specified by a user for each of the rollback procedures. |