added some synchronisation

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1982 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent 074ef98d61
commit d58788b753

@ -421,6 +421,7 @@ public final class plasmaCrawlLURL extends plasmaURL {
// - int: # of outlinks to same domain // - int: # of outlinks to same domain
// - int: # of outlinks to outside domain // - int: # of outlinks to outside domain
// - ETag: for re-crawl decision upon HEAD request // - ETag: for re-crawl decision upon HEAD request
// - int: # of keywords
public Entry(URL url, String descr, Date moddate, Date loaddate, String referrerHash, int copyCount, boolean localNeed, int quality, String language, char doctype, int size, int wordCount) { public Entry(URL url, String descr, Date moddate, Date loaddate, String referrerHash, int copyCount, boolean localNeed, int quality, String language, char doctype, int size, int wordCount) {
// create new entry and store it into database // create new entry and store it into database

@ -403,35 +403,42 @@ public class plasmaCrawlProfile {
profileTable.set(handle(), mem); profileTable.set(handle(), mem);
} }
public void domInc(String domain, String referrer, int depth) { public void domInc(String domain, String referrer, int depth) {
DomProfile dp = (DomProfile) doms.get(domain); synchronized (domain.intern()) {
if (dp == null) { DomProfile dp = (DomProfile) doms.get(domain);
// new domain if (dp == null) {
doms.put(domain, new DomProfile(referrer, depth)); // new domain
} else { doms.put(domain, new DomProfile(referrer, depth));
// increase counter } else {
dp.inc(); // increase counter
doms.put(domain, dp); dp.inc();
doms.put(domain, dp);
}
} }
domsCache.put(this.mem.get("handle"), doms); domsCache.put(this.mem.get("handle"), doms);
} }
public boolean grantedDomAppearance(String domain) { public boolean grantedDomAppearance(String domain) {
int max = domFilterDepth(); int max = domFilterDepth();
if (max == Integer.MAX_VALUE) return true; if (max == Integer.MAX_VALUE) return true;
DomProfile dp = (DomProfile) doms.get(domain); synchronized (domain.intern()) {
if (dp == null) { DomProfile dp = (DomProfile) doms.get(domain);
return 0 < max; if (dp == null) {
} else { return 0 < max;
return dp.depth < max; } else {
return dp.depth < max;
}
} }
} }
public boolean grantedDomCount(String domain) { public boolean grantedDomCount(String domain) {
int max = domMaxPages(); int max = domMaxPages();
if (max == Integer.MAX_VALUE) return true; if (max == Integer.MAX_VALUE) return true;
DomProfile dp = (DomProfile) doms.get(domain); synchronized (domain.intern()) {
if (dp == null) { DomProfile dp = (DomProfile) doms.get(domain);
return 0 < max; if (dp == null) {
} else { return 0 < max;
return dp.count < max; } else {
return dp.count < max;
}
} }
} }
public int domSize() { public int domSize() {

@ -241,7 +241,6 @@ public final class plasmaWordIndexEntry implements Cloneable {
// more needed attributes: // more needed attributes:
// - boolean: appearance attributes: title, appears in header, anchor-descr, image-tag etc // - boolean: appearance attributes: title, appears in header, anchor-descr, image-tag etc
// - boolean: URL attributes // - boolean: URL attributes
// - int: # of keywords
if ((language == null) || (language.length() != plasmaURL.urlLanguageLength)) language = "uk"; if ((language == null) || (language.length() != plasmaURL.urlLanguageLength)) language = "uk";
this.urlHash = urlHash; this.urlHash = urlHash;

Loading…
Cancel
Save