| Author |
Bad decision to open connection inside PostConstruct and close connection inside PreDestroy?
|
Amandeep Singh
Ranch Hand
Joined: Jul 17, 2008
Posts: 820
|
|
As I've read in EJB books, it suggests to open connection inside PostConstruct and close connection inside PreDestroy.
This is totally wrong decision to implement. Since Stateless Beans are pooled by container, it will open multiple connections and you never know when SSB will be destroyed. By the time it will be destroyed, you will ran out of connections.
In only one scenario it would make perfect sense to use above approach when you balance the numbers between number of pooled SSB's and the number of DB connections that can be opened.
Let me know your thoughts if you have faced same scenario.
|
SCJP 1.4, SCWCD 5, SCBCD 5, SCEA-1, Started Assignment Part 2
My blog- http://rkydesigns.blogspot.com
|
 |
Amandeep Singh
Ranch Hand
Joined: Jul 17, 2008
Posts: 820
|
|
|
Any thoughts on this? I stumbled on this issue again, so came across on my own thread.
|
 |
 |
|
|
subject: Bad decision to open connection inside PostConstruct and close connection inside PreDestroy?
|
|
|