[jboss-svn-commits] JBL Code SVN: r31954 - labs/jbosstm/enterprise/tags/EAP_5_0_1/Transactions_JTS_Programmers_Guide/en-US.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Mar 5 00:45:20 EST 2010


Author: misty at redhat.com
Date: 2010-03-05 00:45:20 -0500 (Fri, 05 Mar 2010)
New Revision: 31954

Modified:
   labs/jbosstm/enterprise/tags/EAP_5_0_1/Transactions_JTS_Programmers_Guide/en-US/JBossTS_basics.xml
Log:
Added another section


Modified: labs/jbosstm/enterprise/tags/EAP_5_0_1/Transactions_JTS_Programmers_Guide/en-US/JBossTS_basics.xml
===================================================================
--- labs/jbosstm/enterprise/tags/EAP_5_0_1/Transactions_JTS_Programmers_Guide/en-US/JBossTS_basics.xml	2010-03-05 03:57:35 UTC (rev 31953)
+++ labs/jbosstm/enterprise/tags/EAP_5_0_1/Transactions_JTS_Programmers_Guide/en-US/JBossTS_basics.xml	2010-03-05 05:45:20 UTC (rev 31954)
@@ -274,7 +274,34 @@
 	<section id="sect-JTS_Programmers_Guide-JTS_Basics-Thread_Class">
 	  <title>Thread Class</title>
 	  <para>
+	    <application>JBoss Transaction Service</application> is fully multi-threaded and supports the OTS notion of allowing multiple threads to be active within a transaction, and for a thread to execute multiple transactions (although a thread can only be active within a single transaction at a time). By default, if a thread is created within the scope of a transaction (i.e., the creating thread has a transaction context associated with it), the new thread will not be associated with the transaction. If the thread is to be associated with the transaction then use the resume method of either the AtomicTransaction class or Current.
 	  </para>
+	  <para>
+	    However, if it is required that newly created threads automatically inherit the transaction context of their parent, then they should be derived from the OTS_Thread class:
+	  </para>
+	  <programlisting language="Java" role="JAVA">
+	    public class OTS_Thread extends Thread
+	    {
+	    public void terminate ();
+	    public void run ();
+
+	    protected OTS_Thread ();
+	    };
+	  </programlisting>
+	  <para>
+	    The programmer must call the run method of <methodname>OTS_Thread</methodname> at the start of the run method of the application thread class. Likewise, it is necessary to call <methodname>terminate</methodname> prior to exiting the body of the application thread’s run method:
+	  </para>
+
+	  <programlisting language="Java" role="JAVA">
+	    public void run ()
+	    {
+	    super.run();
+
+	    // do my work
+
+	    super.terminate();
+	    }
+	  </programlisting>
 	</section>
 
 	<section id="sect-JTS_Programmers_Guide-JTS_Basics-ORB_Portability_Issues">



More information about the jboss-svn-commits mailing list