[jboss-cvs] JBossAS SVN: r75326 - projects/docs/enterprise/4.3/Transactions/Programmers_Guide/zh-CN.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 3 01:44:18 EDT 2008


Author: xhuang at jboss.com
Date: 2008-07-03 01:44:17 -0400 (Thu, 03 Jul 2008)
New Revision: 75326

Modified:
   projects/docs/enterprise/4.3/Transactions/Programmers_Guide/zh-CN/Chapter_02.po
Log:
update

Modified: projects/docs/enterprise/4.3/Transactions/Programmers_Guide/zh-CN/Chapter_02.po
===================================================================
--- projects/docs/enterprise/4.3/Transactions/Programmers_Guide/zh-CN/Chapter_02.po	2008-07-03 05:13:57 UTC (rev 75325)
+++ projects/docs/enterprise/4.3/Transactions/Programmers_Guide/zh-CN/Chapter_02.po	2008-07-03 05:44:17 UTC (rev 75326)
@@ -1,3 +1,4 @@
+# translation of Chapter_02.po to
 # Language zh-CN translations for JBoss_TS_Programmers_Guide package.
 #
 # Automatically generated, 2008.
@@ -4,16 +5,16 @@
 # Xi HUANG <xhuang at redhat.com>, 2008.
 msgid ""
 msgstr ""
-"Project-Id-Version: JBoss_TS_Programmers_Guide 1.0\n"
+"Project-Id-Version: Chapter_02\n"
 "Report-Msgid-Bugs-To: http://bugs.kde.org\n"
 "POT-Creation-Date: 2008-06-05 22:51+0000\n"
-"PO-Revision-Date: 2008-07-02 17:27+1000\n"
+"PO-Revision-Date: 2008-07-03 15:44+1000\n"
 "Last-Translator: Xi HUANG <xhuang at redhat.com>\n"
-"Language-Team: Chinese Simplified <kde-i18n-doc at lists.kde.org>\n"
+"Language-Team:  <en at li.org>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
-"X-Generator: KAider 0.1\n"
+"X-Generator: KBabel 1.11.4\n"
 "Plural-Forms: nplurals=2; plural=n != 1;\n"
 
 #. Tag: title
@@ -649,6 +650,14 @@
 "command> implementation for a class <classname>Example</classname> that had "
 "member variables called A, B and C could simply be the following:"
 msgstr ""
+"如果某个对象是可恢复的(recoverable)或可恢复及持久的(recoverable and persistent),那么<classname>StateManager</classname> 将在应用程序执行过程中的不同时间调"
+"用 <command>save_state</command>(执行 <command>deactivate</"
+"command> 时)和 <command>restore_state</command>(执行 activate 时)操作。既然 <classname>StateManager</classname> 不能够检测用户级别的状态变化,程序员必须实现这些操作。(我们正在考虑"
+"自动生成缺省的 <command>save_state</command> 和 "
+"<command>restore_state</command> 操作,并在可以提高效率的情况下允许程序员对其进"
+"行覆盖。)这使得程序员能够决定对象状态的哪些部分应该持久化。例如,对于一个电子表"
+"格来说,如果某些值只是简单的重复计算结果,你没有必要存储所有的条目。具有整型成员"
+"变量 A、B 和 C 的 <classname>Example</classname> 类的 <command>save_state</command> 实现可以仅仅是:"
 
 #. Tag: screen
 #: Chapter_02.xml:96
@@ -673,6 +682,24 @@
 "    }\n"
 "}"
 msgstr ""
+"public boolean save_state ( OutputObjectState os, int ObjectType )\n"
+"{\n"
+"    if (!super.save_state(os, ObjectType))\n"
+"    return false;\n"
+"    \n"
+"    try\n"
+"    {\n"
+"        os.packInt(A);\n"
+"        os.packString(B);\n"
+"        os.packFloat(C);\n"
+"    \n"
+"        return true;\n"
+"    }\n"
+"    catch (IOException e)\n"
+"    {\n"
+"        return false;\n"
+"    }\n"
+"}"
 
 #. Tag: para
 #: Chapter_02.xml:98
@@ -683,6 +710,8 @@
 "methods of user objects to call <command>super.save_state</command> and "
 "<command>super.restore_state</command>."
 msgstr ""
+"为了支持持久性对象的崩溃恢复,用户对象的所有 <command>save_state</command> 和 <command>restore_state</command> 方法都有必要调用 <command>super.save_state</command> 和 "
+"<command>super.restore_state</command>。"
 
 #. Tag: para
 #: Chapter_02.xml:100 Chapter_02.xml:182
@@ -693,7 +722,7 @@
 "This can actually be any valid string. However, you should avoid using the "
 "hash character (#) as this is reserved for special directories that "
 "<emphasis>TxCore</emphasis> requires."
-msgstr ""
+msgstr "type 方法用来决定实例将在 Object Store 里保存和最终恢复的位置。这实际上可以是任何有效的字符串。然而,你应该避免使用井号(#),因为它是用于 <emphasis>TxCore</emphasis> 所要求的特殊目录的保留字。"
 
 #. Tag: para
 #: Chapter_02.xml:102
@@ -707,6 +736,8 @@
 "explicit parameter or by generating a new identifier when the object is "
 "created."
 msgstr ""
