• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

When do I close InitialContext?

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic