changed restart message

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@913 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
borg-0300 20 years ago
parent b80b2fbdcc
commit 52036caeac

@ -215,9 +215,6 @@ public final class yacy {
if (!(dataFolder.exists())) dataFolder.mkdir(); if (!(dataFolder.exists())) dataFolder.mkdir();
final plasmaSwitchboard sb = new plasmaSwitchboard(homePath, "yacy.init", "DATA/SETTINGS/httpProxy.conf"); final plasmaSwitchboard sb = new plasmaSwitchboard(homePath, "yacy.init", "DATA/SETTINGS/httpProxy.conf");
// set default = no restart
sb.setConfig("restart", "false");
// save information about available memory at startup time // save information about available memory at startup time
sb.setConfig("memoryFreeAfterStartup", startupMemFree); sb.setConfig("memoryFreeAfterStartup", startupMemFree);
@ -227,6 +224,9 @@ public final class yacy {
sb.setConfig("htTemplatePath", "htroot/env/templates"); sb.setConfig("htTemplatePath", "htroot/env/templates");
sb.setConfig("parseableExt", "html,htm,txt,php,shtml,asp"); sb.setConfig("parseableExt", "html,htm,txt,php,shtml,asp");
// set default = no restart
sb.setConfig("restart", "false");
// if we are running an SVN version, we try to detect the used svn revision now ... // if we are running an SVN version, we try to detect the used svn revision now ...
final Properties buildProp = new Properties(); final Properties buildProp = new Properties();
File buildPropFile = null; File buildPropFile = null;
@ -480,17 +480,22 @@ public final class yacy {
if (restart.equals("true")) { if (restart.equals("true")) {
serverLog.logConfig("SHUTDOWN", "RESTART..."); serverLog.logConfig("SHUTDOWN", "RESTART...");
long count = 0; long count = 0;
while (Thread.activeCount() > 1 && count <= 60) { // wait 5 minutes if (Thread.activeCount() > 1) {
serverLog.logConfig("SHUTDOWN", "Waiting 5 seconds for " + (Thread.activeCount() - 1) + "running threads to restart YaCy"); serverLog.logConfig("SHUTDOWN", "Wait maximally 5 minutes for " + (Thread.activeCount() - 1) + " running threads to restart YaCy");
try { Thread.currentThread().sleep(5000); } catch (InterruptedException e) {} while (Thread.activeCount() > 1 && count <= 60) { // wait 5 minutes
count++; count++;
try { Thread.currentThread().sleep(5000); } catch (InterruptedException e) {}
}
} }
if (count < 60) { if (count < 60) {
System.gc();
try { Thread.currentThread().sleep(5000); } catch (InterruptedException e) {}
startupMemFree = Runtime.getRuntime().freeMemory(); // the amount of free memory in the Java Virtual Machine startupMemFree = Runtime.getRuntime().freeMemory(); // the amount of free memory in the Java Virtual Machine
startupMemTotal = Runtime.getRuntime().totalMemory(); // the total amount of memory in the Java virtual machine; may vary over time startupMemTotal = Runtime.getRuntime().totalMemory(); // the total amount of memory in the Java virtual machine; may vary over time
startup(homePath, startupMemFree, startupMemTotal); startup(homePath, startupMemFree, startupMemTotal);
} else { } else {
serverLog.logConfig("SHUTDOWN", "RESTART BREAK, more than 5 minutes waited to try a restart, goodbye. (this is the last line)"); serverLog.logConfig("SHUTDOWN", "RESTART BREAK, more than 5 minutes waited to try a restart, goodbye. (this is the last line)");
serverLog.logConfig("SHUTDOWN", "RESTART BREAK, getAllStackTraces()\n" + Thread.getAllStackTraces());
} }
} else { } else {
serverLog.logConfig("SHUTDOWN", "goodbye. (this is the last line)"); serverLog.logConfig("SHUTDOWN", "goodbye. (this is the last line)");

Loading…
Cancel
Save