// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class Server {
    private static boolean started = false;
    public static void check() {
        if(!started) {
            System.out.println("startup server");
            Runtime.getRuntime().addShutdownHook(new StopServer());
            started = true;
        }
    }
}

class StopServer extends Thread {
    public void run() {
        System.out.println("shutdown server");
    }
}
