remove synchronize in Page #411

master
yihua.huang 2017-02-25 19:42:12 +08:00
parent 3a796b9413
commit ad69963005
1 changed files with 13 additions and 21 deletions

View File

@ -107,7 +107,6 @@ public class Page {
* @param requests requests
*/
public void addTargetRequests(List<String> requests) {
synchronized (targetRequests) {
for (String s : requests) {
if (StringUtils.isBlank(s) || s.equals("#") || s.startsWith("javascript:")) {
continue;
@ -116,7 +115,6 @@ public class Page {
targetRequests.add(new Request(s));
}
}
}
/**
* add urls to fetch
@ -125,7 +123,6 @@ public class Page {
* @param priority priority
*/
public void addTargetRequests(List<String> requests, long priority) {
synchronized (targetRequests) {
for (String s : requests) {
if (StringUtils.isBlank(s) || s.equals("#") || s.startsWith("javascript:")) {
continue;
@ -134,7 +131,6 @@ public class Page {
targetRequests.add(new Request(s).setPriority(priority));
}
}
}
/**
* add url to fetch
@ -145,11 +141,9 @@ public class Page {
if (StringUtils.isBlank(requestString) || requestString.equals("#")) {
return;
}
synchronized (targetRequests) {
requestString = UrlUtils.canonicalizeUrl(requestString, url.toString());
targetRequests.add(new Request(requestString));
}
}
/**
* add requests to fetch
@ -157,10 +151,8 @@ public class Page {
* @param request request
*/
public void addTargetRequest(Request request) {
synchronized (targetRequests) {
targetRequests.add(request);
}
}
/**
* get url of current page