I use jboss 4.2.3.
It has setting "TransactionTimeout" (in jboss-service.xml), that specifies how long Transaction is allowed to execute.
Unfortunately, when the timeout passes, the execution isn't aborted right now, if the transaction is doing something, only it is marked to be rolled back later.
The effect is - when I have long lasting transaction and thread is wainting on preparedStatement.execute for example, and when the TransactionTimeout passes, nothing happend, client still hang, only when the preparedStatement finishes, there is Exception that transaction was rolled back.
I tried the interceptor from http://management-platform.blogspot.com/2008/11/transaction-timeouts-and-ejb3jpa.html but it only markse thread as interrupted, most methods won't check for this when executing, so effect is the same.
I've tried also setting preparedStatement.setQueryTimeout, but on Oracle (which we use), it waits with aborting session till oracle feels like doing it (for example it won't abort plsql procedure that is doing dbms_lock.sleep(..)).
I would like to kill database session associated with the transaction, that timed out - I know which transaction it is, and with which thread it is associated (because I use the interceptor from the link I given above), but I don't know how to get session the transaction is bound to - I have to get it, to kill it - and then the thread will get interrupted.
Am I missing easier solution, or doing it completely wrong :) ?