enhancement in synchronisation

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7525 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 14 years ago
parent bcea497644
commit f2e8ffd768

@ -393,16 +393,18 @@ public final class SearchEvent {
if (oldAbstract == null) { if (oldAbstract == null) {
// new abstracts in the cache // new abstracts in the cache
abstractsCache.put(wordhash, singleAbstract); abstractsCache.put(wordhash, singleAbstract);
} else synchronized (oldAbstract) { } else {
// extend the abstracts in the cache: join the single abstracts // extend the abstracts in the cache: join the single abstracts
for (final Map.Entry<String, String> oneref: singleAbstract.entrySet()) { for (final Map.Entry<String, String> oneref: singleAbstract.entrySet()) {
final String urlhash = oneref.getKey(); final String urlhash = oneref.getKey();
final String peerlistNew = oneref.getValue(); final String peerlistNew = oneref.getValue();
final String peerlistOld = oldAbstract.get(urlhash); synchronized (oldAbstract) {
if (peerlistOld == null) { final String peerlistOld = oldAbstract.get(urlhash);
oldAbstract.put(urlhash, peerlistNew); if (peerlistOld == null) {
} else { oldAbstract.put(urlhash, peerlistNew);
oldAbstract.put(urlhash, peerlistOld + peerlistNew); } else {
oldAbstract.put(urlhash, peerlistOld + peerlistNew);
}
} }
} }
// abstractsCache.put(wordhash, oldAbstract); // abstractsCache.put(wordhash, oldAbstract);

@ -443,12 +443,16 @@ public class yacySeed implements Cloneable, Comparable<yacySeed>, Comparator<yac
*/ */
public final String getPublicAddress() { public final String getPublicAddress() {
String ip = this.getIP(); String ip = this.getIP();
if (ip == null || ip.length() < 8) ip = "localhost"; if (ip == null || ip.length() < 8 || ip.length() > 60) ip = "localhost";
final String port = this.dna.get(yacySeed.PORT); final String port = this.dna.get(yacySeed.PORT);
if ((port == null) || (port.length() < 2)) return null; if (port == null || port.length() < 2 || port.length() > 5) return null;
return ip + ":" + port; StringBuilder sb = new StringBuilder(ip.length() + port.length() + 1);
sb.append(ip);
sb.append(':');
sb.append(port);
return sb.toString();
} }
/** /**

Loading…
Cancel
Save