[jboss-cvs] JBossCache/docs/JBossCache-UserGuide/en/modules ...

Brian Stansberry brian.stansberry at jboss.com
Thu May 31 01:19:06 EDT 2007


  User: bstansberry
  Date: 07/05/31 01:19:06

  Modified:    docs/JBossCache-UserGuide/en/modules  transactions.xml
  Log:
  Discuss injecting TM via RuntimeConfig
  
  Revision  Changes    Path
  1.10      +27 -6     JBossCache/docs/JBossCache-UserGuide/en/modules/transactions.xml
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: transactions.xml
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/docs/JBossCache-UserGuide/en/modules/transactions.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -b -r1.9 -r1.10
  --- transactions.xml	30 May 2007 11:56:45 -0000	1.9
  +++ transactions.xml	31 May 2007 05:19:06 -0000	1.10
  @@ -282,12 +282,16 @@
            </listitem>
         </orderedlist>
         <para>
  -         In order to do this, the cache has
  -         to be configured with an instance of a
  -         <literal>TransactionManagerLookup</literal>
  -         which
  -         returns a
  +         In order to do this, the cache has to be provided with a 
  +         reference to environment's 
            <literal>javax.transaction.TransactionManager</literal>
  +         .  This is usually done by configuring the cache
  +         with the class name of an implementation of the
  +         <literal>TransactionManagerLookup</literal>
  +         interface. When the cache starts, it will create an instance of this
  +         class and invoke its <literal>getTransactionManager()</literal>
  +         method, which returns a reference to the
  +         <literal>TransactionManager</literal>
            .
         </para>
   
  @@ -314,6 +318,23 @@
            not recommended for production use.
         </para>
   
  +      <para>
  +         An alternative to configuring a <literal>TransactionManagerLookup</literal>
  +         is to programatically inject a reference to the <literal>TransactionManager</literal>
  +         into the <literal>Configuration</literal> object's <literal>RuntimeConfig</literal> element:
  +      </para>
  +      
  +      <programlisting>
  +         TransactionManager tm = getTransactionManager(); // magic method
  +         cache.getConfiguration().getRuntimeConfig().setTransactionManager(tm);         
  +      </programlisting>
  +      
  +      <para>
  +         Injecting the <literal>TransactionManager</literal> is the recommended
  +         approach when the <literal>Configuration</literal> is built by some sort of
  +         IOC container that already has a reference to the TM.
  +      </para>
  +      
         <para>When the transaction commits, we initiate either a one- two-phase commit
            protocol. See
            <link linkend="replication.tx">replicated caches and transactions</link>
  
  
  



More information about the jboss-cvs-commits mailing list