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,6 +403,7 @@ 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) {
synchronized (domain.intern()) {
DomProfile dp = (DomProfile) doms.get(domain); DomProfile dp = (DomProfile) doms.get(domain);
if (dp == null) { if (dp == null) {
// new domain // new domain
@ -412,11 +413,13 @@ public class plasmaCrawlProfile {
dp.inc(); dp.inc();
doms.put(domain, dp); 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;
synchronized (domain.intern()) {
DomProfile dp = (DomProfile) doms.get(domain); DomProfile dp = (DomProfile) doms.get(domain);
if (dp == null) { if (dp == null) {
return 0 < max; return 0 < max;
@ -424,9 +427,12 @@ public class plasmaCrawlProfile {
return dp.depth < max; 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;
synchronized (domain.intern()) {
DomProfile dp = (DomProfile) doms.get(domain); DomProfile dp = (DomProfile) doms.get(domain);
if (dp == null) { if (dp == null) {
return 0 < max; return 0 < max;
@ -434,6 +440,7 @@ public class plasmaCrawlProfile {
return dp.count < max; return dp.count < max;
} }
} }
}
public int domSize() { public int domSize() {
return doms.size(); return doms.size();
} }

@ -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