java - Handling TransactionTimeout Exception in EJB -



java - Handling TransactionTimeout Exception in EJB -

i have ejb method called methoda() calling ejb method called methodb() starts new container managed transaction. in methodb, forcing transaction timeout rightly caught caughtb , not propagated methoda. surprised methoda receives exception. missing soemthing here?

methoda() { seek { methodb(); system.out.println("print me!"); } catch(exception e) { system.out.println("shouldn't here"); } } @transactiontimeout(5) //5 sec timeout methodb() { seek { thread.sleep(6000); } catch(throwable t) { system.out.println("eating exception.."); } }

the first method should have never caught exception (ejbtransactiontimeoutexception) because methodb have eaten it. seeing output of "shouldn't here" instead of "print me!". makes me wonder if container throws yet exception of ejbtransactiontimeoutexception after methodb completed although has thrown timeout exception?

thread.sleep() never throws transactiontimeoutexception, there no way grab block catches exception.

when ejb calls methodb ejb b, doesn't phone call bean method directly. calls methodb on proxy. proxy responsible handling transaction management, security, etc. , phone call actual methodb on bean instance.

so exception not thrown withing methodb. it's called proxy wraps ejb b, , throws transactiontimeoutexception when methodb of wrapped bean instance returns, , has taken more configured timeout execute.

java exception-handling transactions jboss ejb

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -