• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

System.exit() in Servlets

 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
what will System.exit() do in the servlet code?
on java developer connection i found the following sentence...
" It could even perform a System.exit(), stopping the web server... "
here is the URL
any ideas?
though i don see much utility of using System.exit() in the servlets.
regards
maulin.
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The article is discussing security of the server. You should never can System.exit() from a servlet. The point the article is making, if as a System admin, you don't apply some security constraints on servlets, someone could put one up that does call System.exit() and bring your entire webserver down.
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi carl,
so, if i use System.exit() in one servlet will it crash all the other servlet as well? i think if we write System.exit() in a program then it finishes the currently running program.
in servlet case many thread of the same servlet can b running when i call exit(). so may b it can shutdown one whole servlet (shutting down each servlet thread for the same servlet) but how other servlets can b affected? (may b some servlets r using another etc etc but what i mean here is the other servlets which r in noway related to the one calling exit()).
regards
maulin.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic