This content has been marked as final.
Show 3 replies
-
1. Re: Connection handle has been closed and is unusable
wil Jan 21, 2004 2:46 AM (in response to wil)"wil@jboss" wrote:
Hi,
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.
bye -
2. Re: Connection handle has been closed and is unusable
milowe Jan 21, 2004 3:18 AM (in response to wil)"milowe" wrote:
You should avoid 'synchronized' to not block EJB threads as mentioned in the spec. -
3. Re: Connection handle has been closed and is unusable
ujwallshetty Jul 21, 2011 6:23 AM (in response to milowe)If we do not use 'synchronized' then what is the other possible option to avoid "Connection has been closed" ?