title: How JTA/JTS handle transaction time out issue?
body: <p>Below is my understand that JTA/ JTS handle transaction time out issue. But I cannot find my document or material to back my understand. Is my understand right? Do u know any material is refer to this issue?</p>
  
  <p>Application Server iterates through all the transactions to check timeout. If a transaction timeout occurs, application server marks roll back for the transaction, and log down the detail. <strong>But Application Server neither throws exception nor interrupts the transaction this moment.</strong> When the transaction thread continue to attempt to access another transactional resource (like JDBC/ JMS), the transactional resource which implements JTA interface will check roll back flag first before go further. Then at this moment, RollbackException is thrown.</p>
  
  <p>==========</p>
  
  <p>Test Case 1:
  Set transaction timeout to 10 secs</p>
  
  <p>I.  Transaction begin</p>
  
  <p>II. Sleep 20 secs</p>
  
  <p>III.    System out "Sleep end"</p>
  
  <p>Result: Timeout occur at 10th secs, and system out log down the timeout detail, but not throw exception. "Sleep end" will be printed.</p>
  
  <p>==========</p>
  
  <p>Test Case 2:
  Set transaction timeout to 10 secs</p>
  
  <p>I.  Transaction begin</p>
  
  <p>II. Sleep 20 secs</p>
  
  <p>III.    Access db 1st time</p>
  
  <p>IV. Access db 2nd time</p>
  
  <p>V.  System out "Sleep end"</p>
  
  <p>Result: Timeout occur at 10th secs, and system out logs down the timeout detail, but not throw exception. Exception throws while access db 1st time. "Sleep end" will not be printed.</p>
  
  <p>==========</p>
  
  <p>Test Case 3:
  Set transaction timeout to 10 secs</p>
  
  <p>I.  Transaction begin</p>
  
  <p>II. Access db and db deadlock</p>
  
  <p>Result: Timeout occur at 10th secs, and system out logs down the timeout detail. No exception throws, the transaction thread is stuck. <strong>So transaction timeout control cannot handle db timeout issue.</strong> I am so confused about this..</p>
  
  <p><strong>In my understanding, above behavior should be the same while using spring transaction management(JTA) and EJB. Am I right?</strong></p>
  
  <p>Thanks for ur help!</p>