- 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
pull/1/head
karlchenofhell 18 years ago
parent 21cde5a024
commit 8bff810d19

@ -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 <a href="http://www.sitemaps.org/protocol.php">http://www.sitemaps.org/protocol.php</a>
* @see Protocol at google.com <a href="https://www.google.com/webmasters/tools/docs/en/protocol.html">https://www.google.com/webmasters/tools/docs/en/protocol.html</a>
*/
public class SitemapParser extends DefaultHandler {
public static final String XMLNS_SITEMAPS_ORG = "http://www.sitemaps.org/schemas/sitemap/0.9";

@ -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;
}
}

@ -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.

Loading…
Cancel
Save