J2EE technical specifications (6) -- JTA (core concepts, acid attributes)

Source: Internet
Author: User
What is the core concept of transaction processing?
  • A transaction is a mechanism that treats a group of operations as an operation.
  • In transaction processing, either all operations are executed, or all operations are not executed.
  • The operations involved in transactions may depend on many different databases and servers.
Acid attribute of Transaction Processing
  • A transaction is defined by the acid attribute of a series of acronyms.
  • Acid stands:
    • Atomic atomicity
    • Consistent consistency
    • Isolated independence
    • Durable persistence

Let's take an example: the funds transfer process without transactions:

Successful transfer:

Failed Transfer Process:

We can see the failed transfer process: the total amount is reduced, and the account status is inconsistent.

Let's take a look at the successful transaction Transfer Process:

A. The transaction changes will be buffered.

If the transfer is successful, changes will be submitted (for permanent changes)

What is distributed transaction?
  • A resource, such as a database, is controlled by software called Resource Manager (RM.
  • A local transaction is a transaction that processes a single resource manager.
  • Distributed transactions are transactions that collaborate or span multiple resource managers.
  • The collaboration between multiple resource managers is completed by the Transaction Manager.
  • A transaction usually refers to the transaction context ).
Two-phase submission Protocol
  • 2 PC (two-phase commit) protocol uses two steps to Commit Changes to a distributed transaction
  • Phase 1 Requests all resource managers to prepare for implementation changes. If any of them is not ready, the transaction will be unexpectedly interrupted.
  • Phase 2 Requests all resource managers to actually submit and implement permanent changes
  • The global transaction ID (Xid) is used to track all changes related to distributed transactions.
XA (Extended Architecture)

XA:

  • Is the interface used between WebLogic Server and Resource Manager
  • Implement two-phase submission Protocol
  • Allow programming to control the resource manager involved by a distributed firm

Transaction and Resource Manager
  • A transaction Manager works with several resource managers

  • The two-phase commit protocol is used for collaborative transactions.

Let's take a look at the successful two-phase submission:

We can easily see that:

Phase 1: Preparation

Phase 2: Implement submission

This section mainly describes the core concepts and acid attributes of transactions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.