how can I stop a thread from sleeping?

From: mimisam (michikotas_at_yahoo.com)
Date: 10/31/03


Date: 31 Oct 2003 01:04:43 -0800

hi,

I have a program(like the following codes) which needs to sleep for 20
seconds. How can i make it stop sleeping if i want it to be alive
before 20 seconds is up?(e.g. when a cancel button is clicked).
Any help will be appreciated !!
Thanks.

public static void a()
{
   delay(20000);
}

public static void delay(int d)
{
   try {
         Thread.sleep(d);
       } catch (InterruptedException e) {}
}