• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet

 
Tmmet Johnson
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a question.
I have a servlet.I want to load country from database and put in
application context.
My question is "Does the method called from init() to perform the above
has to synchronized " to be thread safe?

Thanks in advance,
 
Makarand Parab
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
init() is called once and only once when the servlet is loaded[ During start up or when it handles the first request - as configured]. Any method called from the init() method will be called only once. So you don't have to worry about the thread safety and sync.

Regards
Makarand Parab
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic