*) adding support for delayed shutdown

- needed by Ismael to receive the Steering page properly on shutdown
   - now the steering page should always be displayed properly in the web browser

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2129 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 19 years ago
parent 97393196fa
commit 61078b3885

@ -69,7 +69,7 @@ public class Steering {
if (post.containsKey("shutdown")) {
ss.setConfig("restart", "false");
sb.terminate();
sb.terminate(3000);
prop.put("info", 3);
return prop;
}

@ -2219,6 +2219,11 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
}
}
public void terminate(long delay) {
if (delay <= 0) throw new IllegalArgumentException("The shutdown delay must be greater than 0.");
(new delayedShutdown(this,delay)).start();
}
public void terminate() {
this.terminate = true;
this.shutdownSync.V();
@ -2233,3 +2238,21 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
return this.terminate;
}
}
class delayedShutdown extends Thread {
private plasmaSwitchboard sb;
private long delay;
public delayedShutdown(plasmaSwitchboard sb, long delay) {
this.sb = sb;
this.delay = delay;
}
public void run() {
try {
Thread.sleep(delay);
} catch (InterruptedException e) {
e.printStackTrace();
}
this.sb.terminate();
}
}

Loading…
Cancel
Save