jcrespec07transact.html
来自「JAVA CARD 开发包规格说明,版本为2.2.2」· HTML 代码 · 共 192 行 · 第 1/2 页
HTML
192 行
<HR NOSHADE SIZE=1><BR><BR><HR NOSHADE SIZE=1><TABLE CLASS="TipNote" DIR="LTR" WIDTH="100%" SUMMARY="TipNote"><COLGROUP SPAN="1" WIDTH="100%"><TR ALIGN="left" VALIGN="top"><TD ROWSPAN="1" COLSPAN="1" ABBR="TipNoteText"><P CLASS="TipNote"><B CLASS="TipNote">Note - </B><A NAME="pgfId-407165"></A>Object space used by instances created during the transaction that failed due to power loss or card reset can be recovered by the Java Card RE.</P></TD></TR></TABLE><HR NOSHADE SIZE=1><BR><H2 CLASS="Head1"><A NAME="pgfId-407175"></A><DIV><HR ALIGN=left SIZE=6 WIDTH=15% noshade></DIV>7.6 <A NAME="89721"></A>Aborting a <A NAME="marker-411730"></A>Transaction</H2><P CLASS="Paragraph"><A NAME="pgfId-407177"></A>Transactions can be aborted either by an applet or by the Java Card RE. </P><BR><HR NOSHADE SIZE=1><TABLE CLASS="TipNote" DIR="LTR" WIDTH="100%" SUMMARY="TipNote"><COLGROUP SPAN="1" WIDTH="100%"><TR ALIGN="left" VALIGN="top"><TD ROWSPAN="1" COLSPAN="1" ABBR="TipNoteText"><P CLASS="TipNote"><B CLASS="TipNote">Note - </B><A NAME="pgfId-411439"></A>The contents of an array component that is updated using the <KBD CLASS="Filename-Command">Util.arrayCopyNonAtomic</KBD> method or the <KBD CLASS="Filename-Command">Util.arrayFillNonAtomic</KBD> method while a transaction is in progress are not predictable following the abortion of the transaction.</P></TD></TR></TABLE><HR NOSHADE SIZE=1><BR><H3 CLASS="Head2"><A NAME="pgfId-407185"></A>7.6.1 Programmatic Abortion</H3><P CLASS="Paragraph"><A NAME="pgfId-407187"></A>If an applet encounters an internal problem or decides to cancel the transaction, it can programmatically undo conditional updates by calling <KBD CLASS="Filename-Command">JCSystem.abortTransaction</KBD>. If this method is called, all conditionally updated fields and array components since the previous call to <KBD CLASS="Filename-Command">JCSystem.beginTransaction</KBD> are restored to their previous values, and the <KBD CLASS="Filename-Command">JCSystem.transactionDepth</KBD> value is reset to <KBD CLASS="Filename-Command">0</KBD>.</P><H3 CLASS="Head2"><A NAME="pgfId-410139"></A>7.6.2 Abortion by the Java Card RE</H3><P CLASS="Paragraph"><A NAME="pgfId-410156"></A>If an applet returns from the <KBD CLASS="Filename-Command">select</KBD>, <KBD CLASS="Filename-Command">deselect</KBD>, <KBD CLASS="Filename-Command">process</KBD>, or <KBD CLASS="Filename-Command">install</KBD> methods when an applet initiated transaction is in progress, the Java Card RE automatically aborts the transaction and proceeds as if an uncaught exception was thrown.</P><P CLASS="Paragraph"><A NAME="pgfId-411951"></A>If the Java Card RE catches an uncaught exception from the <KBD CLASS="Filename-Command">select</KBD>, <KBD CLASS="Filename-Command">deselect</KBD>, <KBD CLASS="Filename-Command">process</KBD>, or <KBD CLASS="Filename-Command">install</KBD> methods when an applet initiated transaction is in progress, the Java Card RE automatically aborts the transaction.</P><BR><HR NOSHADE SIZE=1><TABLE CLASS="TipNote" DIR="LTR" WIDTH="100%" SUMMARY="TipNote"><COLGROUP SPAN="1" WIDTH="100%"><TR ALIGN="left" VALIGN="top"><TD ROWSPAN="1" COLSPAN="1" ABBR="TipNoteText"><P CLASS="TipNote"><B CLASS="TipNote">Note - </B><A NAME="pgfId-411789"></A>The abortion of a transaction by the Java Card RE does not directly affect the response status sent to the CAD. The response status is determined as described in <A HREF="JCRESpec03appletlife.html#17454" CLASS="XRef">Section 3.3, process Method</A>.</P></TD></TR></TABLE><HR NOSHADE SIZE=1><BR><H3 CLASS="Head2"><A NAME="pgfId-411291"></A>7.6.3 Cleanup Responsibilities of the <A NAME="marker-411733"></A>Java Card RE</H3><P CLASS="Paragraph"><A NAME="pgfId-411292"></A>Object instances created during the transaction that is being aborted can be deleted only if references to these deleted objects can no longer be used to access these objects. The Java Card RE shall ensure that a reference to an object created during the aborted transaction is equivalent to a <KBD CLASS="Filename-Command">null</KBD> reference.</P><P CLASS="Paragraph"><A NAME="pgfId-415705"></A>Alternatively, programmatic abortion after creating objects within the transaction can be deemed to be a programming error. When this occurs, the Java Card RE may, to ensure the security of the card and to avoid heap space loss, lock up the card session to force tear or reset processing.</P><H2 CLASS="Head1"><A NAME="pgfId-415708"></A><DIV><HR ALIGN=left SIZE=6 WIDTH=15% noshade></DIV>7.7 Transient <A NAME="marker-415707"></A>Objects and Global Arrays</H2><P CLASS="Paragraph"><A NAME="pgfId-407219"></A>Only updates to persistent objects participate in the transaction. Updates to transient objects and global arrays are never undone, regardless of whether or not they were "inside a transaction."</P><H2 CLASS="Head1"><A NAME="pgfId-407229"></A><DIV><HR ALIGN=left SIZE=6 WIDTH=15% noshade></DIV>7.8 Commit <A NAME="marker-411735"></A>Capacity</H2><P CLASS="Paragraph"><A NAME="pgfId-407231"></A>Because platform resources are limited, the number of bytes of conditionally updated data that can be accumulated during a transaction is limited. The Java Card technology provides methods to determine how much<EM CLASS="Emphasis"> commit capacity</EM> is available on the implementation. The commit capacity represents an upper bound on the number of conditional byte updates available. The actual number of conditional byte updates available may be lower due to management overhead.</P><P CLASS="Paragraph"><A NAME="pgfId-407233"></A>A <KBD CLASS="Filename-Command">TransactionException</KBD> is thrown if the commit capacity is exceeded during a transaction.</P><H2 CLASS="Head1"><A NAME="pgfId-407241"></A><DIV><HR ALIGN=left SIZE=6 WIDTH=15% noshade></DIV>7.9 Context Switching<A NAME="marker-411736"></A></H2><P CLASS="Paragraph"><A NAME="pgfId-407243"></A>Context switches shall not alter the state of a transaction in progress. If a transaction is in progress at the time of a context switch (see <A HREF="JCRESpec06firewall.html#43635" CLASS="XRef">Section 6.1.2, Contexts and Context Switching</A>), updates to persistent data continue to be conditional in the new context until the transaction is committed or aborted.</P><P CLASS="Paragraph"><A NAME="pgfId-408007"></A> </P><div class="navbar" align="center"><br><br><table dir="LTR" summary="Navigation bar, includes the book title and navigation buttons" width=100% cellpadding="0" cellspacing="0" border="0"><colgroup span="3" width="100%"><col id="1" span="1" width="45%"><col id="2" span="1" width="25%"><col id="3" span="1" width="30%"><tr bgcolor="#cccccc"><td class="navbartitle" align=left rowspan="1" colspan="1" abbr="ChapTitle"> Runtime Environment Specification for the Java Card Platform, Version 2.2.2</td><td class="navbartitle" align=right rowspan="1" colspan="1" abbr="PartNum">3-8-06</td><td valign="top" align="right" rowspan="1" colspan="1" abbr="NavButtons"><a href="index.html"><img src="shared/toc01.gif" title="Table Of Contents" alt="Table Of Contents" width="30" height="26" border="0"></a><a href="JCRESpec06firewall.html"><img src="shared/prev01.gif" title="Previous Chapter" alt="Previous Chapter" width="30" height="26" border="0"></a><a href="JCRESpec08rmi.html"><img src="shared/next01.gif" title="Next Chapter" alt="Next Chapter" width="30" height="26" border="0"></a><a href="ix.html"><img src="shared/index01.gif" title="Book Index" alt="Book Index" width="30" height="26" border="0"></a></td></tr></table><br><br></div><P CLASS="copyrightlink"><a href="copyright.html">Copyright</a> © 2005, Sun Microsystems, Inc. All Rights Reserved.</P></BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?