I have network requirement who forces me to idle request sending for 2 seconds
requester = new Thread(){
@Override
public void run(){
buildRequest();
Thread.sleep(requestDelay);
} catch( InterruptedException e){
// keep idle for the remaining time still
// interrupted at 1s need to sleep 1 second more
e.printStackTrace();
}
sendRequest();
}
}
Is it possible to still sleep for remaining time with consuming CPU with a loop? If yes is the best way ?