16.

previous chapter table of contents next chapter
  

TransactionParticipant

When an object becomes a participant listener in a transaction, it allows the transaction manager to call various methods :

 public interface TransactionParticipant ... {     int prepare(TransactionManager mgr, long id) throws ...;     void commit(TransactionManager mgr, long id) throws ...;     void abort(TransactionManager mgr, long id) throws ...;     int prepareAndCommit(TransactionManager mgr, long id) throws ...; } 

These methods are triggered by calls made upon the transaction manager. For example, if one client calls the transaction manager to abort, then the transaction manager calls all the listeners to abort.

The "normal" mode of operation (that is, when nothing goes wrong with the transaction) is for a call to be made on the transaction manager to commit. It then enters the two-phase commit stage where it asks each participant listener to first prepare() and then to either commit() or abort() .

  


A Programmer[ap]s Guide to Jini Technology
A Programmer[ap]s Guide to Jini Technology
ISBN: 1893115801
EAN: N/A
Year: 2000
Pages: 189

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net