Index: NEWS =================================================================== RCS file: /cvsroot/classpath/classpath/NEWS,v retrieving revision 1.59 diff -u -r1.59 NEWS --- NEWS 27 Dec 2004 11:39:28 -0000 1.59 +++ NEWS 28 Dec 2004 10:24:19 -0000 @@ -1,5 +1,7 @@ Runtime interface changes: +* Added a new method (VMRuntime.enableShutdownHooks) that enables the VM + to lazily register an exit handler. * The java.lang.Class constructor now automatically sets the protection domain for array classes, based on the protection domain of the component type class. Index: java/lang/Runtime.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/lang/Runtime.java,v retrieving revision 1.12 diff -u -r1.12 Runtime.java --- java/lang/Runtime.java 6 Dec 2004 20:43:13 -0000 1.12 +++ java/lang/Runtime.java 28 Dec 2004 10:24:27 -0000 @@ -299,7 +299,10 @@ if (exitSequence != null) throw new IllegalStateException("The Virtual Machine is exiting. It is not possible anymore to add any hooks"); if (shutdownHooks == null) - shutdownHooks = new HashSet(); // Lazy initialization. + { + VMRuntime.enableShutdownHooks(); + shutdownHooks = new HashSet(); // Lazy initialization. + } if (! shutdownHooks.add(hook)) throw new IllegalArgumentException(hook.toString() + " had already been inserted"); } Index: vm/reference/java/lang/VMRuntime.java =================================================================== RCS file: /cvsroot/classpath/classpath/vm/reference/java/lang/VMRuntime.java,v retrieving revision 1.6 diff -u -r1.6 VMRuntime.java --- vm/reference/java/lang/VMRuntime.java 6 Dec 2004 20:43:13 -0000 1.6 +++ vm/reference/java/lang/VMRuntime.java 28 Dec 2004 10:24:32 -0000 @@ -180,4 +180,13 @@ throws IOException { return VMProcess.exec(cmd, env, dir); } + + /** + * This method is called by Runtime.addShutdownHook() when it is + * called for the first time. It enables the VM to lazily setup + * an exit handler, should it so desire. + */ + static void enableShutdownHooks() + { + } } // class VMRuntime