The Jini Distributed Transactions provide a two-phase commit protocol. The two-phase commit protocol defines the communication patterns that allow distributed objects and resources to wrap a set of operations in such a way that they appear to be a single operation. The protocol requires a manager that will enable consistent resolution of the operations by a guarantee that all participants will eventually know whether they should commit the operations (roll forward) or abort them (roll backward). A participant can be any object that supports the participant contract by implementing the appropriate interface. Participants are not limited to databases or other persistent storage services.
To create the Jini Transaction Manager:
To create the transaction:
Using the transaction and committing:
You can always extend the transaction's lease time or cancel it via the lease object:
When using the Jini transaction Manager, consider using the Transaction.commit(long waitFor) and Transaction.abort(long waitFor) methods – these return acknowledgements to the caller application, only after the transaction commit or abort operation has been fully completed by all transaction participants, or until the timeout period expires.
When using the Transaction.abort() and the Transaction.commit() methods, the client gets the acknowledgement immediately after the abort or commit call without waiting for all transaction participants to complete. This may lead to inconsistency.
The waitFor parameter timeout allows you to choose the maximum amount of time you would like to wait for the transaction to be completed by all participants.
This behavior will not happen when using the Local Transaction Manager, since the client gets an acknowledgement for the commit or abort operation only after the space has completed the commit or abort processing.
In general, you can look up any Jini service based on different attributes, name, interface etc. You can have several Jini Transaction Managers running. Once you got a proxy to one of them you should be OK.
The default name for the Jini Transaction Manager is Transaction Manager.
You can get this information by:
Double click the TransactionManager, and the ServiceItem Editor will be displayed with the Transaction Manager properties:
We need your help to improve this wiki site. If you have any suggestions or corrections, write to us at firstname.lastname@example.org. Please provide a link to the wiki page you are referring to.