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 @Override
public void run() { public void run() {
long delay = getDelay(TimeUnit.MILLISECONDS); while( getDelay(TimeUnit.MILLISECONDS) > 0 ) {
while( delay > 0 ) {
try { try {
wait(delay); System.out.println("Waiting for " + getDelay(TimeUnit.MILLISECONDS) + " ms");
Thread.sleep(getDelay(TimeUnit.MILLISECONDS));
//wait(getDelay(TimeUnit.MILLISECONDS));
} catch( InterruptedException e ) { } catch( InterruptedException e ) {
// Keep waiting // Keep waiting
} }
delay = getDelay(TimeUnit.MILLISECONDS);
} }
running = true; running = true;