1 / 7

Transactions

Transactions. Example: Application development framework (in class) Applying Transactions to applications ACID Test Object Transactions Command Pattern (handout). ACID Test. Atomic: Indivisble unit of operation. If a single operation fails, the whole transaction fails.

hardinga
Download Presentation

Transactions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Transactions • Example: Application development framework (in class) • Applying Transactions to applications • ACID Test • Object Transactions • Command Pattern (handout)

  2. ACID Test • Atomic: • Indivisble unit of operation. If a single operation fails, the whole transaction fails. • Ensures that the state of the system remains valid at all times • Completed with a “commit” or “rollback” in databases • Network atomicity requires 2 phase commit.

  3. ACID Test • Consistency: • Must ensure that all commands within a transaction conform to the constraints placed on the application. • Data must remain in a consistent state.

  4. ACID Test • Isolation: • Every transaction has a consistent view of the system regardless of other, concurrent transactions. • Concurrency issues are often dealt with using locks • Optimistic locking • Pessimistic locking • Locking can lead to starvation and deadlock.

  5. ACID Test • Durability: • Once a transaction has been completed, it's effects remain in effect even in the event of a system failure. • Durability is often achieved through the use of transaction logs. • Other methods include mirroring or replication

  6. Object Transactions • Most databases support transactions. • Several SQL statements can be grouped together and executed as a unit. • Transactions can be committed or rolledback. • Database transactions usually involve changes to multiple tables. • Object transactions work on groups of objects rather than groups of tables. • There exist many frameworks which support object transaction models • JTA – Java Transaction API • CORBA's OTS (Object Transaction Service)

  7. Command Pattern • ACID Transactions can be implemented using the Command design pattern. • Most command objects have an execute and undo method. • Execute is part of commit process • Undo is part of rollback process • The command must contain enough information so that it can complete the transaction or revert the transaction • If the command is half completed and an error occurs, it must undo whatever state changes have already been completed.

More Related