Transaction Service

Transactions are best defined using the tried-and-true ACID characteristics, which are familiar to researchers in databases. ACID refers to units of work that are:

Atomic

Any and all actions carried out as part of the transaction are committed when the transaction is committed, or undone/cancelled if the transaction is cancelled (rolled back).

Consistent

The actions within a transaction produce results that are consistent.

Isolated

Transactions don’t see each other’s effects until they are committed. If they are rolled back, their effects aren’t seen by other contexts.

Durable

If a transaction completes successfully, its effects are made permanent.

The Transaction Service defines interfaces that allow distributed objects to create and engage in transactional interactions. A transactional interaction can involve a series of remote method calls, and if a significant error is encountered along the way, the transaction can be rolled back and the effects of all previous method calls are to be undone, as if the transaction never started in the first place. When a transactional client starts a transaction and then makes remote method calls, its transaction context is propagated along with the requests. Only transactional objects (i.e., objects whose internal actions and side effects should be undone by a rollback of the transaction, and who participate in the Transaction Service protocol) will heed the transaction context information.

An important item to note about the Transaction ...

Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.