programming-examples/java/XML/Shut down hooks.java
2019-11-15 12:59:38 +01:00

19 lines
474 B
Java

Shut down hooks
package com.ack.j2se.lang;
public class ShutdownHooks {
public static void main( String[] args ) {
Thread myShutdownThread = new Thread( new ShutdownProcess() );
Runtime.getRuntime().addShutdownHook( myShutdownThread );
}
}
class ShutdownProcess implements Runnable {
public void run() {
System.out.println( "System shutdown at: " +
new java.util.Date( System.currentTimeMillis() ) );
}
}