• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

How Tomcat stops its own server?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I'm just wondering how Tomcat stop its own service.
How can "java Bootstrap stop" as in shutdown.bat/sh contacting the server to shutdown that already started by "java Bootstrap start" and exits? (I think the server is running in different JVM than the "Bootstrap stop")
Is there any special trick that I don't know about? Is it something to do with thread.setDaemon(true)?
Thank you in advance.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would imagine that after running the destroy methods of all running servlets and closing down the session maintenance mechanism, it simply calls System.exit(0) - that will do it every time.
You could search the source code for "System.exit" ...
Bill
 
author and iconoclast
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look at the Tomcat server config file, you'll find that there's a special port dedicated to listening for shutdown commands. The Bootstrap class presumably connects to this port to shut the server down.
 
I don't even know how to spell CIA. But this tiny ad does:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic