From 52036caeacd0e48d0edb387757aa1d343753adcd Mon Sep 17 00:00:00 2001 From: borg-0300 Date: Tue, 11 Oct 2005 16:31:40 +0000 Subject: [PATCH] changed restart message git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@913 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/yacy.java | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/source/yacy.java b/source/yacy.java index a202be897..9e63f884b 100644 --- a/source/yacy.java +++ b/source/yacy.java @@ -215,9 +215,6 @@ public final class yacy { if (!(dataFolder.exists())) dataFolder.mkdir(); 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 sb.setConfig("memoryFreeAfterStartup", startupMemFree); @@ -227,6 +224,9 @@ public final class yacy { sb.setConfig("htTemplatePath", "htroot/env/templates"); 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 ... final Properties buildProp = new Properties(); File buildPropFile = null; @@ -480,17 +480,22 @@ public final class yacy { if (restart.equals("true")) { serverLog.logConfig("SHUTDOWN", "RESTART..."); long count = 0; - while (Thread.activeCount() > 1 && count <= 60) { // wait 5 minutes - serverLog.logConfig("SHUTDOWN", "Waiting 5 seconds for " + (Thread.activeCount() - 1) + "running threads to restart YaCy"); - try { Thread.currentThread().sleep(5000); } catch (InterruptedException e) {} - count++; + if (Thread.activeCount() > 1) { + serverLog.logConfig("SHUTDOWN", "Wait maximally 5 minutes for " + (Thread.activeCount() - 1) + " running threads to restart YaCy"); + while (Thread.activeCount() > 1 && count <= 60) { // wait 5 minutes + 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 startupMemTotal = Runtime.getRuntime().totalMemory(); // the total amount of memory in the Java virtual machine; may vary over time startup(homePath, startupMemFree, startupMemTotal); } 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, getAllStackTraces()\n" + Thread.getAllStackTraces()); } } else { serverLog.logConfig("SHUTDOWN", "goodbye. (this is the last line)");