+"<classname>StateManager</"
+"classname> 的 <command>get_uid</command> 操作返回只读的对象的内部系统名称,它可用于任何目的,例如程序员可用来在命名服务器里注册。你只能在对象构建时设置内部系统名称的值 - 通过显性参数或在创建对象时生成新的标识符。"
 
 #. Tag: para
 #: Chapter_02.xml:104
@@ -717,7 +748,7 @@
 "only remove the state if the top-level transaction within which it is "
 "invoked eventually commits. The programmer must obtain exclusive access to "
 "the object prior to invoking this operation."
-msgstr ""
+msgstr "<command>destroy</command> 方法可用来从 Object Store 里删除对象的状态。这是一个原子操作,因此只能在这个调用所处的顶层事务最终提交时才能进行完成。在调用此操作之前,程序员必须获取对对象的独占访问。"
 
 #. Tag: para
 #: Chapter_02.xml:106
@@ -733,13 +764,13 @@
 "operations allows the programmer to determine the purpose for which any "
 "given invocation is being made thus allowing different information to be "
 "saved for recovery and persistence purposes."
-msgstr ""
+msgstr "既然对象的恢复和持久化本来都有类似的需求(唯一不同的是状态信息保存的地方和目的)。<classname>StateManager</classname> 有效地把这两种属性组合到了单一的机制里。那就是,它把 Input/OutputObjectState 类的实例既用于恢复也用于持久化。传递给 <command>save_state</command> 和 <command>restore_state</command> 的另外一个参数允许程序员决定任何调用的目的,这就可以保存用于恢复和持久化的不同信息。"
 
 #. Tag: title
 #: Chapter_02.xml:112
 #, no-c-format
 msgid "Object Models"
-msgstr ""
+msgstr "对象模型"
 
 #. Tag: para
 #: Chapter_02.xml:114
@@ -748,7 +779,7 @@
 "<emphasis>TxCore</emphasis> supports two models for objects, which as we "
 "shall show affect how an objects state and concurrency control are "
 "implemented:"
-msgstr ""
+msgstr "<emphasis>TxCore</emphasis> 支持两种对象模型,我们来看看它们是如何影响对象状态和并行控制的实施的:"
 
 #. Tag: para
 #: Chapter_02.xml:117
@@ -760,13 +791,13 @@
 "performance, but represents a single point of failure, and in a multi-"
 "threaded environment may not protect the object from corruption if a single "
 "thread fails."
-msgstr ""
+msgstr "<termdef>SINGLE</termdef>:应用程序只存在对象的单一拷贝;这将驻留在单一的 JVM 里,所有的客户都必须解决对这个服务器的调用。这种模型提供了更好的性能,但也导致了单一的故障点,在多线程的环境里如果某一线程崩溃的话,它可能不能保护对象。"
 
 #. Tag: caption
 #: Chapter_02.xml:123
 #, no-c-format
 msgid "Single Object Model"
-msgstr ""
+msgstr "Single 对象模型"
 
 #. Tag: para
 #: Chapter_02.xml:127
@@ -775,13 +806,13 @@
 "MULTIPLE: logically a single instance of the object exists, but copies of it "
 "are distributed across different JVMs; the performance of this model is "
 "worse than the SINGLE model, but it provides better failure isolation."
-msgstr ""
+msgstr "MULTIPLE:逻辑上来说只存在对象的单一实例,但其拷贝可以在不同的 JVM 间传递;这种模型的性能比 SINGLE 模型要差,但它提供了更好的容错能力。"
 
 #. Tag: caption
 #: Chapter_02.xml:134
 #, no-c-format
 msgid "Multiple Object Model"
-msgstr ""
+msgstr "Multiple 对象模型"
 
 #. Tag: para
 #: Chapter_02.xml:139
@@ -792,6 +823,8 @@
 "arjuna.ats.arjuna.gandiva.ObjectName</classname> class at object "
 "construction."
 msgstr ""
+"SINGLE 是缺省的对象模型。对于每个对象,程序员都可以用合适的 <classname>com."
+"arjuna.ats.arjuna.gandiva.ObjectName</classname> 实例覆盖它。"
 
 #. Tag: para
 #: Chapter_02.xml:141
@@ -799,7 +832,7 @@
 msgid ""
 "The model can be changed between each successive instantiation of the "
 "object, i.e., it need not be the same during the object's lifetime."
-msgstr ""
+msgstr "你可以在对象后续的每次实例化之间修改模型,也就是说,在对象的生存期间模型不需要维持不变。"
 
 #. Tag: para
 #: Chapter_02.xml:143
@@ -807,13 +840,13 @@
 msgid ""
 "To provide a suitable <classname>ObjectName</classname> class, it is "
 "necessary to perform the following steps:"
-msgstr ""
+msgstr "要提供合适的 <classname>ObjectName</classname> 类,你有必要执行下面的步骤:"
 
 #. Tag: para
 #: Chapter_02.xml:148
 #, no-c-format
 msgid "create a new instance of <classname>ObjectName</classname>."
-msgstr ""
+msgstr "创建一个新的 <classname>ObjectName</classname> 实例。"
 
 #. Tag: para
 #: Chapter_02.xml:149
