You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
474 B
Java
19 lines
474 B
Java
5 years ago
|
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() ) );
|
||
|
}
|
||
|
}
|