setTransactionTimeout

Hi all,

I am trying to understand how to use setTransactionTimeout in conjunction with WmArt’s explicit transaction management.

I created a test rig as follows -

  • pub.art.transaction:setTransactionTimeout (timeoutSeconds = 5)
  • pub.art.transaction:startTransaction
  • Sequence (try/catch)
    – Sequence (try)
    — Call Oracle stored procedure which sleeps for 10 seconds
    — pub.art.transaction:commitTransaction
    – Sequence (catch)
    — pub.art.transaction:rollbackTransaction

When I run this I was expecting the Oracle call to be interrupted for taking longer than 5 seconds but what I see is the call completing normally after 10 seconds.

Any suggestions? Have I misunderstood the function of the transaction timeout?

Thanks,

Allan

Allan,

Do you see any information in the logs on why its not getting rolled back? As per documentation your test code seems to be correct.

Shahid,

Thanks for your reply. The original version of my test did not originally include any database changes, just a sleep routine, so there was nothing to commit or roll back.

I subsequently added a database insert to my test and noted that, while the service did not terminate early, the insert was committed if the timeout was not breached and rolled back if the timeout was breached.

Evidently my original assumption (that the service would terminate upon reaching timeout) was incorrect. The transaction is rolling back correctly, however, so this is not a problem.

Thanks,

Allan