@@ -822,12 +855,14 @@
 "set the object model attribute using the <literal>com.arjuna.ats.arjuna."
 "ArjunaNames.StateManager_objectModel()</literal> name."
 msgstr ""
+"用 <literal>com.arjuna.ats.arjuna."
+"ArjunaNames.StateManager_objectModel()</literal> 名称设置对象模型属性。"
 
 #. Tag: para
 #: Chapter_02.xml:152
 #, no-c-format
 msgid "For example:"
-msgstr ""
+msgstr "例如:"
 
 #. Tag: programlisting
 #: Chapter_02.xml:154
@@ -842,12 +877,20 @@
 "    AtomicObject obj = new AtomicObject(ObjectType.ANDPERSISTENT, attr);\n"
 "                }"
 msgstr ""
+"{\n"
+"    ObjectName attr = new ObjectName(“SNS:myObjectName”);\n"
+"    \n"
+"    attr.setLongAttribute(ArjunaNames.StateManager_objectModel(),\n"
+"    ObjectModel.SINGLE);\n"
+"    \n"
+"    AtomicObject obj = new AtomicObject(ObjectType.ANDPERSISTENT, attr);\n"
+"                }"
 
 #. Tag: title
 #: Chapter_02.xml:161
 #, no-c-format
 msgid "Summary"
-msgstr ""
+msgstr "总结"
 
 #. Tag: para
 #: Chapter_02.xml:163
@@ -860,12 +903,15 @@
 "<command>save_state</command>, <command>restore_state</command>, and "
 "<command>type</command>."
 msgstr ""
+"总的来说,<emphasis>TxCore</emphasis> 的 <classname>StateManager</"
+"classname> 类管理对象的状态并提供所有用于状态管理目的的基本支持。类开发人员必须定义这样一些操作:<command>save_state</command>、<command>restore_state</command> 和 "
+"<command>type</command>。"
 
 #. Tag: literal
 #: Chapter_02.xml:167
 #, no-c-format
 msgid "boolean save_state (OutputObjectState state, int ObjectType)"
-msgstr ""
+msgstr "boolean save_state (OutputObjectState state, int ObjectType)"
 
 #. Tag: para
 #: Chapter_02.xml:168
@@ -886,6 +932,9 @@
 "recovery for persistent objects it is necessary for all <command>save_state</"
 "command> methods to call <command>super.save_state</command>."
 msgstr ""
+"每当对象的状态需要为以后的使用(主要是恢复和持久化)而进行保存时,它将被调用。 <literal>ObjectType</literal> 参数指定 <command>save_state</command> 被 <emphasis>TxCore</emphasis> 调用的原因。这使程序员可以根据恢复和持久化是否需要该状态来把不同的信息保存至作为第一个参数提供的 <classname>OutputObjectState</classname> 里。例如,如用于恢复目的,其他 <emphasis>TxCore</emphasis> 对象的指针可以简单地保存为指针,而对于持久化则保存为 UID。如前面所展示的,<classname>OutputObjectState</"
+"classname> 类提供了方便保存所有 Java 基本类型实例的操作。为了支持持久性对象的崩溃恢复,所有 <command>save_state</"
+"command> 方法都有必要调用 <command>super.save_state</command>。"
 
 #. Tag: para
 #: Chapter_02.xml:170
@@ -894,13 +943,13 @@
 "<command>save_state</command> assumes that an object is internally "
 "consistent and that all variables saved have valid values. It is the "
 "programmer's responsibility to ensure that this is the case."
-msgstr ""
+msgstr "<command>save_state</command> 假定对象具有内部一致性,所有保存的变量都具有有效值。在编程时程序员需要确保这一点。"
 
 #. Tag: literal
 #: Chapter_02.xml:174
 #, no-c-format
 msgid "boolean restore_state (InputObjectState state, int ObjectType)"
-msgstr ""
+msgstr "boolean restore_state (InputObjectState state, int ObjectType)"
 
 #. Tag: para
 #: Chapter_02.xml:175
@@ -912,12 +961,14 @@
 "objects it is necessary for all <command>restore_state</command> methods to "
 "call <command>super.restore_state</command>."
 msgstr ""
+"每当对象的状态需要恢复时被调用。第二个参数允许状态的不同插值。为了支持持久性对象的崩溃恢复,所有 <command>restore_state</"
+"command> 方法都有必要调用 <command>super.restore_state</command>。"
 
 #. Tag: literal
 #: Chapter_02.xml:179
 #, no-c-format
 msgid "String type ()"
-msgstr ""
+msgstr "String type ()"
 
 #. Tag: para
 #: Chapter_02.xml:180
@@ -930,12 +981,14 @@
 "example, “/<classname>StateManager</classname>/<classname>LockManager</"
 "classname>/<classname>Object</classname>”."
 msgstr ""
+"<emphasis>TxCore</emphasis> 的持久化机制需要一个获取对象类型(字符串形式)的方法,这样它才可以在 Object Store 里保存/恢复对象的状态。这个信息通常指出类在层次结构中的位置。例如,“/<classname>StateManager</classname>/<classname>LockManager</"
+"classname>/<classname>Object</classname>”。"
 
 #. Tag: title
 #: Chapter_02.xml:190
 #, no-c-format
 msgid "Example"
