public class Bogus {
public static void main (String[] args) {
Thread t = new Thread(
new Runnable() {
public void run() {
try {
Thread.sleep(5000); // 5 seconds
} catch (InterruptedException ie) {
System.out.println("Interrupted, exiting");
// perform whatever cleanup is needed
}
}
});
t.start();
try { Thread.sleep(1000); } catch (InterruptedException ie) {}
t.interrupt();
}
}