[jboss-cvs] JBossAS SVN: r75242 - projects/docs/enterprise/4.3/Transactions/Programmers_Guide/zh-CN.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jul 1 00:00:38 EDT 2008
Author: xhuang at jboss.com
Date: 2008-07-01 00:00:38 -0400 (Tue, 01 Jul 2008)
New Revision: 75242
Modified:
projects/docs/enterprise/4.3/Transactions/Programmers_Guide/zh-CN/Chapter_03.po
Log:
update
Modified: projects/docs/enterprise/4.3/Transactions/Programmers_Guide/zh-CN/Chapter_03.po
===================================================================
--- projects/docs/enterprise/4.3/Transactions/Programmers_Guide/zh-CN/Chapter_03.po 2008-07-01 03:53:54 UTC (rev 75241)
+++ projects/docs/enterprise/4.3/Transactions/Programmers_Guide/zh-CN/Chapter_03.po 2008-07-01 04:00:38 UTC (rev 75242)
@@ -8,13 +8,14 @@
"Project-Id-Version: Chapter_03\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2008-06-05 22:51+0000\n"
-"PO-Revision-Date: 2008-06-30 15:53+1000\n"
+"PO-Revision-Date: 2008-07-01 14:00+1000\n"
"Last-Translator: Xi HUANG <xhuang at redhat.com>\n"
-"Language-Team: <en at li.org>\n"
+"Language-Team: Chinese Simplified <kde-i18n-doc at lists.kde.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: KBabel 1.11.4\n"
+"X-Generator: KAider 0.1\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
#. Tag: title
#: Chapter_03.xml:6
@@ -97,13 +98,13 @@
"threads within it, the system will invoke the check method on the "
"transaction’s <classname>CheckedAction</classname> object. The parameters to "
"the check method are:"
-msgstr ""
+msgstr "当线程试图终止事务且该事务里还有其他活动线程时,系统将调用事务的 <classname>CheckedAction</classname> 对象的 check 方法。check 方法的参数是:"
#. Tag: term
#: Chapter_03.xml:25
#, no-c-format
msgid "isCommit"
-msgstr ""
+msgstr "isCommit"
#. Tag: para
#: Chapter_03.xml:26
@@ -111,25 +112,25 @@
msgid ""
"Indicates whether the transaction is in the process of committing or rolling "
"back."
-msgstr ""
+msgstr "指出事务是否正在提交或回滚。"
#. Tag: term
#: Chapter_03.xml:30
#, no-c-format
msgid "actUid"
-msgstr ""
+msgstr "actUid"
#. Tag: para
#: Chapter_03.xml:31
#, no-c-format
msgid "The transaction identifier."
-msgstr ""
+msgstr "事务标识符。"
#. Tag: term
#: Chapter_03.xml:35
#, no-c-format
msgid "list"
-msgstr ""
+msgstr "list"
#. Tag: para
#: Chapter_03.xml:36
@@ -137,7 +138,7 @@
msgid ""
"a list of all of the threads currently marked as active within this "
"transaction."
-msgstr ""
+msgstr "该事务里当前所有标记为活动的线程列表。"
#. Tag: para
#: Chapter_03.xml:42
@@ -146,13 +147,13 @@
"When check returns, the transaction termination will continue. Obviously the "
"state of the transaction at this point may be different from that when check "
"was called, e.g., the transaction may subsequently have been committed."
-msgstr ""
+msgstr "当 check 返回时,事务终止将继续进行。显然,此时事务的状态可能和 check 刚被调用时会有不同,例如,事务可能随后已经被提交了。"
#. Tag: title
#: Chapter_03.xml:47
#, no-c-format
msgid "Statistics gathering"
-msgstr ""
+msgstr "收集统计信息"
#. Tag: para
#: Chapter_03.xml:49
@@ -165,7 +166,7 @@
"transactions created, and their outcomes. This information can be obtained "
"during the execution of a transactional application via the <classname>com."
"arjuna.TxCore.Atomic.TxStats</classname> class:"
-msgstr ""
+msgstr "在缺省情况下,JBossTS 不维护事务的任何历史信息。然而,通过把 <literal>com.arjuna.ats.arjuna.coordinator.enableStatistics</literal> 属性变量设置为 YES,事务服务将保留关于事务创建的数量以及结果的信息。这些信息可以在事务性应用程序的执行过程中通过 <classname>com.arjuna.TxCore.Atomic.TxStats</classname> 类获得:"
#. Tag: programlisting
#: Chapter_03.xml:51
@@ -208,12 +209,48 @@
"\n"
"}"
msgstr ""
+"public class TxStats\n"
+"{\n"
+"\n"
+"/**\n"
+"* Returns the number of transactions (top-level and nested)\n"
+"* created so far.\n"
+"*/\n"
+"\n"
+"public static int numberOfTransactions ();\n"
+"\n"
+"/**\n"
+"* Returns the number of nested (sub) transactions created so far.\n"
+"*/\n"
+"\n"
+"public static int numberOfNestedTransactions ();\n"
+"\n"
+"/**\n"
+"* Returns the number of transactions which have terminated with\n"
+"* heuristic outcomes.\n"
+"*/\n"
+"\n"
+"public static int numberOfHeuristics ();\n"
+"\n"
+"/**\n"
+"* Returns the number of committed transactions.\n"
+"*/\n"
+"\n"
+"public static int numberOfCommittedTransactions ();\n"
+"\n"
+"/**\n"
+"* Returns the number of transactions which have rolled back.\n"
+"*/\n"
+"\n"
+"public static int numberOfAbortedTransactions ();\n"
+"\n"
+"}"
#. Tag: title
#: Chapter_03.xml:57
#, no-c-format
msgid "Last resource commit optimisation"
-msgstr ""
+msgstr "最近提交资源优化"
#. Tag: para
#: Chapter_03.xml:59
@@ -232,7 +269,7 @@
"control to the one-phase aware resource. If it commits, then the coordinator "
"logs the decision to commit and attempts to commit the other resources as "
"well."
-msgstr ""
+msgstr "在某些情况下,你有必要把非两阶段提交的参与者放入两阶段提交的的事务里。如果只有单个资源,那么就不需要两阶段提交。然而,如果在事务里多个资源呢?此时就可以使用最近资源提交优化(Last Resource Commit optimization,LRCO)。只知道一阶段提交(也就是只提交或回滚,没有准备阶段)的单个资源有可能参与到带有两阶段提交资源的事务里。协调者将稍微区别对待一阶段提交资源,它首先执行所有其他资源的准备阶段,然后试图提交控制权已交给一阶段资源的事务。如果提交成功,协调者登记提交决定并试图提交其他资源。"
#. Tag: para
#: Chapter_03.xml:61
@@ -245,7 +282,7 @@
"<classname>AbstractRecord</classname>, you must create an instance "
"<classname>com.arjuna.ats.arjuna.LastResourceRecord</classname> and give "
"your participant as the constructor parameter, as shown below:"
-msgstr ""
+msgstr "为了利用 LRCO,参与者必须实现 <classname>com.arjuna.ats.arjuna.coordinator.OnePhase</classname> 接口并通过 <command>BasicAction.add</command> 操作向事务注册。既然这个操作需要 <classname>AbstractRecord</classname> 实例,你必须创建一个 <classname>com.arjuna.ats.arjuna.LastResourceRecord</classname> 实例并把参与者作为参数传给构造函数,就象下面这样:"
#. Tag: programlisting
#: Chapter_03.xml:63
@@ -266,12 +303,26 @@
" \n"
" A.commit();"
msgstr ""
+"try\n"
+" {\n"
+" boolean success = false;\n"
+" AtomicAction A = new AtomicAction();\n"
+" OnePhase opRes = new OnePhase(); // used OnePhase "
+"interface\n"
+" \n"
+" System.err.println(\"Starting top-level action.\");\n"
+" \n"
+" A.begin();\n"
+" A.add(new LastResourceRecord(opRes));\n"
+" A.add(new ShutdownRecord(ShutdownRecord.FAIL_IN_PREPARE));\n"
+" \n"
+" A.commit();"
#. Tag: title
#: Chapter_03.xml:68
#, no-c-format
msgid "Nested transactions"
-msgstr ""
+msgstr "嵌套的事务"
#. Tag: para
#: Chapter_03.xml:70
@@ -287,7 +338,7 @@
"may be nested. Objects written in this way can then be shared between "
"application programmers, and <emphasis>TxCore</emphasis> will guarantee "
"their consistency."
-msgstr ""
+msgstr "嵌套的事务没有特殊的构造方法:如果某个动作在另外一个动作还在运行时开始的话,它将自动被嵌套。这允许应用程序使用模块化结构,对象可以用操作里的原子动作来实现,而程序员无需担心使用对象的程序,也就是不用管应用程序使用原子动作与否。因此,在某些应用程序里,动作可能是顶层的,而其他地方则可能是嵌套的。应用程序开发人员可以共享以这种方式编写的对象,而 <emphasis>TxCore</emphasis> 将保证它的一致性。"
#. Tag: para
#: Chapter_03.xml:72
@@ -299,7 +350,7 @@
"commits then the work it has performed will only be committed by the system "
"if the top-level action commits; if the top-level action aborts then all of "
"the work will be undone."
-msgstr ""
+msgstr "如果某个嵌套的动作中止了,那么它的所有工作都将被取消,虽然严格的两阶段锁意味着它所获得的锁在顶层动作提交或中止前都将继续保留。如果嵌套的动作提交了,它已经执行的工作将只在顶层动作提交时才被系统提交;如果顶层动作中止,那么所有这些工作都会被取消。"
#. Tag: para
#: Chapter_03.xml:74
@@ -309,13 +360,13 @@
"the outcome of the action within which it is nested. This is application "
"dependant, and allows a programmer to structure atomic actions to contain "
"faults, undo work, etc."
-msgstr ""
+msgstr "嵌套动作的提交或中止并不自动影响它嵌套的动作的结果。这取决于应用程序的编写,程序员可以让原子动作包含错误处理、取消已完成的工作等等。"
#. Tag: title
#: Chapter_03.xml:78
#, no-c-format
msgid "Asynchronously committing a transaction"
-msgstr ""
+msgstr "异步提交事务"
#. Tag: para
#: Chapter_03.xml:80
@@ -325,7 +376,7 @@
"in a synchronous manner, i.e., all registered resources will be told to "
"prepare in order by a single thread, and then they will be told to commit or "
"rollback. This has several possible disadvantages:"
-msgstr ""
+msgstr "在缺省情况下,JBossTS 以同步的方式执行提交顶层事务的提交协议,也就是说,所有注册的资源将按单个进程进行准备,然后进行提交或回滚。这种方式可能会有如下的缺点:"
#. Tag: para
#: Chapter_03.xml:83
@@ -336,7 +387,7 @@
"if an “early” resource in the list of registered resource forces a rollback "
"during prepare, possibly many prepare operations will have been made "
"needlessly."
-msgstr ""
+msgstr "在有许多注册的资源的情况下,每个资源的准备操作可以并行地调用。其缺点时如果注册资源列表里的某个“早”资源迫使准备阶段进行回滚的话,有可能许多准备操作就毫无必要了。"
#. Tag: para
#: Chapter_03.xml:84
@@ -345,7 +396,7 @@
"In the case where heuristic reporting is not required by the application, "
"the second phase of the commit protocol can be done asynchronously, since "
"its success or failure is not important."
-msgstr ""
+msgstr "在应用程序不要求启发式报告(heuristic reporting)时,既然提交协议的第二阶段的成功或失败都不重要,那它就可以异步地进行。"
#. Tag: para
#: Chapter_03.xml:87
@@ -361,12 +412,14 @@
"second phase of the transaction if knowledge about heuristics outcomes is "
"not required."
msgstr ""
+"因此,<emphasis>JBossTS</emphasis> 提供了运行时选项来启用可能的线程优化。通过设置 <literal>com.arjuna.ats.arjuna.coordinator.asyncPrepare</literal> 环境变量为 <literal>YES</literal>,在准备阶段将为事务里每个注册的参与者创建一个独立的线程。而通过设置 <literal>com.arjuna.ats.arjuna.coordinator.asyncCommit</literal> 环境变量为 <literal>YES</literal>"
+",如果已知不要求启发式结果的话,就可以创建一个独立的线程来完成事务的第二阶段。"
#. Tag: title
#: Chapter_03.xml:93
#, no-c-format
msgid "Independent top-level transactions"
-msgstr ""
+msgstr "独立的顶层事务"
#. Tag: para
#: Chapter_03.xml:95
@@ -379,13 +432,13 @@
"behaves exactly like a normal top-level action, that is, its results are "
"made permanent when it commits and will not be undone if any of the actions "
"within which it was originally nested abort."
-msgstr ""
+msgstr "除了普通的顶层和嵌套原子动作,<emphasis>TxCore</emphasis> 也支持独立的顶层动作,它可以用来以可控的方式绕开严格的串行化要求。独立的顶层动作可以在另外一个原子动作里的任何地方执行,且行为和普通的顶层动作完全一样,那就是:在提交后,它的结果将时永久的,且即使它嵌套的任何动作发生中止也无法取消这个结果。"
#. Tag: caption
#: Chapter_03.xml:101
#, no-c-format
msgid "Independent Top-Level Action"
-msgstr ""
+msgstr "独立的顶层动作"
#. Tag: para
#: Chapter_03.xml:104
@@ -398,7 +451,7 @@
"other actions within the structure. Because of the nature of independent top-"
"level actions they should be used with caution and only in situations where "
"their use has been carefully examined."
-msgstr ""
+msgstr "展示了一个典型的原子动作嵌套,动作 B 嵌套在 A 里。虽然原子动作 C 从逻辑上来将嵌套在 B 里(当 B 为活动状态时,它的 Begin 操作被调用),但因为它是一个独立的顶层动作,它将独立于此结构里的其他动作提交或中止。因为独立顶层动作的性质,你应该小心使用且只有在仔细检查其用途后再使用。"
#. Tag: para
#: Chapter_03.xml:106
@@ -407,13 +460,13 @@
"Top-level actions can be used within an application by declaring and using "
"instances of the class <classname>TopLevelTransaction</classname>. They are "
"used in exactly the same way as other transactions."
-msgstr ""
+msgstr "顶层动作可以通过声明和使用 <classname>TopLevelTransaction</classname> 的实例来在应用程序内部使用。它们的使用方法和其他事务完全一样。"
#. Tag: title
#: Chapter_03.xml:111
#, no-c-format
msgid "Transactions within save_state and restore_state"
-msgstr ""
+msgstr "save_state 和 restore_state 里的事务"
#. Tag: para
#: Chapter_03.xml:113
@@ -429,12 +482,15 @@
"violate the atomicity properties of the action being committed (aborted) and "
"is thus discouraged."
msgstr ""
+"当编写 <command>save_state</command> 和 <command>restore_state</command> 操作时需要小心确保没有启动任何事务(在操作里显性地启动或通过使用其他操作隐形地启动)。这个限制是由于 <emphasis>TxCore</emphasis> 可能把 <command>restore_state</command> 作为其提交过程的一部分来调用,从而导致了在一个事务的提交或中止阶段试图"
+"执行另外一个原子事务。这可能违背了被提交(中止)的事务的原子属性,因此不应该使用"
+"。"
#. Tag: title
#: Chapter_03.xml:118
#, no-c-format
msgid "Example"
-msgstr ""
+msgstr "示例"
#. Tag: para
#: Chapter_03.xml:120
@@ -442,7 +498,7 @@
msgid ""
"If we consider the Array example given previously, the set and get "
"operations could be implemented as shown below."
-msgstr ""
+msgstr "如果我们考虑前面给出的 Array 示例,它的 set 和 get 操作可以象下面这样实现。"
#. Tag: para
#: Chapter_03.xml:122
@@ -450,7 +506,7 @@
msgid ""
"This is a simplification of the code, ignoring error conditions and "
"exceptions."
-msgstr ""
+msgstr "这是一段简化了的代码,它忽略了错误和异常处理。"
#. Tag: programlisting
#: Chapter_03.xml:124
@@ -499,12 +555,54 @@
" return -1;\n"
"}"
msgstr ""
+"public boolean set (int index, int value)\n"
+"{\n"
+" boolean result = false;\n"
+" AtomicAction A = new AtomicAction();\n"
+"\n"
+" A.begin();\n"
+"\n"
+" // We need to set a WRITE lock as we want to modify the state.\n"
+"\n"
+" if (setlock(new Lock(LockMode.WRITE), 0) == LockResult.GRANTED)\n"
+" {\n"
+" elements[index] = value;\n"
+" if ((value > 0) &&(index > highestIndex))\n"
+" highestIndex = index;\n"
+" A.commit(true);\n"
+" result = true;\n"
+" }\n"
+" else\n"
+" A.rollback();\n"
+"\n"
+" return result;\n"
+"}\n"
+"\n"
+"public int get (int index) // assume -1 means error\n"
+"{\n"
+" AtomicAction A = new AtomicAction();\n"
+"\n"
+" A.begin();\n"
+"\n"
+" // We only need a READ lock as the state is unchanged.\n"
+"\n"
+" if (setlock(new Lock(LockMode.READ), 0) == LockResult.GRANTED)\n"
+" {\n"
+" A.commit(true);\n"
+"\n"
+" return elements[index];\n"
+" }\n"
+" else\n"
+" A.rollback();\n"
+"\n"
+" return -1;\n"
+"}"
#. Tag: title
#: Chapter_03.xml:129
#, no-c-format
msgid "Garbage collecting objects"
-msgstr ""
+msgstr "垃圾回收对象"
#. Tag: para
#: Chapter_03.xml:131
@@ -518,13 +616,13 @@
"object maintained by an application, <emphasis>TxCore</emphasis> will always "
"retain its own references to ensure that the object is not garbage collected "
"until after any transaction has terminated."
-msgstr ""
+msgstr "当垃圾回收器决定不再需要 Java 对象时,它们就会被删除。删除在事务控制之下的对象必须小心行事,因为如果对象在事务里操纵,它的命运实际上是由事务来决定的。因此,不管应用程序是否维护对事务性对象的引用,<emphasis>TxCore</emphasis> 总是保留自己的引用来确保这个对象不会被当作垃圾回收,一直到所有事务都已经结束为止。"
#. Tag: title
#: Chapter_03.xml:136
#, no-c-format
msgid "Transaction timeouts"
-msgstr ""
+msgstr "事务超时"
#. Tag: para
#: Chapter_03.xml:138
@@ -535,7 +633,7 @@
"timeout (in seconds) on a per transaction basis such that if the transaction "
"has not terminated before the timeout expires it will be automatically "
"rolled back."
-msgstr ""
+msgstr "在缺省情况下,事务一直生存到被创建它的应用程序终止或发生故障。然而,我们有可以为每个事务设置一个超时时间(秒),这样如果事务在超时前还没有被终止的话,它将自动回滚。"
#. Tag: para
#: Chapter_03.xml:140
@@ -549,7 +647,7 @@
"zero is taken to be a global default timeout, which can be provided by the "
"property <literal>com.arjuna.ats.arjuna.coordinator.defaultTimeout</"
"literal>. Unless changed the default value is 60 seconds."
-msgstr ""
+msgstr "在 <emphasis>TxCore</emphasis> 里,超时时间被作为 <classname>AtomicAction</classname> 构造函数的参数。如果其值为 <literal>AtomicAction.NO_TIMEOUT</literal>(缺省值),那么该事务将不会自动超时。而任何其他正值都将是事务的超时时间(以秒为单位)。零值将作为全局的缺省超时时间,它可由属性 <literal>com.arjuna.ats.arjuna.coordinator.defaultTimeout</literal> 提供。除非进行修改,缺省值是 60 秒。"
#. Tag: para
#: Chapter_03.xml:142
@@ -569,6 +667,8 @@
"transaction times out. This has the advantage of terminating transactions "
"early, but may suffer from continually rescheduling the reaper thread."
msgstr ""
+"当某个顶层的事务用非零值超时时间创建时,如果它在指定的时间内没有完成的话,它将进行回滚。<emphasis>JBossTS</emphasis> 使用一个独立的 reaper 线程来监控所有本地创建的事务,并在超时后强迫它们回滚。要阻止这个线程消耗应用程序时间,它应该只定期地运行。缺省的检查间隔是 120000 毫秒,但你可以通过设置 <literal>com.arjuna.ats.arjuna.coordinator.txReaperTimeout</literal> 属性来覆盖它。或者,如果 <literal>com.arjuna.ats.arjuna.coordinator."
+"txReaperMode</literal> 被设置为 <literal>DYNAMIC</literal>,reaper 线程将在任何事务超时时被唤醒。这种模式的优势是可以及早地终止事务,但也有可能得不停地调度 reaper 线程。"
#. Tag: para
#: Chapter_03.xml:144
@@ -583,4 +683,6 @@
"emphasis>, or <literal>com.arjuna.ats.jts.defaultTimeout</literal> if using "
"<emphasis>ArjunaJTS</emphasis>, to the required timeout value in seconds."
msgstr ""
+"如果为某个顶层事务指定了零值的超时时间(或未指定超时时间),<emphasis>JBossTS</emphasis> 将不会将任何超时时间强加于该事务上,也就是说,它将允许该事务无限期地运行。当使用 <emphasis>ArjunaCore</emphasis> 或 <emphasis>ArjunaJTS</emphasis> 时,你可以设置 <literal>com.arjuna.ats.arjuna.coordinator.defaultTimeout</literal> 来覆盖缺省超时时间,或是使用 <emphasis>ArjunaJTS</emphasis> 时设置 <literal>com."
+"arjuna.ats.jts.defaultTimeout</literal> 进行覆盖。"
More information about the jboss-cvs-commits
mailing list