-msgstr ""
+msgstr "示例"
 
 #. Tag: para
 #: Chapter_02.xml:192
@@ -946,7 +999,7 @@
 "illustrate saving and restoring of an object’s state, the highestIndex "
 "variable is used to keep track of the highest element of the array that has "
 "a non-zero value):"
-msgstr ""
+msgstr "请看下面源自 <classname>StateManager</classname> 的基本 <classname>Array</classname> 类(在这个例子里,为了解释保存和恢复对象的状态, highestIndex 变量用来记录这个类里非零值的索引值最高的元素):"
 
 #. Tag: programlisting
 #: Chapter_02.xml:196
@@ -975,6 +1028,28 @@
 "    private int highestIndex;\n"
 "    };"
 msgstr ""
+"public class Array extends StateManager\n"
+"{\n"
+"    public Array ();\n"
+"    public Array (Uid objUid);\n"
+"    public void finalize ( super.terminate(); };\n"
+"    \n"
+"    /* Class specific operations. */\n"
+"    \n"
+"    public boolean set (int index, int value);\n"
+"    public int get (int index);\n"
+"    \n"
+"    /* State management specific operations. */\n"
+"    \n"
+"    public boolean save_state (OutputObjectState os, int ObjectType);\n"
+"    public boolean restore_state (InputObjectState os, int ObjectType);\n"
+"    public String type ();\n"
+"    \n"
+"    public static final int ARRAY_SIZE = 10;\n"
+"    \n"
+"    private int[] elements = new int[ARRAY_SIZE];\n"
+"    private int highestIndex;\n"
+"    };"
 
 #. Tag: para
 #: Chapter_02.xml:198
@@ -983,6 +1058,8 @@
 "The <command>save_state</command>, <command>restore_state</command> and "
 "<command>type</command> operations can be defined as follows:"
 msgstr ""
+"下面是 <command>save_state</command>、<command>restore_state</command> 和 "
+"<command>type</command> 的定义:"
 
 #. Tag: programlisting
 #: Chapter_02.xml:202
@@ -1048,12 +1125,71 @@
 "    return \"/StateManager/Array\";\n"
 "}"
 msgstr ""
+"/* Ignore ObjectType parameter for simplicity */\n"
+"\n"
+"public boolean save_state (OutputObjectState os, int ObjectType)\n"
+"{\n"
+"    if (!super.save_state(os, ObjectType))\n"
+"        return false;\n"
+"    \n"
+"    try\n"
+"    {    \n"
+"        packInt(highestIndex);\n"
+"\n"
+"        /*\n"
+"        * Traverse array state that we wish to save. Only save active "
+"elements\n"
+"        */\n"
+"\n"
+"        for (int i = 0; i &lt;= highestIndex; i++)\n"
+"            os.packInt(elements[i]);\n"
+"            \n"
+"        return true;\n"
+"    }\n"
+"    catch (IOException e)\n"
+"    {\n"
+"        return false;\n"
+"    }\n"
+"}\n"
+" \n"
+"public boolean restore_state (InputObjectState os, int ObjectType)\n"
+"{\n"
+"    if (!super.restore_state(os, ObjectType))\n"
+"        return false;\n"
+"    \n"
+"    try\n"
+"    {\n"
+"        int i = 0;\n"
+"    \n"
+"        highestIndex = os.unpackInt();\n"
+"    \n"
+"        while (i &lt; ARRAY_SIZE)\n"
+"        {\n"
+"            if (i &lt;= highestIndex)\n"
+"                elements[i] =  os.unpackInt();\n"
+"            else\n"
+"                elements[i] = 0;\n"
+"            i++;\n"
+"        }\n"
+"        \n"
+"        return true;\n"
+"        }\n"
+"    catch (IOException e)\n"
+"    {\n"
+"        return false;\n"
+"    }\n"
+"}\n"
+" \n"
+"public String type ()\n"
+"{\n"
+"    return \"/StateManager/Array\";\n"
+"}"
 
 #. Tag: title
 #: Chapter_02.xml:207
 #, no-c-format
 msgid "Lock management and concurrency control"
-msgstr ""
+msgstr "锁管理和并行控制"
 
 #. Tag: para
 #: Chapter_02.xml:209
@@ -1069,7 +1205,7 @@
 "different forms); and as a remotely accessible store. More information about "
 "the object stores available in <emphasis>TxCore</emphasis> can be found in "
 "the Appendix."
-msgstr ""
+msgstr "<emphasis>TxCore</emphasis> 里的并行控制信息由锁来维护。需要在不同线程里的对象之间共享的锁可以保存在 Lock Store 里,这和前面介绍的 Object Store 相似。<emphasis>TxCore</emphasis> 提供的 Lock Store 具有一个刻意进行限制的接口,它可以用不同的方式来实施。例如,Lock Store 可以在共享内存里、Unix 文件系统里(以不同的形式)或是以远程访问的方式来实施。关于 <emphasis>TxCore</emphasis> 里可用的 Lock Store 的更多信息,请参考附录。"
 
 #. Tag: para
 #: Chapter_02.xml:211
@@ -1078,7 +1214,7 @@
 "As with all <emphasis>TxCore</emphasis> classes the default lock stores are "
 "pure Java implementations; to access the shared memory and other more "
 "complex lock store implementations it is necessary to use native methods."
