Most servers like Jetty
or Weblogic
provide some sort of mechanism to start or shutdown the server via a call (sometimes over jmx
). Can always to keep stuff running from main:
public static void main(String args[]) {
try {
Setup Spring context.....
Object lock = new Object();
synchronized (lock) {
lock.wait();
}
} catch (Exception e) {
e.printStackTrace();
}
}
And do a kill on the process PID. But thought there might a nice open-source solution hanging around in cyber space that adds JMX
bells and whistles.