Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

*) Undoing last changes on yacySeed. Seems not to work properly.

theli019cc716dbae
diff --git a/source/de/anomic/yacy/yacySeed.java b/source/de/anomic/yacy/yacySeed.java
index 9f365eafd..8469dbdd1 100644
--- a/source/de/anomic/yacy/yacySeed.java
+++ b/source/de/anomic/yacy/yacySeed.java
@@ -65,9 +65,10 @@ import java.io.FileWriter;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
-import java.util.Hashtable;
import java.util.Map;
import java.util.Properties;
+import java.util.StringTokenizer;
+
import de.anomic.net.natLib;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverCodings;
@@ -86,25 +87,20 @@ public class yacySeed {
// class variables
public String hash;
- private final Hashtable dna = new Hashtable(25);
+ private Map dna;
public int available;
public int selectscore = -1; // only for debugging
public yacySeed(String hash, Map dna) {
- // create a seed with a pre-defined hash map
- this.hash = hash;
- this.dna.putAll(dna);
+ // create a seed with a pre-defined hash map
+ this.hash = hash;
+ this.dna = dna;
this.available = 0;
}
-
- public yacySeed(String hash, Hashtable dna) {
- // create a seed with a pre-defined hash table
- this.hash = hash;
- this.dna.putAll(dna);
- this.available = 0;
- }
public yacySeed(String hash) {
+ dna = new HashMap();
+
// settings that can only be computed by originating peer:
// at first startup -
this.hash = hash; // the hash key of the peer - very important. should be static somehow, even after restart
@@ -156,7 +152,7 @@ public class yacySeed {
}
public Map getMap() {
- return (Hashtable) dna.clone();
+ return dna;
}
public String getName() {
@@ -367,17 +363,16 @@ public class yacySeed {
}
public String toString() {
- String s = null;
-
- Hashtable dnaClone = (Hashtable) dna.clone();
-
- // set hash into seed code structure
- dnaClone.put("Hash", this.hash);
-
- // generate string representation
- s = dnaClone.toString();
-
- // return string
+ String s = null;
+ synchronized (dna) {
+ // set hash into seed code structure
+ dna.put("Hash", this.hash);
+ // generate string representation
+ s = dna.toString();
+ // reconstruct original: hash is stored external
+ dna.remove("Hash");
+ // return string
+ }
return s;
}
@@ -418,7 +413,7 @@ public class yacySeed {
}
public Object clone() {
- return new yacySeed(this.hash, (Hashtable)dna.clone());
+ return new yacySeed(this.hash, (HashMap) (new HashMap(dna)).clone());
}
/*