Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
!Important: move from Hashtable to HashMap
Marek Otahal72adbeae9012
diff --git a/source/de/anomic/data/Translator.java b/source/de/anomic/data/Translator.javaindex 15c16052d..17a4cb68e 100644--- a/source/de/anomic/data/Translator.java+++ b/source/de/anomic/data/Translator.java@@ -80,7 +80,7 @@ public class Translator {/*** Load multiple translationLists from one File. Each List starts with #File: relative/path/to/file* @param translationFile the File, which contains the Lists- * @return a Hashtable, which contains for each File a Hashtable with translations.+ * @return a HashMap, which contains for each File a HashMap with translations.*/public static Map<String, Map<String, String>> loadTranslationsLists(final File translationFile){final Map<String, Map<String, String>> lists = new HashMap<String, Map<String, String>>(); //list of translationLists for different files.diff --git a/source/de/anomic/http/server/TemplateEngine.java b/source/de/anomic/http/server/TemplateEngine.javaindex 499ed5e0a..a047689f7 100644--- a/source/de/anomic/http/server/TemplateEngine.java+++ b/source/de/anomic/http/server/TemplateEngine.java@@ -87,10 +87,10 @@ import net.yacy.kelondro.util.FileUtils;* </body></html>* </pre>* <p>- * The corresponding Hashtable to use this Template:<br>+ * The corresponding HashMap to use this Template:<br>* <b>Java Example</b><br>* <pre>- * Hashtable pattern;+ * HashMap pattern;* pattern.put("times", 10); //10 greetings* for(int i=0;i<=9;i++){* pattern.put("times_"+i+"_daytime", 1); //index: 1, second Entry, evening@@ -112,7 +112,7 @@ import net.yacy.kelondro.util.FileUtils;* <li>Multi templates: multitemplatename_index_</li>* <li>Alterantives: alternativename_</li>* </ul>- * So the Names in the Hashtable are:+ * So the Names in the HashMap are:* <ul>* <li>Multi templates: multitemplatename_index_templatename</li>* <li>Alterantives: alternativename_templatename</li>diff --git a/source/de/anomic/server/serverObjects.java b/source/de/anomic/server/serverObjects.javaindex 579ac5c52..46d25502f 100644--- a/source/de/anomic/server/serverObjects.java+++ b/source/de/anomic/server/serverObjects.java@@ -33,6 +33,7 @@Properties - setProperty would be needed, but only available in 1.2HashMap, TreeMap - only in 1.2Hashtable - available in 1.0, but 'put' does not accept null values+//FIXME: it's 2012, do we still need support for Java 1.0?!So this class was created as a convenience.It will also contain special methods that read data from internet-resourcesdiff --git a/source/de/anomic/tools/loaderThreads.java b/source/de/anomic/tools/loaderThreads.javaindex 7a061b4e2..176525bda 100644--- a/source/de/anomic/tools/loaderThreads.java+++ b/source/de/anomic/tools/loaderThreads.java@@ -24,7 +24,9 @@package de.anomic.tools;-import java.util.Hashtable;+import java.util.Collection;+import java.util.HashMap;+import java.util.Map;import net.yacy.cora.protocol.ClientIdentification;import net.yacy.cora.protocol.http.ProxySettings;@@ -39,8 +41,8 @@ public class loaderThreads {protected ProxySettings remoteProxyConfig;// management objects for collection of threads- Hashtable<String, Thread> threads;- int completed, failed;+ private Map<String, Thread> threads;+ private int completed, failed;public loaderThreads() {this(10000, null, null);@@ -54,7 +56,7 @@ public class loaderThreads {this.timeout = timeout;this.user = user;this.password = password;- this.threads = new Hashtable<String, Thread>();+ this.threads = new HashMap<String, Thread>();this.completed = 0;this.failed = 0;}diff --git a/source/net/yacy/document/importer/OAIPMHImporter.java b/source/net/yacy/document/importer/OAIPMHImporter.javaindex a97c0b06a..8985f6686 100644--- a/source/net/yacy/document/importer/OAIPMHImporter.java+++ b/source/net/yacy/document/importer/OAIPMHImporter.java@@ -118,6 +118,7 @@ public class OAIPMHImporter extends Thread implements Importer, Comparable<OAIPMreturn (int) (1000L * ((long) count()) / runningTime());}+ @Overridepublic void run() {while (runningJobs.size() > 50) {try {Thread.sleep(10000 + 3000 * (System.currentTimeMillis() % 6));} catch (InterruptedException e) {}diff --git a/source/net/yacy/kelondro/util/ByteArray.java b/source/net/yacy/kelondro/util/ByteArray.javaindex eb4810818..0ac0b633a 100644--- a/source/net/yacy/kelondro/util/ByteArray.java+++ b/source/net/yacy/kelondro/util/ByteArray.java@@ -37,6 +37,8 @@ import net.yacy.cora.order.ByteOrder;* a byte[] in a Hashtable does not work because the hash computation does not* work for byte[]. This class extends byte[] with a cached hashing function,* so it can be used in hashtables.+ * //FIXME: so does storing byte[] in HashMap help? as I'm moving use of Hashtable to+ * //FIXME: HashMap, if so, please remove this class- or notify me*/public class ByteArray {diff --git a/source/net/yacy/kelondro/util/OS.java b/source/net/yacy/kelondro/util/OS.javaindex 6c38396f8..72378dc91 100644--- a/source/net/yacy/kelondro/util/OS.java+++ b/source/net/yacy/kelondro/util/OS.java@@ -27,7 +27,6 @@ import java.io.IOException;import java.io.InputStreamReader;import java.lang.management.ManagementFactory;import java.util.ArrayList;-import java.util.Hashtable;import java.util.List;import java.util.Properties;import java.util.Vector;@@ -35,6 +34,7 @@ import java.util.Vector;import net.yacy.cora.document.UTF8;import net.yacy.kelondro.logging.Log;import de.anomic.server.serverCore;+import java.util.*;public final class OS {@@ -63,8 +63,8 @@ public final class OS {public static int maxPathLength = 65535;// Macintosh-specific statics- public static final Hashtable<String, String> macFSTypeCache = new Hashtable<String, String>();- public static final Hashtable<String, String> macFSCreatorCache = new Hashtable<String, String>();+ public static final Map<String, String> macFSTypeCache = new HashMap<String, String>();+ public static final Map<String, String> macFSCreatorCache = new HashMap<String, String>();// static initializationstatic {diff --git a/source/net/yacy/peers/SeedDB.java b/source/net/yacy/peers/SeedDB.javaindex cb631d1f2..f5a11642d 100644--- a/source/net/yacy/peers/SeedDB.java+++ b/source/net/yacy/peers/SeedDB.java@@ -33,7 +33,7 @@ import java.lang.ref.SoftReference;import java.net.InetAddress;import java.util.ArrayList;import java.util.HashSet;-import java.util.Hashtable;+import java.util.HashMap;import java.util.Iterator;import java.util.Map;import java.util.Set;@@ -98,8 +98,8 @@ public final class SeedDB implements AlternativeDomainNames {private Seed mySeed; // my own seedprivate final Set<String> myBotIDs; // list of id's that this bot accepts as robots.txt identification- private final Hashtable<String, String> nameLookupCache; // a name-to-hash relation- private final Hashtable<InetAddress, SoftReference<Seed>> ipLookupCache;+ private final Map<String, String> nameLookupCache; // a name-to-hash relation+ private final Map<InetAddress, SoftReference<Seed>> ipLookupCache;public SeedDB(final File networkRoot,@@ -129,10 +129,10 @@ public final class SeedDB implements AlternativeDomainNames {this.seedPotentialDB = openSeedTable(this.seedPotentialDBFile);// start our virtual DNS service for yacy peers with empty cache- this.nameLookupCache = new Hashtable<String, String>();+ this.nameLookupCache = new HashMap<String, String>();// cache for reverse name lookup- this.ipLookupCache = new Hashtable<InetAddress, SoftReference<Seed>>();+ this.ipLookupCache = new HashMap<InetAddress, SoftReference<Seed>>();// check if we are in the seedCaches: this can happen if someone else published our seedremoveMySeed();diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.javaindex cd72ffb02..16c75c348 100644--- a/source/net/yacy/search/Switchboard.java+++ b/source/net/yacy/search/Switchboard.java@@ -56,7 +56,6 @@ import java.security.spec.InvalidKeySpecException;import java.util.ArrayList;import java.util.Date;import java.util.HashMap;-import java.util.Hashtable;import java.util.Iterator;import java.util.List;import java.util.Map;@@ -260,7 +259,7 @@ public final class Switchboard extends serverSwitch//private Object crawlingPausedSync = new Object();//private boolean crawlingIsPaused = false;- public Hashtable<String, Object[]> crawlJobsStatus = new Hashtable<String, Object[]>();+ public HashMap<String, Object[]> crawlJobsStatus = new HashMap<String, Object[]>();private static Switchboard sb = null;