From 8bff810d1920ada442d71254f70b8b9caaa3548d Mon Sep 17 00:00:00 2001 From: karlchenofhell Date: Fri, 8 Jun 2007 12:45:03 +0000 Subject: [PATCH] - fixed logging output of serverMemory.request() - don't start up if DATA/yacy.running exists as this is usually a sign of an already started yacy-instance git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3831 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/data/SitemapParser.java | 4 ++-- source/de/anomic/server/serverMemory.java | 11 +++++++---- source/yacy.java | 13 ++++++++++--- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/source/de/anomic/data/SitemapParser.java b/source/de/anomic/data/SitemapParser.java index 4ce1cca75..487040a1e 100644 --- a/source/de/anomic/data/SitemapParser.java +++ b/source/de/anomic/data/SitemapParser.java @@ -87,8 +87,8 @@ import de.anomic.yacy.yacyCore; * A real example can be found here: http://www.xt-service.de/sitemap.xml * An example robots.txt containing a sitemap URL: http://notepad.emaillink.de/robots.txt * - * @see http://www.sitemaps.org/protocol.php - * @see https://www.google.com/webmasters/tools/docs/en/protocol.html + * @see Protocol at sitemaps.org http://www.sitemaps.org/protocol.php + * @see Protocol at google.com https://www.google.com/webmasters/tools/docs/en/protocol.html */ public class SitemapParser extends DefaultHandler { public static final String XMLNS_SITEMAPS_ORG = "http://www.sitemaps.org/schemas/sitemap/0.9"; diff --git a/source/de/anomic/server/serverMemory.java b/source/de/anomic/server/serverMemory.java index dd8f7c350..95a37e457 100644 --- a/source/de/anomic/server/serverMemory.java +++ b/source/de/anomic/server/serverMemory.java @@ -116,14 +116,17 @@ public class serverMemory { public static boolean request(long size, boolean force) { long avail = available(); if (avail >= size) return true; - long avg; - if (force || ((avg = getAverageGCFree()) == 0 || avg + avail >= size)) { + long avg = getAverageGCFree(); + if (force || avg == 0 || avg + avail >= size) { long freed = runGC(); avail = available(); - serverLog.logInfo("MEMORY", "performed explicit GC, freed " + (freed / 1024) + " KB (requested/available: " + size + " / " + avail + " KB)"); + serverLog.logInfo("MEMORY", "performed explicit GC, freed " + (freed / 1024) + + " KB (requested/available/average: " + (size / 1024) + " / " + + (avail / 1024) + "/" + (avg / 1024) + " KB)"); return avail >= size; } else { - serverLog.logInfo("MEMORY", "couldn't free enough memory (requested/available " + size + "/" + avail + " KB)"); + serverLog.logInfo("MEMORY", "former GCs indicate to not be able to free enough memory (requested/available/average: " + + (size / 1024) + "/" + (avail / 1024) + "/" + (avg / 1024) + " KB)"); return false; } } diff --git a/source/yacy.java b/source/yacy.java index 9a413fc86..880ca3e26 100644 --- a/source/yacy.java +++ b/source/yacy.java @@ -232,9 +232,6 @@ public final class yacy { System.err.println("Error creating DATA-directory in " + homePath.toString() + " . Please check your write-permission for this folder. YaCy will now terminate."); System.exit(-1); } - - f = new File(homePath, "DATA/yacy.running"); - if (!f.exists()) f.createNewFile(); f.deleteOnExit(); // setting up logging f = new File(homePath, "DATA/LOG/"); if (!(f.exists())) f.mkdirs(); @@ -253,6 +250,16 @@ public final class yacy { serverLog.logConfig("STARTUP", "Application Root Path: " + homePath); serverLog.logConfig("STARTUP", "Time Zone: UTC" + serverDate.UTCDiffString() + "; UTC+0000 is " + System.currentTimeMillis()); serverLog.logConfig("STARTUP", "Maximum file system path length: " + serverSystem.maxPathLength); + + f = new File(homePath, "DATA/yacy.running"); + if (f.exists()) { // another instance running? VM crash? User will have to care about this + serverLog.logSevere("STARTUP", "the file " + f + " exists, this usually means that another instance of YaCy is using this DATA-folder."); + serverLog.logSevere("STARTUP", "please make sure that DATA can be used exclusively by one YaCy. Quitting..."); + System.exit(-1); + } else { + f.createNewFile(); + f.deleteOnExit(); + } /* // Testing if the yacy archive file were unzipped correctly.