Interupts can be kept pending till the first Sleep call . A thread can continue to execute even if it is interrupted and throws an InterupttedException on the call of sleep method :
Have a look at a sample code:
Public class TestInteruppt{
public static void main(String args[]){
Thread.currentThread.interrupt();
try{
Thread.sleep(30);
}catch(InterruptedException E){
System.out.println(" This is a Pending Interupt");
}
}
}
Have a look at a sample code:
Public class TestInteruppt{
public static void main(String args[]){
Thread.currentThread.interrupt();
try{
Thread.sleep(30);
}catch(InterruptedException E){
System.out.println(" This is a Pending Interupt");
}
}
}
No comments:
Post a Comment