I am using jboss 4.2.3.
It has a TransactionTimeout parameter (in jboss-service.xml) that indicates how long the transaction can take.
Unfortunately, when the timeout passes, the execution is not canceled right now, if the transaction does something, only it is marked as rolled back later.
The effect is when I have a long transaction and the flow is wainting on prepareStatement.execute, for example, and when the TransactionTimeout passes, nothing happens, the client still freezes, only when the readyStatement ends, is there an Exception that the transaction was rolled back.
I tried the interceptor from http://management-platform.blogspot.com/2008/11/transaction-timeouts-and-ejb3jpa.html , but it only marks the stream as interrupted, most methods will not check this when it is executed, so the effect is same.
I also tried setting prepareStatement.setQueryTimeout, but on Oracle (which we use) it waits with a session termination until the oracle wants to do this (for example, it does not interrupt the plsql procedure that dbms_lock.sleep (..) does).
I would like to kill a database session associated with a transaction, timeout - I know which transaction it is and which thread it is associated with (because I use the interceptor from the link above), but I donβt know How to get the session that the transaction is attached to - I have to get it in order to kill it - and then the thread will be aborted.
Am I missing a simpler solution, or am I doing it completely wrong :)?
source share