How to kill the main thread, from another thread (in Java) by RESTful web services call?
<p>Say, I have a Java application running, and I have provided RESTful web services call (via Java Jersey). First, am I right that every invocation of a HTTP RESTful request (or servlet request) runs on a different thread from the main thread? And if so, if I provide a RESTful call to kill the app, how can it reach the main thread (the one started by the main() method) to kill it and subsequently stop the program?</p>

<p>Note: the reason I'm asking this is I need to do a graceful shutdown of the main thread (and the program).</p>
