public synchronized Collection<Task> pushTask(Collection<Task> validTasks) throws Exception{
Collection<Task> newTasks = new ArrayList<Task>();
for (Task task : validTasks){
try{
//如果不是在给定的合法host列表里则不给于抓取
ValidHosts vhs = task.site.getValidHosts();
if (vhs == null || vhs.getValidHost() == null || vhs.getValidHost().isEmpty()){
// System.out.println("isSameHost?->"+CommonUtil.isSameHost(task.site.getUrl(), task.url)+", url->"+task.url);
if (!CommonUtil.isSameHost(task.site.getUrl(), task.url))
continue;
}else{
boolean isOk = false;
String taskHost = new URL(task.url).getHost();
for (ValidHost h : vhs.getValidHost()){
if (taskHost.equals(h.getValue())){
isOk = true;
break;
}
}