<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi, <br>
    <br>
    Apologies if this message is any way inappropriate (wrong place,
    etc.)<br>
    <br>
    After having read the following code in<tt>
      org.drools.persistence.jta.JtaTransactionManager</tt> 1000 times,
    I realized that there was something a little fishy about the code in<tt>
      JtaTransactionManager.commit()</tt> (see code (especially in blue)
    below). <br>
    <br>
    It seems like the private boolean localTransaction is being used to
    provide basic (1 level) of transaction nesting -- but that it
    doesn't do that (no un-nesting) and needs to be fixed. <br>
    <br>
    If anyone wouldn't mind speaking up (on- or off-list) about what
    exactly the code was meant to do or otherwise what the idea was when
    the code was written, I'd appreciate it! I obviously have my own
    ideas, but want to make sure I'm not missing anything. <br>
    <br>
    <blockquote type="cite"><tt>public void begin() {<br>
        &nbsp;&nbsp;&nbsp; if ( getStatus() == TransactionManager.STATUS_NO_TRANSACTION
        ) {<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>this.localTransaction = true;</b><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.ut.begin();<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch ( Exception e ) {<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.warn( "Unable to begin transaction", e);<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new RuntimeException( "Unable to begin
        transaction",<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e );<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
        &nbsp;&nbsp;&nbsp; } else {<br>
        &nbsp;<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.localTransaction = false;</b><br>
        &nbsp;&nbsp;&nbsp; }<br>
        }<br>
        <br>
        public void commit() {<br>
        <b>&nbsp;&nbsp;&nbsp; if ( this.localTransaction ) {</b><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.ut.commit();<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch ( Exception e ) {<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.warn( "Unable to commit transaction", e);<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new RuntimeException( "Unable to commit
        transaction",<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e );<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
        <font color="#3333ff"><b>&nbsp;&nbsp;&nbsp; } else {<br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; localTransaction = false;<br>
            &nbsp;&nbsp;&nbsp; }</b></font><br>
        }</tt><br>
    </blockquote>
    <br>
    (It's not making sense to me why you would set a false boolean to..
    false. :) And I have the idea that the else clause was meant to
    "un-nest" the logical transaction. )<br>
    <br>
    Thanks, <br>
    Marco<br>
  </body>
</html>