• Post Reply Bookmark Topic Watch Topic
  • New Topic

When do I close InitialContext?

 
Jason Stortz
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OS: Win XP
App Server: JBoss 3.0
J2SE: 1.3.1_03
I am confused as to when I close my InitialContext? I see a lot of examples where people open the context in the init method. Does this mean I close it in the destroy method of my servlet?
I once read an example that said to open, get your bean, do your work and then close it right away.
In JBoss, with Clustering enables, if I open, do my work and close right away the load balancing seems not to work as all requests always go to one machine. However, if I open the context in the init method everything seems to go fine (note: I have not closed it even in the destroy method at this point).
Can anyone guide this confused soul? Thanks!
Jason
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!