From e9d87b2fcead69ccb92f2695c582e227ecb16794 Mon Sep 17 00:00:00 2001 From: theli Date: Sun, 29 Apr 2007 15:56:45 +0000 Subject: [PATCH] *) changes required for the uploader git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3621 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/yacy.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/source/yacy.java b/source/yacy.java index 57ffa2dca..2c7d00baf 100644 --- a/source/yacy.java +++ b/source/yacy.java @@ -139,6 +139,8 @@ public final class yacy { private static final String copyright = "[ YaCy v" + vString + ", build " + vDATE + " by Michael Christen / www.yacy.net ]"; private static final String hline = "-------------------------------------------------------------------------------"; + static plasmaSwitchboard sb = null; + /** * Converts combined version-string to a pretty string, e.g. "0.435/01818" or "dev/01818" (development version) or "dev/00000" (in case of wrong input) * @@ -253,7 +255,7 @@ public final class yacy { } */ - final plasmaSwitchboard sb = new plasmaSwitchboard(homePath, "yacy.init", "DATA/SETTINGS/httpProxy.conf"); + sb = new plasmaSwitchboard(homePath, "yacy.init", "DATA/SETTINGS/httpProxy.conf"); // save information about available memory at startup time sb.setConfig("memoryFreeAfterStartup", startupMemFree); @@ -506,10 +508,15 @@ public final class yacy { return config; } - - static void shutdown() { - String applicationRoot = System.getProperty("user.dir").replace('\\', '/'); - shutdown(applicationRoot); + + public static void shutdown() { + if (sb != null) { + // YaCy is running in the same runtime. we can shutdown via interrupt + sb.terminate(); + } else { + String applicationRoot = System.getProperty("user.dir").replace('\\', '/'); + shutdown(applicationRoot); + } } /**