This content has been marked as final. Show 3 replies
Solved it myself. It's a thread problem. My javaclass, which contains de sql statement (DAO), was simultaneous used by concurrent thread. Still no problem, but i noticed that i cached the current connection, so: thread 1 opened connection A (current connection = A); thread 2 opened connection B (current connection became B). Thread 1 was done with the work en closed the current connection, which is connection B ! Thread 2 tried to close 'his' current connection, which is also connection B and that one was already closed !! So "Connection handle has been closed and is unusable" really was the case there. Notice that connection A is this case is still open !
Solution: i've changed the method signature of my DAO's public method and added the keyword 'synchronized'. Case solved.
Hopes this helps anymore.
You should avoid 'synchronized' to not block EJB threads as mentioned in the spec.
If we do not use 'synchronized' then what is the other possible option to avoid "Connection has been closed" ?