Site Tools


Sidebar

Smart Card Solution

User Manual

JavaCard API Samples

Java Card Specification

Knowledge Sharing

javacard:jcre:7.2_transactions

7.2 Transactions

An applet might need to atomically update several different fields or array components in several different objects. Either all updates take place correctly and consistently, or else all fields or components are restored to their previous values.

The Java Card platform supports a transactional model in which an applet can designate the beginning of an atomic set of updates with a call to the JCSystem.beginTransaction method. Each object update after this point is conditionally updated. The field or array component appears to be updated (reading the field or array component back yields its latest conditional value) but the update is not yet committed.

When the applet calls JCSystem.commitTransaction, all conditional updates are committed to persistent storage. If power is lost or if some other system failure occurs prior to the completion of JCSystem.commitTransaction, all conditionally updated fields or array components are restored to their previous values. If the applet encounters an internal problem or decides to cancel the transaction, it can programmatically undo conditional updates by calling JCSystem.abortTransaction.

javacard/jcre/7.2_transactions.txt · Last modified: 2017/05/13 04:07 (external edit)