added some synchronisation

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1982 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
orbiter 2006-03-30 15:38:46 +00:00
parent 074ef98d61
commit d58788b753
3 changed files with 26 additions and 19 deletions

View File

@ -421,6 +421,7 @@ public final class plasmaCrawlLURL extends plasmaURL {
// - int: # of outlinks to same domain
// - int: # of outlinks to outside domain
// - 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) {
// create new entry and store it into database

View File

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

View File

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