Survival of the fittest Jini services, Part 3
Implement transactional Jini services
By Frank Sommers, JavaWorld.com, 10/19/01
- Digg
- Reddit
- SlashDot
- Stumble
- del.icio.us
- Technorati
- dzone
In my last
Jiniology article, I described distributed transactions that enable multiple Jini services to reliably coordinate their work to support
a common objective: When services enroll in a transaction, they guarantee that any outcome agrees with a set of conditions,
or
invariables.
For example, an online bookstore, implemented as a Jini service, uses a credit card service for payment processing. By enrolling
the credit card service in a transaction, a purchase guarantees that either the credit card is charged and the book ships, or that neither action takes place.
A transaction promises certain computation invariables that define the transaction's semantics. Jini lets you implement any
transaction semantics. You can decide what guarantees cooperating services must provide, and implement your services according
to those guarantees.
Regardless of specific invariables, you can use the Jini transaction coordinator to arrange your transaction's commitment,
employing the two-phase commit protocol. In Part 2 of this series, I described how you use that coordinator as a client for the two-phase commit protocol. In this article,
I will focus on techniques for writing transaction participant Jini services.
Read the whole "Survival of the Fittest Jini Services" series:
Jini, transaction monitors, and application servers
While Jini affords you the flexibility to implement any type of transaction semantics, you want to ensure that, at the minimum,
transactions preserve your services' information integrity. To this effect, the Jini Transaction Specification describes a default transaction semantics, guaranteeing the ACID properties: atomicity, consistency, isolation, and durability.
As you shall see, you need the ACID properties to preserve the integrity of shared data. Most transaction processing systems
-- including those used in many J2EE (Java 2 Platform, Enterprise Edition) application servers -- automatically enforce these
guarantees. Commonly, you can enforce transaction semantics by maintaining containers in which objects can execute during
transactions. You can then make these containers ensure transactional semantics for the objects they manage. A significant
portion of a J2EE application server's code maintains container objects and their relationships to business-specific Java
objects. At the price of increased system complexity, automating transaction management offers you convenience. This convenience
is one reason for the success of transaction processing (TP) monitors, as well as J2EE application servers.
Most programmers are familiar with transaction processing in database management systems (DBMS) as well as application servers.
Commercial DBMS products often provide an API for accessing transactions from client programs. In the JDBC (Java Database
Connectivity) API, for example, the java.sql.Connection interface lets you control a transaction's commitment via the commit() and rollback() methods. When programming with JDBC, you don't have to know how the underlying DBMS guarantees a transaction's semantics
-- the DBMS automates that task for the objects (records) it manages, and the API acts as a facade to that functionality.
- Digg
- Reddit
- SlashDot
- Stumble
- del.icio.us
- Technorati
- dzone
Resources
- Download the source code for this article
http://www.javaworld.com/javaworld/jw-10-2001/jini/jini.zip
- The Jini Transaction Specification
http://sun.com/jini/specs/jini1.1html/txn-spec.html
- Read Frank Sommers's complete "Survival of the Fittest Jini Services" series in JavaWorld:
- Read this recent ACM SIGMOD conference panel, "Application ServersBorn-Again TP Monitors for the Web?" organized by IBM's
C. Mohan (access to the abstract requires ACM membership)
http://www.acm.org/sigmod/sigmod01/eproceedings/
- The Open Group's XA specification for distributed transaction coordination
http://www.opengroup.org/pubs/catalog/c193.htm
- Transaction ProcessingConcepts and Techniques, Jim Gray and Andreas Reuter (Morgan Kaufmann, 1993; ISBN1558601902) is the most comprehensive book on transactions. With
its 1,000-plus pages chock-full of brilliant insights, it is not for the faint of heart, but is a very rewarding read. Gray
and Reuter invented many of the concepts presented in the book
http://www.mkp.com/books_catalog/catalog.asp?ISBN=1-55860-190-2
- Phil Bernstein's Principles of Transaction Processing for the Systems Professional (Morgan Kaufmann, 1996; ISBN1558604154) is an excellent introduction to transaction processing. It also gives a grand tour
of all significant transaction processing systems in use today
http://www.mkp.com/books_catalog/catalog.asp?ISBN=1-55860-415-4
- Gerhard Weikum and Gottfried Vossen's Transactional Information SystemsTheory, Algorithms, and the Practice of Concurrency Control and Recovery (Morgan Kaufmann, 2001; ISBN1558605088) focuses on recent advances in transaction models and their formal analysis. The book
also discusses crash recovery techniques for object systems, which is relevant to high-availability Jini services
http://www.mkp.com/books_catalog/catalog.asp?ISBN=1-55860-508-8
- A complete listing of Jiniology articles
http://www.javaworld.com/javaworld/topicalindex/jw-ti-jiniology.html
- "Make Room for JavaSpaces, Part 4," Eric Freeman and Susanne Hupfer (JavaWorld, April 2000) explores Jini transactions with JavaSpaces
http://www.javaworld.com/javaworld/jw-04-2000/jw-0421-jiniology.html
- Bill Venners maintains a Jini FAQ here
http://www.artima.com
- The Jini community Website has pointers to all things related to Jini
http://www.jini.org
- Those interested in deploying Jini services in business environments might be interested in the Sun Jini page, which contains
success stories, whitepapers, and more
http://www.sun.com/jini
- A good Website dedicated to Sir Francis Bacon
http://www.luminarium.org/sevenlit/bacon/
- For more articles on Jini, browse JavaWorld's Topical Index
http://www.javaworld.com/channel_content/jw-jini-index.shtml
- Subscribe to JavaWorld's free weekly email newsletters
http://www.idg.net/jw-subscribe
- You'll find a wealth of IT-related articles from our sister publications at IDG.net