-msgstr ""
+msgstr "和所有 <emphasis>TxCore</emphasis> 的类一样,缺省的 Lock Store 也是纯 Java 的实现。要访问共享内存和其他更为复杂的 Lock Store 实现,使用 native 方法是必需的。"
 
 #. Tag: programlisting
 #: Chapter_02.xml:213
@@ -1094,12 +1230,21 @@
 "    OutputObjectState state);\n"
 "    };"
 msgstr ""
+"public class LockStore\n"
+"{\n"
+"    public abstract InputObjectState read_state (Uid u, String tName)\n"
+"    throws LockStoreException;\n"
+"    \n"
+"    public abstract boolean remove_state (Uid u, String tname);\n"
+"    public abstract boolean write_committed (Uid u, String tName,\n"
+"    OutputObjectState state);\n"
+"    };"
 
 #. Tag: title
 #: Chapter_02.xml:216
 #, no-c-format
 msgid "Selecting a lock store implementation"
-msgstr ""
+msgstr "选择 Lock Store 的实现"
 
 #. Tag: para
 #: Chapter_02.xml:218
@@ -1116,12 +1261,14 @@
 "lockStoreType</literal> property variable. Currently this can have one of "
 "the following values:"
 msgstr ""
+"<emphasis>TxCore</emphasis> 支持几种不同的 Lock Store 的实现。如果对象模型为 SINGLE,那么维护锁就不需要 Lock Store,因为不会输出对象的信息。然而,如果使用了 MULTIPLE 模型,那么不同的运行环境(进程、Java 虚拟机)可能需要共享并行控制信息。Lock Store 使用的实施类型可以在执行环境里用 <literal>com.arjuna.ats.txoj.lockstore."
+"lockStoreType</literal> 属性变量指定。目前它可以有如下的值:"
 
 #. Tag: term
 #: Chapter_02.xml:222
 #, no-c-format
 msgid "BasicLockStore"
-msgstr ""
+msgstr "BasicLockStore"
 
 #. Tag: para
 #: Chapter_02.xml:223
@@ -1130,13 +1277,13 @@
 "This is an in-memory implementation which does not, by default, allow "
 "sharing of stored information between execution environments. The "
 "application programmer is responsible for sharing the store information."
-msgstr ""
+msgstr "这是一个内存里(In-memory)的实施,它缺省不会允许在执行环境间共享保存的信息。信息的共享需要应用程序开发人员来实现。"
 
 #. Tag: term
 #: Chapter_02.xml:227
 #, no-c-format
 msgid "BasicPersistentLockStore"
-msgstr ""
+msgstr "BasicPersistentLockStore"
 
 #. Tag: para
 #: Chapter_02.xml:228
@@ -1151,6 +1298,9 @@
 "arjuna.ats.txoj.lockstore.lockStoreDir</literal> property variable "
 "accordingly, or placing the location within the <literal>CLASSPATH</literal>:"
 msgstr ""
+"这是缺省的实施方法,它把锁信息保存在本地的文件系统里。因此共享相同文件 store 的执行环境可以共享并行控制信息。锁信息写入的文件系统的根是 <emphasis>TxCore</emphasis> 安装目录下的 <filename>LockStore</"
+"filename> 目录。这可以在运行时通过设置 <literal>com."
+"arjuna.ats.txoj.lockstore.lockStoreDir</literal> 属性变量或者替换 <literal>CLASSPATH</literal> 的路径来覆盖。"
 
 #. Tag: command
 #: Chapter_02.xml:230
@@ -1159,18 +1309,20 @@
 "java -D com.arjuna.ats.txoj.lockstore.lockStoreDir=/var/tmp/LockStore "
 "myprogram"
 msgstr ""
+"java -D com.arjuna.ats.txoj.lockstore.lockStoreDir=/var/tmp/LockStore "
+"myprogram"
 
 #. Tag: para
 #: Chapter_02.xml:232
 #, no-c-format
 msgid "<para>or</para>"
-msgstr ""
+msgstr "<para>或</para>"
 
 #. Tag: command
 #: Chapter_02.xml:234
 #, no-c-format
 msgid "java –classpath $CLASSPATH;/var/tmp/LockStore myprogram"
-msgstr ""
+msgstr "java –classpath $CLASSPATH;/var/tmp/LockStore myprogram"
 
 #. Tag: para
 #: Chapter_02.xml:236
@@ -1179,13 +1331,13 @@
 "If neither of these approaches is taken, then the default location will be "
 "at the same level as the <filename>etc</filename> directory of the "
 "installation."
-msgstr ""
+msgstr "如果不使用这两种方法,那么缺省的位置将和安装目录里的 <filename>etc</filename> 目录平级。"
 
 #. Tag: title
 #: Chapter_02.xml:245
 #, no-c-format
 msgid "LockManager"
-msgstr ""
+msgstr "LockManager"
 
 #. Tag: para
 #: Chapter_02.xml:247
@@ -1205,7 +1357,7 @@
 "normally under control of the system and requires no further intervention by "
 "the programmer. This ensures that the two-phase property can be correctly "
 "maintained."
