⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transactions.html

📁 Sun Java System Application Server Enterprise Edition 8.1 管理指南
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<?xml version="1.0" encoding="GB2312"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN"><head>  <meta http-equiv="Content-Type" content="text/html; charset=GB2312" />  <meta name="keywords"           content="electronic commerce, ecommerce, ebusiness, e-business, e-commerce, enterprise software, net economy, Sun Microsystems, Sun Open Net Environment, Sun ONE, internet software" />  <meta name="Description"        content="Sun Microsystems, Inc. is delivering Sun ONE e-commerce software and enterprise solutions that enable companies to compete successfully in the Net Economy." />  <meta name="TemplateVersion"    content="Sun ONE WDT 2.3.1" />  <meta name="LASTUPDATED"        content="10/03/03 09:48:22" />  <meta name="BookTitle"          content="Sun Java System Application Server Enterprise Edition 8.1 Administration Guide 2005Q1" />  <title>第 16 章  事务</title>  <link href="catalog.css" tppabs="http://docs.sun.com/source/819-1553/catalog.css" rel="stylesheet" type="text/css" />  <!-- on load bring this window to front -->  <script laguage="javascript">  top.window.focus();  </script></head><body text="#000000" link="#594FBF" vlink="#9966cc" alink="#333366" bgcolor="#FFFFFF"><a name="top"> </a><!-- navigation -->  <table width="100%" border="0" cellspacing="4" summary="Header navigation table">    <tr><td>    <p  class="pNavigation">    <a HREF="javascript:if(confirm('http://www.sun.com/software/  \n\n该文件无法用 Teleport Ultra 下载, 因为 它是一个域或路径外部被设置为它的启始地址的地址。  \n\n你想在服务器上打开它?'))window.location='http://www.sun.com/software/'" tppabs="http://www.sun.com/software/">    <img SRC="Logo.jpg" tppabs="http://docs.sun.com/source/819-1553/Logo.jpg" alt="Sun logo" valign="bottom" border="0" /></a>    &#160;&#160;&#160;&#160;    <a href="ws-security.html" tppabs="http://docs.sun.com/source/819-1553/ws-security.html">上一页</a>    &#160;&#160;&#160;&#160;     <a href="index.html" tppabs="http://docs.sun.com/source/819-1553/index.html">目录</a>    &#160;&#160;&#160;&#160;    <a href="httpservice.html" tppabs="http://docs.sun.com/source/819-1553/httpservice.html">下一页</a>    &#160;&#160;&#160;&#160;    </p>    </td></tr>        <tr><td valign="top" align="right" bgcolor="#594FBF">    <span class="cBookTitle">Sun Java System Application Server Enterprise Edition 8.1 管理指南 2005Q1</span>    </td></tr>  </table><!-- end navigation --><blockquote><!-- chapter content --><a name="wp465070"> </a><h2 class="pChapNumber"><span class="cGray">第 16 章</span><br /><a name="wp465072"> </a>事务</h2><a name="wp465076"> </a><p class="pParagraph">通过将一个或多个步骤装入不可分的工作单元,事务可确保数据的完整性和一致性。本章包括以下几个部分:</p><div class="pSmartList1"><ul class="pSmartList1"><a name="wp465082"> </a><div class="pSmartList1"><li><a  href="transactions.html#wp465092" tppabs="http://docs.sun.com/source/819-1553/transactions.html#wp465092">关于事务</a></li></div><a name="wp465088"> </a><div class="pSmartList1"><li><a  href="transactions.html#wp465214" tppabs="http://docs.sun.com/source/819-1553/transactions.html#wp465214">有关事务的管理控制台任务</a></li></div></ul></div><a name="wp465092"> </a><h2 class="pHeading1"><hr />关于事务</h2><div class="pSmartList1"><ul class="pSmartList1"><a name="wp465098"> </a><div class="pSmartList1"><li><a  href="transactions.html#wp465112" tppabs="http://docs.sun.com/source/819-1553/transactions.html#wp465112">什么叫事务?</a></li></div><a name="wp465104"> </a><div class="pSmartList1"><li><a  href="transactions.html#wp465152" tppabs="http://docs.sun.com/source/819-1553/transactions.html#wp465152">J2EE 技术中的事务</a></li></div></ul></div><a name="wp465112"> </a><h3 class="pHeading2">什么叫事务?</h3><a name="wp465114"> </a><p class="pParagraph">事务是应用程序中一系列严密的操作,所有操作必须成功完成,否则在每个操作中所作的所有更改都会被撤消。例如,将资金从支票帐户转到储蓄帐户中是一项事务,按步骤如下进行:</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp465116"> </a><div class="pSmartList1"><li>检查支票帐户是否有足够的资金来支付此转帐操作。</li></div><a name="wp465118"> </a><div class="pSmartList1"><li>如果支票帐户中有足够的资金,则将该笔资金记入此帐户的借方。</li></div><a name="wp465120"> </a><div class="pSmartList1"><li>将这些资金记入储蓄帐户的贷方。</li></div><a name="wp465122"> </a><div class="pSmartList1"><li>将此次转帐记录到支票帐户日志中。</li></div><a name="wp465124"> </a><div class="pSmartList1"><li>将此次转帐记录到储蓄帐户日志中。</li></div></ol></div><a name="wp465130"> </a><p class="pParagraph">如果这些步骤的任何一个步骤失败,则必须撤消在前面的步骤中所做的所有更改,而且支票帐户和储蓄帐户的状态必须与它们在事务开始之前的状态相同。该事件称为<em class="cEmphasis">回滚</em>。如果所有步骤都成功完成,则该事务处于<em class="cEmphasis">提交</em>状态。事务以提交或回滚结束。</p><a name="wp465152"> </a><h3 class="pHeading2">J2EE 技术中的事务</h3><a name="wp465154"> </a><p class="pParagraph">J2EE 技术中的事务处理包括以下五个参与者: </p><div class="pSmartList1"><ul class="pSmartList1"><a name="wp465158"> </a><div class="pSmartList1"><li>事务管理器</li></div><a name="wp465160"> </a><div class="pSmartList1"><li>Application Server</li></div><a name="wp465164"> </a><div class="pSmartList1"><li>资源管理器</li></div><a name="wp465168"> </a><div class="pSmartList1"><li>资源适配器</li></div><a name="wp465170"> </a><div class="pSmartList1"><li>用户应用程序 </li></div></ul></div><a name="wp465172"> </a><p class="pParagraph">通过实现各自的 API 和功能,每个实体均有助于提高事务处理的可靠性,如下所述:</p><div class="pSmartList1"><ul class="pSmartList1"><a name="wp465174"> </a><div class="pSmartList1"><li>事务管理器提供了支持事务划分、事务资源管理、同步和事务上下文传播所需的服务和管理功能。</li></div><a name="wp465176"> </a><div class="pSmartList1"><li>Application Server 提供了支持应用程序运行时环境(包含事务状态管理)所需的基础结构。</li></div><a name="wp465186"> </a><div class="pSmartList1"><li>应用程序可以使用资源管理器(通过资源适配器)访问资源。资源管理器通过实现事务管理器所使用的事务资源接口来参与分布式事务,从而就事务关联、事务完成及恢复工作等过程进行通信。例如,关系型数据库服务器就是这样的资源管理器。</li></div><a name="wp465190"> </a><div class="pSmartList1"><li>资源适配器是一个系统级的软件库,应用程序服务器或客户机可使用它连接到资源管理器。资源适配器通常专用于资源管理器。它以库的形式存在,并在使用它的客户机地址空间中使用。例如,JDBC 驱动程序就是这样的资源适配器。</li></div><a name="wp465196"> </a><div class="pSmartList1"><li>为在应用程序服务器环境中运行而开发的事务用户应用程序可以使用 JNDI 查找事务数据源及事务管理器(可选)。应用程序可以使用企业 Bean 的声明事务属性设置或明确的程序事务分界。</li></div></ul></div><a name="wp465214"> </a><h2 class="pHeading1"><hr />有关事务的管理控制台任务</h2><a name="wp465220"> </a><p class="pParagraph">Application Server 将基于管理控制台中的设置来处理事务。</p><a name="wp465226"> </a><h3 class="pHeading2">配置事务</h3><a name="wp465228"> </a><p class="pParagraph">本节说明了配置以下事务属性的过程:</p><div class="pSmartList1"><ul class="pSmartList1"><a name="wp465230"> </a><div class="pSmartList1"><li>事务恢复</li></div><a name="wp465232"> </a><div class="pSmartList1"><li>事务超时</li></div><a name="wp465234"> </a><div class="pSmartList1"><li>事务日志记录</li></div></ul></div><a name="wp465240"> </a><h4 class="pHeading3">事务恢复</h4><a name="wp465246"> </a><p class="pParagraph">由于服务器崩溃或资源管理器崩溃,事务可能未完成。完成这些出现问题的事务并从故障中恢复是至关重要的。Application Server 可在服务器启动时从这些故障中恢复并完成事务。</p><a name="wp465248"> </a><p class="pParagraph">执行恢复操作时,如果无法访问某些资源,则服务器重新启动操作可能被延迟,因为服务器正在尝试恢复事务。</p><a name="wp465250"> </a><p class="pParagraph">如果事务跨服务器进行,启动该事务的服务器会联系其他服务器以获得事务的结果。如果无法访问其他服务器,则该事务将使用“试探性决定”字段来确定结果。

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -