From 019cc716dbaeb99f1ddb3c86c51344b0d5cb2985 Mon Sep 17 00:00:00 2001 From: theli Date: Sat, 10 Sep 2005 17:46:17 +0000 Subject: [PATCH] *) Undoing last changes on yacySeed. Seems not to work properly. git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@697 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/yacy/yacySeed.java | 45 +++++++++++++---------------- 1 file changed, 20 insertions(+), 25 deletions(-) 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()); } /*