-msgstr ""
+msgstr "并行控制是用 <classname>LockManager</classname> 类实现的,它提供缺省行为但也允许程序员在特殊模式下进行覆盖。并行控制器的主要编程接口是通过 setlock 操作来进行的。在缺省情况下,对每个对象,运行系统在多个 reader、单一 writer 策略之后,都强制严格的两阶段锁定。既然 <classname>StateManager</classname> 不能决定某个操作是否需要修改对象,而 <classname>LockManager</classname> 也不能决定操作是否需要读或写锁,那么锁的获取就通过编程来控制。然而,锁的释放通常是系统来控制的,它不需要程序员的进一步干预。这确保了正确的两阶段属性。"
 
 #. Tag: para
 #: Chapter_02.xml:249
@@ -1222,6 +1374,8 @@
 "be saved if the object is recoverable. In a similar fashion, successful lock "
 "acquisition causes <command>activate</command> to be invoked."
 msgstr ""
+"<classname>LockManager</classname> 类主要负责管理为对象设置锁的请求或者酌情释放"
+"锁。然而,既然它来源于 <classname>StateManager</classname>,它也可以控制是否调用某些继承的功能。例如,<classname>LockManager</classname> 假定写锁的设定暗示着调用操作必须修改对象。反过来如果对象是可恢复的,这会导致对恢复信息的保存。类似地,对锁的成功获取导致 <command>activate</command> 操作的调用。"
 
 #. Tag: para
 #: Chapter_02.xml:251
@@ -1237,6 +1391,8 @@
 "extends the <command>save_state</command> and <command>restore_state</"
 "command> methods of <classname>StateManager</classname>."
 msgstr ""
+"因此,<classname>LockManager</classname> 直接负责激活/取消激活持久性对象以及注册用于并行控制管理的 <classname>Resources</classname>。通过启用 <classname>StateManager</classname> 类,它也负责注册用于持久化/可恢复的状态操作和对象恢复的 <classname>Resources</classname>。应用程序开发人员简单地设置合适的锁,启动和结束事务,且继承 <classname>StateManager</classname> 的 <command>save_state</command> 和 <command>restore_state</"
+"command> 方法。"
 
 #. Tag: programlisting
 #: Chapter_02.xml:253
@@ -1280,6 +1436,43 @@
 ". . .\n"
 "};"
 msgstr ""
+"public class LockResult\n"
+"{\n"
+"public static final int GRANTED;\n"
+"public static final int REFUSED;\n"
+"public static final int RELEASED;\n"
+"};\n"
+"\n"
+"public class ConflictType\n"
+"{\n"
+"public static final int CONFLICT;\n"
+"public static final int COMPATIBLE;\n"
+"public static final int PRESENT;\n"
+"};\n"
+"\n"
+"public abstract class LockManager extends StateManager\n"
+"{\n"
+"public static final int defaultTimeout;\n"
+"public static final int defaultRetry;\n"
+"public static final int waitTotalTimeout;\n"
+"\n"
+"public synchronized int setlock (Lock l);\n"
+"public synchronized int setlock (Lock l, int retry);\n"
+"public synchronized int setlock (Lock l, int retry, int sleepTime);\n"
+"public synchronized boolean releaselock (Uid uid);\n"
+"\n"
+"/* abstract methods inherited from StateManager */\n"
+"\n"
+"public boolean restore_state (InputObjectState os, int ObjectType);\n"
+"public boolean save_state (OutputObjectState os, int ObjectType);\n"
+"public String type ();\n"
+"\n"
+"protected LockManager ();\n"
+"protected LockManager (int ObjectType, ObjectName attr);\n"
+"protected LockManager (Uid storeUid);\n"
+"protected LockManager (Uid storeUid, int ObjectType, ObjectName attr);\n"
+". . .\n"
+"};"
 
 #. Tag: para
 #: Chapter_02.xml:255
@@ -1289,7 +1482,7 @@
 "of lock required (<literal>READ</literal> / <literal>WRITE</literal>), and "
 "the number of retries to acquire the lock before giving up. If a lock "
 "conflict occurs, one of the following scenarios will take place:"
-msgstr ""
+msgstr "<command>setlock</command> 操作必须用所要求的锁的类型(<literal>READ</literal> / <literal>WRITE</literal>)以及获取锁的重试次数参数化。如果存在锁的冲突,就会出现下面的情况之一:"
 
 #. Tag: para
 #: Chapter_02.xml:257
@@ -1300,6 +1493,8 @@
 "blocked until the lock is released, or the total timeout specified has "
 "elapsed, and in which <literal>REFUSED</literal> will be returned."
 msgstr ""
+"如果 retry 的值和 <literal>LockManager.waitTotalTimeout</"
+"literal> 相等,那么调用 <command>setlock</command> 的线程将堵塞,直到锁释放为止,或是已过了指定的超时时间且返回的是 <literal>REFUSED</literal>。"
 
 #. Tag: para
 #: Chapter_02.xml:261
@@ -1311,6 +1506,8 @@
 "attempts, each attempt being separated by a 0.25 seconds delay; the time "
 "between retries is specified in micro-seconds."
 msgstr ""
+"如果开始时不能获取锁,<classname>LockManager</"
+"classname> 将重试指定的次数,每次尝试失败之后都等待指定的时间。缺省是 100 次,每次尝试之间都有 0.25 秒的间隔;重试之间的间隔以毫秒指定。"
 
 #. Tag: para
 #: Chapter_02.xml:263
@@ -1324,7 +1521,7 @@
 "the programmer to ensure that the remainder of the code for an operation is "
 "only executed if a lock request is granted. Below are examples of the use of "
 "the <command>setlock</command> operation."
-msgstr ""
+msgstr "如果发生了锁冲突,当前的实现简单地使锁请求超时,这就避免了死锁而不需要提供完全的死锁检测模式。如果获得了所请求的锁,setlock 操作将返回 <literal>GRANTED</literal> 值,否则将返回 <literal>REFUSED</literal>。程序员要确保只有在获取了锁以后才执行后面的代码。下面是一个使用 <command>setlock</command> 操作的例子。"
 
 #. Tag: programlisting
 #: Chapter_02.xml:265
@@ -1347,6 +1544,22 @@
 "    // 100 retries) on the object\n"
 "    // before giving up."
 msgstr ""
+"res = setlock(new Lock(WRITE), 10);        \n"
+"    // Will attempt to set a\n"
+"    // write lock 11 times (10\n"
+"    // retries) on the object\n"
+"    // before giving up.\n"
+"                \n"
+"res = setlock(new Lock(READ), 0);        \n"
+"    // Will attempt to set a read\n"
+"    // lock 1 time (no retries) on\n"
+"    // the object before giving up.\n"
+"    \n"
+"res = setlock(new Lock(WRITE);        \n"
+"    // Will attempt to set a write\n"
+"    // lock 101 times (default of\n"
+"    // 100 retries) on the object\n"
+"    // before giving up."
 
 #. Tag: para
 #: Chapter_02.xml:267
@@ -1361,13 +1574,13 @@
 "<emphasis>outside</emphasis> of the scope of an atomic action, it is the "
 "programmer's responsibility to release the locks when required, using the "
 "corresponding <command>releaselock</command> operation."
-msgstr ""
+msgstr "并行控制机制集成在原子动作机制里,因此保证了当获取了对象的锁时,合适的信息向原子动作注册以确保在正确时间释放锁。如果锁是在原子动作里获取的话,这解除了程序员显性地释放锁的负担。然而,如果锁是在原子动作作用域<emphasis>之外</emphasis>获取的话,程序员要负责用 <command>releaselock</command> 操作按需要释放锁。"
 
 #. Tag: title
 #: Chapter_02.xml:272
 #, no-c-format
 msgid "Locking policy"
-msgstr ""
+msgstr "锁策略"
 
 #. Tag: para
 #: Chapter_02.xml:274
@@ -1389,6 +1602,9 @@
 "definitions of the conflict operations enhanced levels of concurrency may be "
 "possible."
 msgstr ""
+"不象许多其他系统,<emphasis>TxCore</emphasis> 里的锁不具有特殊的系统类型。相反,它们都是其他 <emphasis>TxCore</emphasis> 对象(<classname>Lock</classname> 类也是继承自 <classname>StateManager</classname>,所以可根据需要持久化且可以简单形式命名)的简单实例。而且,<classname>LockManager</classname> 刻意不顾授予锁请求时使用的实际策略的模式。这样的信息由实际的 <classname>Lock</"
+"classname> 类的实例来维护,它提供 <classname>LockManager</"
+"classname> 可用来检测锁冲突的操作(<literal>conflictsWith</literal>)。这种分离很重要,因为它允许程序员从基本的 <classname>Lock</classname> 类派生新的锁类型,且通过定义合适的冲突而使增强的不行控制成为可能。"
 
 #. Tag: programlisting
 #: Chapter_02.xml:276
@@ -1420,6 +1636,31 @@
 "    . . .\n"
 "};"
 msgstr ""
+"public class LockMode\n"
+"{\n"
+"    public static final int READ;\n"
+"    public static final int WRITE;\n"
+"};\n"
+"\n"
+"public class LockStatus\n"
+"{\n"
+"    public static final int LOCKFREE;\n"
+"    public static final int LOCKHELD;\n"
+"    public static final int LOCKRETAINED;\n"
+"};\n"
+"\n"
+"public class Lock extends StateManager\n"
+"{\n"
+"    public Lock (int lockMode);\n"
+"    \n"
+"    public boolean conflictsWith  (Lock otherLock);\n"
+"    public boolean modifiesObject ();\n"
+"    \n"
+"    public boolean restore_state (InputObjectState os, int ObjectType);\n"
+"    public boolean save_state (OutputObjectState os, int ObjectType);\n"
+"    public String type ();\n"
+"    . . .\n"
+"};"
 
 #. Tag: para
 #: Chapter_02.xml:278
@@ -1432,12 +1673,14 @@
 "can be supported. The supplied <classname>Lock</classname> class supports "
 "the traditional multiple reader/single writer policy."
 msgstr ""
+"<classname>Lock</classname> 提供了一个 <command>modifiesObject</"
+"command> 操作,<classname>LockManager</classname> 用它来决定在赋予锁时是否需要调用 modified。提供这个操作是为了支持锁模式而不是简单的读和写。<classname>Lock</classname> 类支持传统的多 reader/单一 writer 策略。"
 
 #. Tag: title
 #: Chapter_02.xml:283
 #, no-c-format
 msgid "Object construction and destruction"
-msgstr ""
+msgstr "对象构造和析构"
 
 #. Tag: para
 #: Chapter_02.xml:285
@@ -1449,13 +1692,13 @@
 "constructed. Thus <classname>LockManager</classname> provides two protected "
 "constructors for use by derived classes, each of which fulfils a distinct "
 "purpose:"
-msgstr ""
+msgstr "让我们回忆一下,<emphasis>TxCore</emphasis> 对象可以是可恢复的、可恢复及持久的或者是 NEITHER。此外,每个对象都拥有一个唯一的内部名称。这些属性只有在对象被构造时才可进行设置。因此 <classname>LockManager</classname> 提供两个作用域为 protected 的构造函数供子类使用,每个都用于不同的目的:"
 
 #. Tag: command
 #: Chapter_02.xml:289
 #, no-c-format
 msgid "LockManager ()"
-msgstr ""
+msgstr "LockManager ()"
 
 #. Tag: para
 #: Chapter_02.xml:290
@@ -1463,13 +1706,13 @@
 msgid ""
 "This constructor allows the creation of new objects, that is, no prior state "
 "is assumed to exist."
-msgstr ""
+msgstr "这个构造函数允许创建新的对象,也就是假定以前的状态不存在。"
 
 #. Tag: command
 #: Chapter_02.xml:294
 #, no-c-format
 msgid "LockManager (int ObjectType, ObjectName attr)"
-msgstr ""
+msgstr "LockManager (int ObjectType, ObjectName attr)"
 
 #. Tag: para
 #: Chapter_02.xml:295
@@ -1488,7 +1731,7 @@
 "object itself (i.e., it has no external representation), otherwise an in-"
 "memory (volatile) object store is used to store the state of the object "
 "between atomic actions."
-msgstr ""
+msgstr "这个构造函数允许创建新的对象,也就是假定以前的状态不存在。<literal>ObjectType</literal> 参数指定对象是否是可恢复的(<literal>RECOVERABLE</literal>)、可恢复且持久的(<literal>ANDPERSISTENT</literal>)或两者皆非(<literal>NEITHER</literal>)。如果对象被标记为持久的,那么该对象的状态将保存在某个 Object Store 里。共享参数为只有为 <literal>RECOVERABLE</literal> 时才有意义;如果 <literal>attr</literal> 非空且对象模型为 <literal>SINGLE</literal>(缺省值),那么对象的可恢复状态将在对象内部进行维护(也就是没有外部的代表),否则内存里(In-memory)的 Object Store 将被用来保存原子动作间的对象状态。"
 
 #. Tag: para
 #: Chapter_02.xml:297
@@ -1500,7 +1743,7 @@
 "constructor commits or, if an enclosing action exists, when the appropriate "
 "top-level action commits. Later examples in this chapter illustrate this "
 "point further."
-msgstr ""
+msgstr "新的持久性对象的构造函数应该利用其自身的原子动作。这将确保对象的状态在构造函数里的动作提交时,或存在包含的动作而相关的顶层事务提交时,自动地写入到 Object Store。本章后面的例子将进一步解释这一点。"
 
 #. Tag: command
 #: Chapter_02.xml:301
@@ -1525,7 +1768,7 @@
 #: Chapter_02.xml:306
 #, no-c-format
 msgid "LockManager(Uid objUid, ObjectName attr)"
-msgstr ""
+msgstr "LockManager(Uid objUid, ObjectName attr)"
 
 #. Tag: para
 #: Chapter_02.xml:307
@@ -1538,7 +1781,7 @@
 "automatically by the system. If the attr parameter is not null, and the "
 "object model is <literal>SINGLE</literal> (the default behaviour), then the "
 "object will not be reactivated at the start of each top-level transaction."
-msgstr ""
+msgstr "这个构造函数允许访问现有的持久性对象,其内部名由 <literal>objUid</literal> 参数指定。用这个操作构造的对象通常将具有由系统从 Object Store 里自动加载的之前的状态(由 <literal>objUid</literal> 指定)。如果 attr 参数非空,且对象模型是 <literal>SINGLE</literal>(缺省行为),那么对象将不会在每个顶层事务启动时被重新激活。"
 
 #. Tag: para
 #: Chapter_02.xml:309
@@ -1547,7 +1790,7 @@
 "The destructor of a programmer-defined class must invoke the inherited "
 "operation terminate to inform the state management mechanism that the object "
 "is about to be destroyed otherwise unpredictable results may occur."
-msgstr ""
+msgstr "用户自定义的类的析构必须调用继承的操作 terminate 来通知状态管理机制对象将被销毁,否则可能出现不可预料的后果。"
 
 #. Tag: para
 #: Chapter_02.xml:311
@@ -1559,4 +1802,6 @@
 "classname> class. As such, it is possible to set the "
 "<classname>StateManager</classname> object model as described earlier."
 msgstr ""
+"因为 <classname>LockManager</classname> 继承自 <classname>StateManager</classname>,它将把任何提供的 <classname>ObjectName</classname> 实例传递给 <classname>StateManager</"
+"classname> 类。因此,如之前所描述的,你可以设置 <classname>StateManager</classname> 对象模型。"
 




More information about the jboss-cvs-commits mailing list