1 2 Previous Next 20 Replies Latest reply on Feb 22, 2010 11:27 AM by andy.miller Go to original post
      • 15. Re: Transaction Behavior Question
        jaikiran

        jaikiran wrote:

         



        I looked at the JTA spec and its javadocs. I don't see anything which states that the timeout applies only when the tx is in active state. My understanding is that, even if the tx is suspended, the timeout still applies.


        I just read this JBoss Transactions documentation. It says:

         

        Timeout values can be associated with transactions in order to control their lifetime. If a transaction has not terminated (committed or rolled back) before the timeout value elapses, the transaction system will automatically roll it back

        So no mention of special treatment to suspended transactions.

         

        I even read some documentations of other application servers and they too timeout a suspended transaction.

        • 16. Re: Transaction Behavior Question
          jaikiran

          jaikiran wrote:


           

          I even read some documentations of other application servers and they too timeout a suspended transaction.

          This and  this (section Bean-Level Container-Managed Transaction Timeouts)

           

           


          1 of 1 people found this helpful
          • 17. Re: Transaction Behavior Question
            adinn

            jaikiran wrote:


            I looked at the JTA spec and its javadocs. I don't see anything which states that the timeout applies only when the tx is in active state. My understanding is that, even if the tx is suspended, the timeout still applies. That's the behaviour i am seeing currently.

             

            Maybe the JBoss Transactions team has some inputs?

             

            I don't know for sure if there is anything in any spec to suggest that suspending a transaction should also suspend countdown towards its timeout. However, I do know what we do to time them out. We insert newly created transactions in a time-ordered queue tagged with a best-before-date equal to (startTime + timeOut). They get rolled back if timeNow ever exceeds that value, irrespective of whether they are active or suspended. As far as we are concerned they are active all this time. A suspend merely disassociates the transaction from the current thread. It does not change the transaction status.

            • 18. Re: Transaction Behavior Question
              marklittle
              Correct. The timeout is associated with the transaction and not the fact that the transaction is associated with an active thread of control. Suspending only changes the thread association: it has no impact on the timeout.
              1 of 1 people found this helpful
              • 19. Re: Transaction Behavior Question
                andy.miller

                adinn wrote:

                 

                jaikiran wrote:


                I looked at the JTA spec and its javadocs. I don't see anything which states that the timeout applies only when the tx is in active state. My understanding is that, even if the tx is suspended, the timeout still applies. That's the behaviour i am seeing currently.

                 

                Maybe the JBoss Transactions team has some inputs?

                 

                I don't know for sure if there is anything in any spec to suggest that suspending a transaction should also suspend countdown towards its timeout. However, I do know what we do to time them out. We insert newly created transactions in a time-ordered queue tagged with a best-before-date equal to (startTime + timeOut). They get rolled back if timeNow ever exceeds that value, irrespective of whether they are active or suspended. As far as we are concerned they are active all this time. A suspend merely disassociates the transaction from the current thread. It does not change the transaction status.

                Thanks for the clarification on the behavior.  I made an assumption that was simply wrong.  Now, I know how to make work what I want.  I was concerned there was a bug, but its not.

                • 20. Re: Transaction Behavior Question
                  andy.miller

                  mark.little@jboss.com wrote:

                   

                  Correct. The timeout is associated with the transaction and not the fact that the transaction is associated with an active thread of control. Suspending only changes the thread association: it has no impact on the timeout.

                  Thanks for the confirmation Mark.  I now have things working the way I want.  Once I realized what the real behavior was, it started to become apparent what transaction attribute annotations I needed.

                  1 2 Previous Next