DelayedTask wartet selbstständig

This commit is contained in:
ngb
2022-07-08 07:52:35 +02:00
parent ced0aa6842
commit a8bbce72a2

View File

@@ -46,14 +46,14 @@ public abstract class DelayedTask extends Task implements Delayed {
@Override
public void run() {
long delay = getDelay(TimeUnit.MILLISECONDS);
while( delay > 0 ) {
while( getDelay(TimeUnit.MILLISECONDS) > 0 ) {
try {
wait(delay);
System.out.println("Waiting for " + getDelay(TimeUnit.MILLISECONDS) + " ms");
Thread.sleep(getDelay(TimeUnit.MILLISECONDS));
//wait(getDelay(TimeUnit.MILLISECONDS));
} catch( InterruptedException e ) {
// Keep waiting
}
delay = getDelay(TimeUnit.MILLISECONDS);
}
running = true;