code cleanup

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1163 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 20 years ago
parent 972b8ddd2a
commit 7920e1547d

@ -1,2 +0,0 @@
#{list}##[key]#=#[value]#
#{/list}#

@ -77,7 +77,7 @@ public final class search {
// final String fwden = (String) post.get("fwden", ""); // forward deny, a list of seed hashes. They may NOT be target of forward hopping
final long duetime= Long.parseLong((String) post.get("duetime", "3000"));
final int count = Integer.parseInt((String) post.get("count", "10")); // maximum number of wanted results
final boolean global = ((String) post.get("resource", "global")).equals("global"); // if true, then result may consist of answers from other peers
// final boolean global = ((String) post.get("resource", "global")).equals("global"); // if true, then result may consist of answers from other peers
// Date remoteTime = yacyCore.parseUniversalDate((String) post.get(yacySeed.MYTIME)); // read remote time
if (yacyCore.seedDB == null) {
yacyCore.log.logSevere("yacy.search: seed cache not initialized");

@ -65,11 +65,11 @@ public final class transfer {
String process = (String) post.get("process", ""); // permission or store
String key = (String) post.get("key", ""); // a transmission key from the client
//String key = (String) post.get("key", ""); // a transmission key from the client
String otherpeer = (String) post.get("iam", ""); // identification of the client (a peer-hash)
String purpose = (String) post.get("purpose", ""); // declares how the file shall be treated
String filename = (String) post.get("filename", ""); // a name of a file without path
long filesize = Long.parseLong((String) post.get("filesize", "")); // the size of the file
//long filesize = Long.parseLong((String) post.get("filesize", "")); // the size of the file
yacySeed otherseed = yacyCore.seedDB.get(otherpeer);
if (otherseed == null) {
@ -93,7 +93,7 @@ public final class transfer {
if (purpose.equals("crcon")) {
// consolidation of cr files
//System.out.println("yacy/transfer:post=" + post.toString());
String cansendprotocol = (String) post.get("can-send-protocol", "http");
//String cansendprotocol = (String) post.get("can-send-protocol", "http");
String access = serverCodings.encodeMD5B64(otherpeer + ":" + filename, true) + ":" + serverCodings.encodeMD5B64("" + System.currentTimeMillis(), true);
prop.put("response", "ok");
prop.put("process_access", access);

@ -353,19 +353,19 @@ public final class robotsParser{
public static void main(String[] args) {
try {
robotsParser parser = new robotsParser();
//robotsParser parser = new robotsParser();
URL robotsURL = new URL("http://www.bigfoot2002.de.vu/robots.txt");
Object[] result = parser.downloadRobotsTxt(robotsURL,5,null);
Object[] result = downloadRobotsTxt(robotsURL,5,null);
if (result != null) {
boolean accessCompletelyRestricted = ((Boolean)result[0]).booleanValue();
byte[] robotsTxt = (byte[])result[1];
String eTag = (String) result[2];
Date modDate = (Date) result[3];
//String eTag = (String) result[2];
//Date modDate = (Date) result[3];
if (!accessCompletelyRestricted) {
ArrayList denyPath = robotsParser.parse(robotsTxt);
/*ArrayList denyPath =*/ robotsParser.parse(robotsTxt);
}
}

@ -80,8 +80,7 @@ public class translator {
public static Hashtable loadTranslationsLists(File translationFile){
Hashtable lists = new Hashtable(); //list of translationLists for different files.
Hashtable translationList = new Hashtable(); //current Translation Table
FileInputStream fileIn = null;
ArrayList list = listManager.getListArray(translationFile);
Iterator it = list.iterator();
String line = "";

@ -350,7 +350,7 @@ public final class httpHeader extends TreeMap implements Map {
Server=Apache/1.3.26
*/
private static SimpleDateFormat HTTPGMTFormatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'");
//private static SimpleDateFormat HTTPGMTFormatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'");
private static SimpleDateFormat EMLFormatter = new SimpleDateFormat("dd MMM yyyy HH:mm:ss", Locale.US);
public static Date parseHTTPDate(String s) {
@ -687,7 +687,7 @@ public final class httpHeader extends TreeMap implements Map {
String host = conProp.getProperty(httpHeader.CONNECTION_PROP_HOST);
String path = conProp.getProperty(httpHeader.CONNECTION_PROP_PATH); // always starts with leading '/'
String args = conProp.getProperty(httpHeader.CONNECTION_PROP_ARGS); // may be null if no args were given
String ip = conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP); // the ip from the connecting peer
//String ip = conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP); // the ip from the connecting peer
int port, pos;
if ((pos = host.indexOf(":")) < 0) {

@ -120,7 +120,7 @@ public final class httpTemplate {
private static final byte lbr = (byte)'[';
private static final byte rbr = (byte)']';
private static final byte[] pOpen = {hash, lbr};
//private static final byte[] pOpen = {hash, lbr};
private static final byte[] pClose = {rbr, hash};
private static final byte lcbr = (byte)'{';
@ -130,11 +130,11 @@ public final class httpTemplate {
private static final byte lrbr = (byte)'(';
private static final byte rrbr = (byte)')';
private static final byte[] aOpen = {hash, lrbr};
//private static final byte[] aOpen = {hash, lrbr};
private static final byte[] aClose = {rrbr, hash};
private static final byte ps = (byte)'%';
private static final byte[] iOpen = {hash, ps};
//private static final byte[] iOpen = {hash, ps};
private static final byte[] iClose = {ps, hash};
/**
@ -142,7 +142,6 @@ public final class httpTemplate {
* the function returns true, if the pattern is found
*/
private static boolean transferUntil(PushbackInputStream i, OutputStream o, byte[] pattern) throws IOException {
int ppos = 0;
int b, bb;
boolean equal;
while ((b = i.read()) > 0) {
@ -176,8 +175,7 @@ public final class httpTemplate {
PushbackInputStream pis = new PushbackInputStream(in, 100);
ByteArrayOutputStream keyStream;
String key;
String multi_key;
boolean consistent;
String multi_key;
byte[] replacement;
int bb;
@ -436,7 +434,6 @@ public final class httpTemplate {
if (!(path.isDirectory())) path = path.getParentFile();
if ((path == null) || (!(path.isDirectory()))) return result;
String[] templates = path.list();
int c;
for (int i = 0; i < templates.length; i++) {
if (templates[i].endsWith(".template"))
try {

@ -57,7 +57,9 @@ import de.anomic.server.serverCore;
public class icapHeader extends TreeMap implements Map {
/* =============================================================
private static final long serialVersionUID = 1L;
/* =============================================================
* Constants defining icap methods
* ============================================================= */
public static final String METHOD_REQMOD = "REQMOD";
@ -184,7 +186,7 @@ public class icapHeader extends TreeMap implements Map {
// write header
Iterator i = keySet().iterator();
String key, value;
String key;
char tag;
int count;
while (i.hasNext()) {

@ -44,7 +44,6 @@
package de.anomic.icap;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
@ -154,7 +153,6 @@ public class icapd implements serverHandler {
public Boolean OPTIONS(String arg) throws IOException {
BufferedInputStream in = new BufferedInputStream(this.session.in);
BufferedOutputStream out = new BufferedOutputStream(this.session.out);
// parsing the http request line
@ -243,6 +241,7 @@ public class icapd implements serverHandler {
return this.prop.getProperty(icapHeader.CONNECTION_PROP_PERSISTENT).equals("keep-alive") ? serverCore.RESUME_CONNECTION : serverCore.TERMINATE_CONNECTION;
}
/*
private void blacklistService(icapHeader reqHeader, InputStream in, OutputStream out) {
try {
@ -250,6 +249,7 @@ public class icapd implements serverHandler {
e.printStackTrace();
}
}
*/
private void indexingService(icapHeader reqHeader, InputStream in, OutputStream out) {
try {

@ -128,8 +128,7 @@ abstract class kelondroAbstractRA implements kelondroRA {
private static final byte cr = 13;
private static final byte lf = 10;
private static final String crlf = new String(new byte[] {cr, lf});
public void writeLine(final String line) throws IOException {
this.write(line.getBytes());
this.write(cr);

@ -103,6 +103,7 @@ public class kelondroDyn extends kelondroTree {
}
}
/*
private void readSegmentCount() {
try {
segmentCount = (int) serverCodings.enhancedCoder.decodeBase64Long(new String(getText(0)));
@ -111,6 +112,7 @@ public class kelondroDyn extends kelondroTree {
writeSegmentCount();
}
}
*/
public synchronized int sizeDyn() {
//this.segmentCount = 0;

@ -59,15 +59,15 @@ public class kelondroDynTree {
private File file;
// some properties to control caching and buffering
private int maxcountCache = 1000, maxsizeCache = 100;
//private int maxcountCache = 1000, maxsizeCache = 100;
private int maxcountBuffer = 1000, maxsizeBuffer = 100;
private long maxageCache = 60000, cycletimeCache = 10000;
//private long maxageCache = 60000, cycletimeCache = 10000;
private long maxageBuffer = 60000, cycletimeBuffer = 10000;
private long buffersize = 0;
// data structures for the cache and buffer
private Hashtable buffer, cache;
private long cycleCache, cycleBuffer;
private long cycleBuffer;
public kelondroDynTree(File file, long buffersize, int keylength, int nodesize, int[] columns) throws IOException {
// creates a new DynTree
@ -75,7 +75,7 @@ public class kelondroDynTree {
this.columns = columns;
this.buffer = new Hashtable();
this.cache = new Hashtable();
this.cycleCache = Long.MIN_VALUE;
//this.cycleCache = Long.MIN_VALUE;
this.cycleBuffer = Long.MIN_VALUE;
if (file.exists()) throw new IOException("DynTree " + file.toString() + " already exists");
this.table = new kelondroDyn(file, buffersize, keylength, nodesize);
@ -87,7 +87,7 @@ public class kelondroDynTree {
this.file = file;
this.buffer = new Hashtable();
this.cache = new Hashtable();
this.cycleCache = Long.MIN_VALUE;
//this.cycleCache = Long.MIN_VALUE;
this.cycleBuffer = Long.MIN_VALUE;
if (!(file.exists())) throw new IOException("DynTree " + file.toString() + " does not exist");
this.table = new kelondroDyn(file, buffersize);
@ -110,13 +110,14 @@ public class kelondroDynTree {
if (size == 0) this.file.delete();
}
/*
public void setReadCacheAttr(int maxcount, int maxsize, long maxage, long cycletime) {
maxcountCache = maxcount;
maxsizeCache = maxsize;
maxageCache = maxage;
cycletimeCache = cycletime;
}
*/
public void setWriteBufferAttr(int maxcount, int maxsize, long maxage, long cycletime) {
maxcountBuffer = maxcount;
@ -252,7 +253,7 @@ public class kelondroDynTree {
return tc.get(key);
}
/*
// clean-up method for cache:
private void flushCache() {
if ((System.currentTimeMillis() - this.cycleCache < this.cycletimeCache) &&
@ -272,6 +273,7 @@ public class kelondroDynTree {
}
}
}
*/
// write buffered
public synchronized void put(String tablename, byte[][] newrow) {

@ -44,7 +44,9 @@ package de.anomic.kelondro;
public class kelondroException extends java.lang.RuntimeException {
public kelondroException() {
private static final long serialVersionUID = 1L;
public kelondroException() {
super("unspecific-error");
}

@ -182,7 +182,7 @@ public final class yacy {
// check java version
try {
String[] check = "a,b".split(","); // split needs java 1.4
/*String[] check =*/ "a,b".split(","); // split needs java 1.4
} catch (NoSuchMethodError e) {
System.err.println("STARTUP: Java Version too low. You need at least Java 1.4.2 to run YACY");
Thread.sleep(3000);
@ -275,7 +275,7 @@ public final class yacy {
// create some directories
final File htRootPath = new File(homePath, sb.getConfig("htRootPath", "htroot"));
final File htDocsPath = new File(homePath, sb.getConfig("htDocsPath", "DATA/HTDOCS"));
File htTemplatePath = new File(homePath, sb.getConfig("htTemplatePath","htdocs"));
//final File htTemplatePath = new File(homePath, sb.getConfig("htTemplatePath","htdocs"));
// create default notifier picture
if (!((new File(htRootPath, "env/grafics/notifier.gif")).exists())) try {
@ -430,7 +430,7 @@ public final class yacy {
// idle until the processes are down
while (server.isAlive()) {
Thread.currentThread().sleep(2000); // wait a while
Thread.sleep(2000); // wait a while
}
serverLog.logConfig("SHUTDOWN", "server has terminated");
sb.close();
@ -451,12 +451,12 @@ public final class yacy {
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) {}
try { Thread.sleep(5000); } catch (InterruptedException e) {}
}
}
if (count < 60) {
System.gc();
try { Thread.currentThread().sleep(5000); } catch (InterruptedException e) {}
try { Thread.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);
@ -861,7 +861,7 @@ public final class yacy {
if ((currentUrlDB.exists(urlHash)) && (!minimizedUrlDB.exists(urlHash))) {
urlCounter++;
plasmaCrawlLURL.Entry urlEntry = currentUrlDB.getEntry(urlHash);
plasmaCrawlLURL.Entry newEntry = minimizedUrlDB.newEntry(urlEntry);
/*plasmaCrawlLURL.Entry newEntry =*/ minimizedUrlDB.newEntry(urlEntry);
if (urlCounter % 500 == 0) {
log.logInfo(urlCounter + " URLs found so far.");
}
@ -1062,7 +1062,6 @@ public final class yacy {
Iterator eiter = pool.loadedURL.entries(true, false);
HashSet doms = new HashSet();
plasmaCrawlLURL.Entry entry;
URL url;
while (eiter.hasNext()) {
entry = (plasmaCrawlLURL.Entry) eiter.next();
if ((entry != null) && (entry.url() != null)) doms.add(entry.url().getHost());

Loading…
Cancel
Save