Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
- fixed at least two causes for a NPE after a use case switch. A large refactoring was neccessary - added another crawl start option: automatic restriction to sub-path - removed crawlStartSimple and renamed crawl start expert to crawl start (without expert) - some changes to texts in crawl start - added some more deletions when an web index is deleted: delete also queues and robots cache
orbiter2f381b8d7aeb
diff --git a/htroot/CrawlStartSimple_p.html b/htroot/CrawlStartSimple_p.htmldeleted file mode 100644index 347c54fe8..000000000--- a/htroot/CrawlStartSimple_p.html+++ /dev/null@@ -1,138 +0,0 @@-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">-<html xmlns="http://www.w3.org/1999/xhtml">- <head>- <title>YaCy '#[clientname]#': Crawl Start (easy)</title>- #%env/templates/metas.template%#- <script type="text/javascript" src="/js/ajax.js"></script>- <script type="text/javascript" src="/js/IndexCreate.js"></script>- </head>- <body id="IndexCreate">- #%env/templates/header.template%#- #%env/templates/submenuIndexCreate.template%#- <h2>Easy Crawl Start</h2>-- <p id="startCrawling">- <strong>Start Crawling Job:</strong> - You can define URLs as start points for Web page crawling and start crawling here.- "Crawling" means that YaCy will download the given website, extract all links in it- and then download the content behind these links.- This is repeated as long as specified under "Crawling Depth".- </p>-- <form action="WatchCrawler_p.html" method="post" enctype="multipart/form-data">- <input type="hidden" name="crawlingFilter" value=".*" />- <input type="hidden" name="crawlingIfOlderCheck" value="off" />- <input type="hidden" name="crawlingDomFilterCheck" value="off" />- <input type="hidden" name="crawlingDomMaxCheck" value="off" />- <input type="hidden" name="crawlingQ" value="off" />- <input type="hidden" name="storeHTCache" value="on" />- <input type="hidden" name="indexText" value="on" />- <input type="hidden" name="indexMedia" value="on" />- <input type="hidden" name="crawlOrder" value="on" />- <input type="hidden" name="intention" value="simple web crawl" />- <input type="hidden" name="xsstopw" value="off" />- <table border="0" cellpadding="5" cellspacing="1">- <tr class="TableHeader">- <td><strong>Attribut</strong></td>- <td><strong>Value</strong></td>- <td><strong>Description</strong></td>- </tr>- <tr valign="top" class="TableCellSummary">- <td>Starting Point:</td>- <td>- <input name="crawlingURL" type="text" size="41" maxlength="256" value="http://" onkeypress="changed()" />- <span id="robotsOK"></span><br />- <span id="title"><br/></span>- <img src="/env/grafics/empty.gif" name="ajax" alt="empty" />- </td>- <td>- Enter here the start url of the web crawl.- </td>- </tr>- <tr valign="top" class="TableCellLight">- <td><label for="crawlingDepth">Crawling Range</label>:</td>- <td>- <input type="radio" name="range" value="wide" checked="checked" />Wide: depth <input name="crawlingDepth" id="crawlingDepth" type="text" size="2" maxlength="2" value="#[crawlingDepth]#" /> | - <input type="radio" name="range" value="domain" />Complete Domain- </td>- <td>- The range defines if the crawl shall consider a complete domain, or a wide crawl up to a specific depth.- </td>- </tr>-- <tr valign="top" class="TableCellLight">- <td colspan="3"><input type="submit" name="crawlingstart" value="Start New Distributed Crawl (will be visible at other peers)" /></td>- </tr>- </table>- </form>-- <p id="crawlingStarts"><strong>Recently started remote crawls in progress:</strong></p>- <table border="0" cellpadding="2" cellspacing="1">- <tr class="TableHeader">- <td><strong>Start Time</strong></td>- <td><strong>Peer Name</strong></td>- <td><strong>Start URL</strong></td>- <td><strong>Intention/Description</strong></td>- <td><strong>Depth</strong></td>- <td><strong>Accept '?' URLs</strong></td>- </tr>- #{otherCrawlStartInProgress}#- <tr class="TableCell#(dark)#Light::Dark#(/dark)#" >- <td>#[cre]#</td>- <td>#[peername]#</td>- <td><a href="#[startURL]#">#[startURL]#</a></td>- <td>#[intention]#</td>- <td>#[generalDepth]#</td>- <td>#(crawlingQ)#no::yes#(/crawlingQ)#</td>- </tr>- #{/otherCrawlStartInProgress}#- </table>- <p><strong>Recently started remote crawls, finished:</strong></p>- <table border="0" cellpadding="2" cellspacing="1">- <tr class="TableHeader">- <td><strong>Start Time</strong></td>- <td><strong>Peer Name</strong></td>- <td><strong>Start URL</strong></td>- <td><strong>Intention/Description</strong></td>- <td><strong>Depth</strong></td>- <td><strong>Accept '?' URLs</strong></td>- </tr>- #{otherCrawlStartFinished}#- <tr class="TableCell#(dark)#Light::Dark#(/dark)#" >- <td>#[cre]#</td>- <td>#[peername]#</td>- <td><a href="#[startURL]#">#[startURL]#</a></td>- <td>#[intention]#</td>- <td>#[generalDepth]#</td>- <td>#(crawlingQ)#no::yes#(/crawlingQ)#</td>- </tr>- #{/otherCrawlStartFinished}#- </table>- <p id="remoteCrawlPeers"><strong>Remote Crawling Peers:</strong> </p>- #(remoteCrawlPeers)#- <p>No remote crawl peers available.</p>- ::- <p>#[num]# peers available for remote crawling.</p>- <table border="0" cellpadding="2" cellspacing="1">- <colgroup>- <col width="60" />- <col />- </colgroup>- <tr class="TableCellDark">- <th>Idle Peers</th>- <td>- #{available}##[name]# (#[due]# seconds due) #{/available}#- </td>- </tr>- <tr class="TableCellLight">- <th>Busy Peers</th>- <td>- #{busy}##[name]# (#[due]# seconds due) #{/busy}#- </td>- </tr>- </table>- #(/remoteCrawlPeers)#-- #%env/templates/footer.template%#- </body>-</html>diff --git a/htroot/CrawlStartSimple_p.java b/htroot/CrawlStartSimple_p.javadeleted file mode 100644index 2333575bc..000000000--- a/htroot/CrawlStartSimple_p.java+++ /dev/null@@ -1,185 +0,0 @@-// CrawlStartSimple_p.java-// (C) 2004 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany-// first published 02.12.2004 as IndexCreate_p.java on http://yacy.net-//-// This is a part of YaCy, a peer-to-peer based web search engine-//-// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $-// $LastChangedRevision: 1986 $-// $LastChangedBy: orbiter $-//-// LICENSE-//-// This program is free software; you can redistribute it and/or modify-// it under the terms of the GNU General Public License as published by-// the Free Software Foundation; either version 2 of the License, or-// (at your option) any later version.-//-// This program is distributed in the hope that it will be useful,-// but WITHOUT ANY WARRANTY; without even the implied warranty of-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-// GNU General Public License for more details.-//-// You should have received a copy of the GNU General Public License-// along with this program; if not, write to the Free Software-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA--import java.util.Iterator;--import de.anomic.http.httpHeader;-import de.anomic.plasma.plasmaSwitchboard;-import de.anomic.server.serverObjects;-import de.anomic.server.serverSwitch;-import de.anomic.yacy.yacyCore;-import de.anomic.yacy.yacyNewsPool;-import de.anomic.yacy.yacyNewsRecord;-import de.anomic.yacy.yacySeed;--public class CrawlStartSimple_p {-- public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch<?> env) {- // return variable that accumulates replacements- plasmaSwitchboard sb = (plasmaSwitchboard) env;- serverObjects prop = new serverObjects();-- // define visible variables- prop.put("proxyPrefetchDepth", env.getConfig("proxyPrefetchDepth", "0"));- prop.put("crawlingDepth", Math.min(3, env.getConfigLong("crawlingDepth", 0)));- prop.put("crawlingFilter", env.getConfig("crawlingFilter", "0"));-- int crawlingIfOlder = (int) env.getConfigLong("crawlingIfOlder", -1);- prop.put("crawlingIfOlderCheck", (crawlingIfOlder == -1) ? "0" : "1");- prop.put("crawlingIfOlderUnitYearCheck", "0");- prop.put("crawlingIfOlderUnitMonthCheck", "0");- prop.put("crawlingIfOlderUnitDayCheck", "0");- prop.put("crawlingIfOlderUnitHourCheck", "0");- prop.put("crawlingIfOlderUnitMinuteCheck", "0");- if ((crawlingIfOlder == -1) || (crawlingIfOlder == Integer.MAX_VALUE)) {- prop.put("crawlingIfOlderNumber", "-1");- prop.put("crawlingIfOlderUnitYearCheck", "1");- } else if (crawlingIfOlder >= 60*24*365) {- prop.put("crawlingIfOlderNumber", Math.round((float)crawlingIfOlder / (float)(60*24*365)));- prop.put("crawlingIfOlderUnitYearCheck", "1");- } else if (crawlingIfOlder >= 60*24*30) {- prop.put("crawlingIfOlderNumber", Math.round((float)crawlingIfOlder / (float)(60*24*30)));- prop.put("crawlingIfOlderUnitMonthCheck", "1");- } else if (crawlingIfOlder >= 60*24) {- prop.put("crawlingIfOlderNumber", Math.round((float)crawlingIfOlder / (float)(60*24)));- prop.put("crawlingIfOlderUnitDayCheck", "1");- } else if (crawlingIfOlder >= 60) {- prop.put("crawlingIfOlderNumber", Math.round(crawlingIfOlder / 60f));- prop.put("crawlingIfOlderUnitHourCheck", "1");- } else {- prop.put("crawlingIfOlderNumber", crawlingIfOlder);- prop.put("crawlingIfOlderUnitMinuteCheck", "1");- }- int crawlingDomFilterDepth = (int) env.getConfigLong("crawlingDomFilterDepth", -1);- prop.put("crawlingDomFilterCheck", (crawlingDomFilterDepth == -1) ? "0" : "1");- prop.put("crawlingDomFilterDepth", (crawlingDomFilterDepth == -1) ? 1 : crawlingDomFilterDepth);- int crawlingDomMaxPages = (int) env.getConfigLong("crawlingDomMaxPages", -1);- prop.put("crawlingDomMaxCheck", (crawlingDomMaxPages == -1) ? "0" : "1");- prop.put("crawlingDomMaxPages", (crawlingDomMaxPages == -1) ? 10000 : crawlingDomMaxPages);- prop.put("crawlingQChecked", env.getConfig("crawlingQ", "").equals("true") ? "1" : "0");- prop.put("storeHTCacheChecked", env.getConfig("storeHTCache", "").equals("true") ? "1" : "0");- prop.put("indexingTextChecked", env.getConfig("indexText", "").equals("true") ? "1" : "0");- prop.put("indexingMediaChecked", env.getConfig("indexMedia", "").equals("true") ? "1" : "0");- prop.put("crawlOrderChecked", env.getConfig("crawlOrder", "").equals("true") ? "1" : "0");-- long LCbusySleep = Integer.parseInt(env.getConfig(plasmaSwitchboard.CRAWLJOB_LOCAL_CRAWL_BUSYSLEEP, "100"));- int LCppm = (LCbusySleep == 0) ? 1000 : (int) (60000L / LCbusySleep);- prop.put("crawlingSpeedMaxChecked", (LCppm >= 1000) ? "1" : "0");- prop.put("crawlingSpeedCustChecked", ((LCppm > 10) && (LCppm < 1000)) ? "1" : "0");- prop.put("crawlingSpeedMinChecked", (LCppm <= 10) ? "1" : "0");- prop.put("customPPMdefault", ((LCppm > 10) && (LCppm < 1000)) ? Integer.toString(LCppm) : "");-- prop.put("xsstopwChecked", env.getConfig("xsstopw", "").equals("true") ? "1" : "0");- prop.put("xdstopwChecked", env.getConfig("xdstopw", "").equals("true") ? "1" : "0");- prop.put("xpstopwChecked", env.getConfig("xpstopw", "").equals("true") ? "1" : "0");-- // create prefetch table- boolean dark = true;-- // create other peer crawl table using YaCyNews- Iterator<yacyNewsRecord> recordIterator = sb.webIndex.newsPool.recordIterator(yacyNewsPool.INCOMING_DB, true);- int showedCrawl = 0;- yacyNewsRecord record;- yacySeed peer;- String peername;- while (recordIterator.hasNext()) {- record = recordIterator.next();- if (record == null) continue;- if (record.category().equals(yacyNewsPool.CATEGORY_CRAWL_START)) {- peer = sb.webIndex.seedDB.get(record.originator());- if (peer == null) peername = record.originator(); else peername = peer.getName();- prop.put("otherCrawlStartInProgress_" + showedCrawl + "_dark", dark ? "1" : "0");- prop.put("otherCrawlStartInProgress_" + showedCrawl + "_cre", record.created().toString());- prop.put("otherCrawlStartInProgress_" + showedCrawl + "_peername", peername);- prop.put("otherCrawlStartInProgress_" + showedCrawl + "_startURL", record.attributes().get("startURL").toString());- prop.put("otherCrawlStartInProgress_" + showedCrawl + "_intention", record.attributes().get("intention").toString());- prop.put("otherCrawlStartInProgress_" + showedCrawl + "_generalDepth", record.attributes().get("generalDepth"));- prop.put("otherCrawlStartInProgress_" + showedCrawl + "_crawlingQ", (record.attributes().get("crawlingQ").equals("true")) ? "1" : "0");- showedCrawl++;- if (showedCrawl > 20) break;- }- }- prop.put("otherCrawlStartInProgress", showedCrawl);-- // finished remote crawls- recordIterator = sb.webIndex.newsPool.recordIterator(yacyNewsPool.PROCESSED_DB, true);- showedCrawl = 0;- while (recordIterator.hasNext()) {- record = (yacyNewsRecord) recordIterator.next();- if (record == null) continue;- if (record.category().equals(yacyNewsPool.CATEGORY_CRAWL_START)) {- peer = sb.webIndex.seedDB.get(record.originator());- if (peer == null) peername = record.originator(); else peername = peer.getName();- prop.put("otherCrawlStartFinished_" + showedCrawl + "_dark", dark ? "1" : "0");- prop.put("otherCrawlStartFinished_" + showedCrawl + "_cre", record.created().toString());- prop.putHTML("otherCrawlStartFinished_" + showedCrawl + "_peername", peername);- prop.putHTML("otherCrawlStartFinished_" + showedCrawl + "_startURL", record.attributes().get("startURL").toString());- prop.put("otherCrawlStartFinished_" + showedCrawl + "_intention", record.attributes().get("intention").toString());- prop.put("otherCrawlStartFinished_" + showedCrawl + "_generalDepth", record.attributes().get("generalDepth"));- prop.put("otherCrawlStartFinished_" + showedCrawl + "_crawlingQ", (record.attributes().get("crawlingQ").equals("true")) ? "1" : "0");- showedCrawl++;- if (showedCrawl > 20) break;- }- }- prop.put("otherCrawlStartFinished", showedCrawl);--- // remote crawl peers- if ((sb.webIndex.seedDB == null) || (sb.webIndex.seedDB.mySeed().isVirgin()) || (sb.webIndex.seedDB.mySeed().isJunior())) {- prop.put("remoteCrawlPeers", "0");- } else {- Iterator<yacySeed> crawlavail = yacyCore.peerActions.dhtAction.getAcceptRemoteCrawlSeeds(null, true);- Iterator<yacySeed> crawlpendi = yacyCore.peerActions.dhtAction.getAcceptRemoteCrawlSeeds(null, false);- if ((!(crawlavail.hasNext())) && (!(crawlpendi.hasNext()))) {- prop.put("remoteCrawlPeers", "0"); //no peers availible- } else {- prop.put("remoteCrawlPeers", "1");- int maxcount = 100;- int availcount = 0;- yacySeed seed;- while ((availcount < maxcount) && (crawlavail.hasNext())) {- seed = crawlavail.next();- prop.putHTML("remoteCrawlPeers_available_" + availcount + "_name", seed.getName());- prop.put("remoteCrawlPeers_available_" + availcount + "_due", (yacyCore.yacyTime() - seed.available));- availcount++;- }- prop.put("remoteCrawlPeers_available", availcount);- int pendicount = 0;- while ((pendicount < maxcount) && (crawlpendi.hasNext())) {- seed = crawlpendi.next();- prop.putHTML("remoteCrawlPeers_busy_" + pendicount + "_name", seed.getName());- prop.put("remoteCrawlPeers_busy_" + pendicount + "_due", (yacyCore.yacyTime() - seed.available));- pendicount++;- }- prop.put("remoteCrawlPeers_busy", pendicount);- prop.put("remoteCrawlPeers_num", (availcount + pendicount));- }- }-- // return rewrite properties- return prop;- }-}diff --git a/htroot/CrawlStartExpert_p.html b/htroot/CrawlStart_p.htmlsimilarity index 95%rename from htroot/CrawlStartExpert_p.htmlrename to htroot/CrawlStart_p.htmlindex 2b766e8ec..8aeb5cc8d 100644--- a/htroot/CrawlStartExpert_p.html+++ b/htroot/CrawlStart_p.html@@ -16,7 +16,7 @@You can define URLs as start points for Web page crawling and start crawling here. "Crawling" means that YaCy will download the given website, extract all links in it and then download the content behind these links. This is repeated as long as specified under "Crawling Depth".</p>- <form action="WatchCrawler_p.html" method="post" enctype="multipart/form-data">+ <form action="WatchCrawler_p.html" method="get" enctype="multipart/form-data"><table border="0" cellpadding="5" cellspacing="1"><tr class="TableHeader"><td><strong>Attribut</strong></td>@@ -53,9 +53,8 @@</table></td><td colspan="3">- Existing start URLs are re-crawled.- Other already visited URLs are sorted out as "double".- A complete re-crawl will be available soon.+ Existing start URLs are always re-crawled.+ Other already visited URLs are sorted out as "double", if they are not allowed using the re-crawl option.</td></tr><tr valign="top" class="TableCellLight">@@ -72,9 +71,10 @@<tr valign="top" class="TableCellDark"><td><label for="crawlingFilter">Crawling Filter</label>:</td><td>- <input name="crawlingFilter" id="crawlingFilter" type="text" size="20" maxlength="100" value="#[crawlingFilter]#" />- <input type="radio" name="range" value="wide" checked="checked" />Use filter | - <input type="radio" name="range" value="domain" />Restrict to start domain+ <input type="radio" name="range" value="wide" checked="checked" />Use filter + <input name="crawlingFilter" id="crawlingFilter" type="text" size="20" maxlength="100" value="#[crawlingFilter]#" /><br />+ <input type="radio" name="range" value="domain" />Restrict to start domain<br />+ <input type="radio" name="range" value="subpath" />Restrict to sub-path</td><td>The filter is an emacs-like regular expression that must match with the URLs which are used to be crawled; default is 'catch all'.diff --git a/htroot/CrawlStartExpert_p.java b/htroot/CrawlStart_p.javasimilarity index 97%rename from htroot/CrawlStartExpert_p.javarename to htroot/CrawlStart_p.javaindex 52a8916f9..e1ee43813 100644--- a/htroot/CrawlStartExpert_p.java+++ b/htroot/CrawlStart_p.java@@ -29,7 +29,7 @@ import de.anomic.plasma.plasmaSwitchboard;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;-public class CrawlStartExpert_p {+public class CrawlStart_p {public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch<?> env) {// return variable that accumulates replacementsdiff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.javaindex b93629f20..644950e3d 100644--- a/htroot/IndexControlRWIs_p.java+++ b/htroot/IndexControlRWIs_p.java@@ -108,6 +108,17 @@ public class IndexControlRWIs_p {// delete everythingif (post.containsKey("deletecomplete")) {sb.webIndex.clear();+ sb.crawlQueues.clear();+ try {+ sb.crawlStacker.clear();+ } catch (IOException e) {+ e.printStackTrace();+ }+ try {+ plasmaSwitchboard.robots.clear();+ } catch (IOException e) {+ e.printStackTrace();+ }post.remove("deletecomplete");}@@ -309,7 +320,7 @@ public class IndexControlRWIs_p {sb.webIndex.removeEntries(keyhash, urlHashes);}- if (prop.getInt("searchresult", 0) == 3) plasmaSearchAPI.listHosts(prop, keyhash);+ if (prop.getInt("searchresult", 0) == 3) plasmaSearchAPI.listHosts(prop, keyhash, sb.webIndex.peerActions);}diff --git a/htroot/IndexTransfer_p.java b/htroot/IndexTransfer_p.javaindex 3e91be9b9..2330a59ff 100644--- a/htroot/IndexTransfer_p.java+++ b/htroot/IndexTransfer_p.java@@ -58,7 +58,6 @@ import de.anomic.plasma.plasmaSwitchboard;import de.anomic.server.serverMemory;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;-import de.anomic.yacy.yacyCore;import de.anomic.yacy.yacySeed;public final class IndexTransfer_p {@@ -131,7 +130,7 @@ public final class IndexTransfer_p {yacySeed seed;int hc = 0;if ((sb.webIndex.seedDB != null) && (sb.webIndex.seedDB.sizeConnected() > 0)) {- Iterator<yacySeed> e = yacyCore.peerActions.dhtAction.getAcceptRemoteIndexSeeds("------------");+ Iterator<yacySeed> e = sb.webIndex.peerActions.dhtAction.getAcceptRemoteIndexSeeds("------------");TreeMap<String, String> hostList = new TreeMap<String, String>();while (e.hasNext()) {seed = e.next();diff --git a/htroot/MessageSend_p.java b/htroot/MessageSend_p.javaindex bdbdb9c55..17614b025 100644--- a/htroot/MessageSend_p.java+++ b/htroot/MessageSend_p.java@@ -54,7 +54,6 @@ import de.anomic.plasma.plasmaSwitchboard;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;import de.anomic.yacy.yacyClient;-import de.anomic.yacy.yacyCore;import de.anomic.yacy.yacySeed;public class MessageSend_p {@@ -108,7 +107,7 @@ public class MessageSend_p {prop.put("mode_permission", "0");if (targetPeer != null) {- yacyCore.peerActions.peerDeparture(targetPeer, "peer responded upon message send request: " + response);+ sb.webIndex.peerActions.peerDeparture(targetPeer, "peer responded upon message send request: " + response);}} else {prop.put("mode_permission", "1");diff --git a/htroot/Network.java b/htroot/Network.javaindex 07b6f1f4d..33035f0e3 100644--- a/htroot/Network.java+++ b/htroot/Network.java@@ -63,7 +63,6 @@ import de.anomic.server.serverDate;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;import de.anomic.yacy.yacyClient;-import de.anomic.yacy.yacyCore;import de.anomic.yacy.yacyNewsPool;import de.anomic.yacy.yacyNewsRecord;import de.anomic.yacy.yacySeed;@@ -109,7 +108,7 @@ public class Network {yacySeed seed = sb.webIndex.seedDB.mySeed();if (sb.webIndex.seedDB.mySeed() != null){ //our Peer// update seed info- yacyCore.peerActions.updateMySeed();+ sb.updateMySeed();long LCount;long ICount;@@ -213,8 +212,8 @@ public class Network {map.put(yacySeed.PORT,post.get("peerPort"));yacySeed peer = new yacySeed(post.get("peerHash"),map);- yacyCore.peerActions.updateMySeed();- final int added = yacyClient.publishMySeed(sb.webIndex.seedDB.mySeed(), peer.getPublicAddress(), peer.hash);+ sb.updateMySeed();+ final int added = yacyClient.publishMySeed(sb.webIndex.seedDB.mySeed(), sb.webIndex.peerActions, peer.getPublicAddress(), peer.hash);if (added <= 0) {prop.put("table_comment",1);@@ -261,7 +260,7 @@ public class Network {} else {// add temporary the own seed to the databaseif (iAmActive) {- yacyCore.peerActions.updateMySeed();+ sb.updateMySeed();sb.webIndex.seedDB.addConnected(sb.webIndex.seedDB.mySeed());}@@ -379,7 +378,7 @@ public class Network {userAgent = httpClient.getUserAgent();location = HttpClient.generateLocation();} else {- userAgent = yacyCore.peerActions.getUserAgent(seed.getIP());+ userAgent = sb.webIndex.peerActions.getUserAgent(seed.getIP());location = parseLocationInUserAgent(userAgent);}prop.put(STR_TABLE_LIST + conCount + "_location", location);diff --git a/htroot/Status.java b/htroot/Status.javaindex 158fd161b..bf2ec6bdc 100644--- a/htroot/Status.java+++ b/htroot/Status.java@@ -61,7 +61,6 @@ import de.anomic.server.serverObjects;import de.anomic.server.serverProcessor;import de.anomic.server.serverSwitch;import de.anomic.tools.yFormatter;-import de.anomic.yacy.yacyCore;import de.anomic.yacy.yacySeed;import de.anomic.yacy.yacyVersion;@@ -119,7 +118,7 @@ public class Status {}// update seed info- yacyCore.peerActions.updateMySeed();+ sb.updateMySeed();boolean adminaccess = sb.adminAuthenticated(header) >= 2;if (adminaccess) {@@ -194,10 +193,7 @@ public class Status {prop.putNum("peerStatistics_queriesperhour", Math.round(6000d * sb.webIndex.seedDB.mySeed().getQPM()) / 100d);prop.putNum("peerStatistics_links", sb.webIndex.seedDB.mySeed().getLinkCount());prop.put("peerStatistics_words", yFormatter.number(sb.webIndex.seedDB.mySeed().get(yacySeed.ICOUNT, "0")));- prop.putNum("peerStatistics_juniorConnects", yacyCore.peerActions.juniorConnects);- prop.putNum("peerStatistics_seniorConnects", yacyCore.peerActions.seniorConnects);- prop.putNum("peerStatistics_principalConnects", yacyCore.peerActions.principalConnects);- prop.putNum("peerStatistics_disconnects", yacyCore.peerActions.disconnects);+ prop.putNum("peerStatistics_disconnects", sb.webIndex.peerActions.disconnects);prop.put("peerStatistics_connects", yFormatter.number(sb.webIndex.seedDB.mySeed().get(yacySeed.CCOUNT, "0")));thisHash = sb.webIndex.seedDB.mySeed().hash;if (sb.webIndex.seedDB.mySeed().getPublicAddress() == null) {diff --git a/htroot/WatchCrawler_p.html b/htroot/WatchCrawler_p.htmlindex f11d43085..217fd75d8 100644--- a/htroot/WatchCrawler_p.html+++ b/htroot/WatchCrawler_p.html@@ -1,6 +1,6 @@<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml">-#(forwardToCrawlStart)#::<meta http-equiv="REFRESH" content="5; url=/CrawlStartSimple_p.html">#(/forwardToCrawlStart)#+#(forwardToCrawlStart)#::<meta http-equiv="REFRESH" content="5; url=/CrawlStart_p.html">#(/forwardToCrawlStart)#<head><title>YaCy '#[clientname]#': Crawler Queues</title>#%env/templates/metas.template%#diff --git a/htroot/WatchCrawler_p.java b/htroot/WatchCrawler_p.javaindex 6d709ee39..d3196b299 100644--- a/htroot/WatchCrawler_p.java+++ b/htroot/WatchCrawler_p.java@@ -105,13 +105,30 @@ public class WatchCrawler_p {} else {// set new propertiesboolean fullDomain = post.get("range", "wide").equals("domain"); // special property in simple crawl start+ boolean subPath = post.get("range", "wide").equals("subpath"); // special property in simple crawl start+ String crawlingStart = post.get("crawlingURL","").trim(); // the crawljob start url++ // adding the prefix http:// if necessary+ int pos = crawlingStart.indexOf("://");+ if (pos == -1) crawlingStart = "http://" + crawlingStart;++ // normalizing URL+ yacyURL crawlingStartURL = null;+ try {crawlingStartURL = new yacyURL(crawlingStart, null);} catch (MalformedURLException e1) {}+ crawlingStart = (crawlingStartURL == null) ? null : crawlingStartURL.toNormalform(true, true);++ // set the crawling filterString newcrawlingfilter = post.get("crawlingFilter", ".*");if (newcrawlingfilter.length() < 2) newcrawlingfilter = ".*"; // avoid that all urls are filtered out if bad value was submitted++ if (crawlingStartURL!= null && fullDomain) {+ newcrawlingfilter = ".*" + crawlingStartURL.getHost() + ".*";+ }+ if (crawlingStart!= null && subPath && (pos = crawlingStart.lastIndexOf("/")) > 0) {+ newcrawlingfilter = crawlingStart.substring(0, pos + 1) + ".*";+ }env.setConfig("crawlingFilter", newcrawlingfilter);- if (fullDomain) try {- newcrawlingfilter = ".*" + (new yacyURL(post.get("crawlingURL",""), null)).getHost() + ".*";- } catch (MalformedURLException e) {}boolean crawlOrder = post.get("crawlOrder", "off").equals("on");env.setConfig("crawlOrder", (crawlOrder) ? "true" : "false");@@ -157,18 +174,6 @@ public class WatchCrawler_p {String crawlingMode = post.get("crawlingMode","url");if (crawlingMode.equals(CRAWLING_MODE_URL)) {- // getting the crawljob start url- String crawlingStart = post.get("crawlingURL","");- crawlingStart = crawlingStart.trim();-- // adding the prefix http:// if necessary- int pos = crawlingStart.indexOf("://");- if (pos == -1) crawlingStart = "http://" + crawlingStart;-- // normalizing URL- yacyURL crawlingStartURL = null;- try {crawlingStartURL = new yacyURL(crawlingStart, null);} catch (MalformedURLException e1) {}- crawlingStart = (crawlingStartURL == null) ? null : crawlingStartURL.toNormalform(true, true);// check if pattern matchesif ((crawlingStart == null) /* || (!(crawlingStart.matches(newcrawlingfilter))) */) {diff --git a/htroot/env/templates/submenuIndexCreate.template b/htroot/env/templates/submenuIndexCreate.templateindex fcea0c668..c5ecb2c26 100644--- a/htroot/env/templates/submenuIndexCreate.template+++ b/htroot/env/templates/submenuIndexCreate.template@@ -1,8 +1,7 @@<div class="SubMenu"><h3>Start a Web Crawl</h3><ul class="SubMenu">- <li><a href="/CrawlStartSimple_p.html" class="MenuItemLink lock">Crawl Start (easy)</a></li>- <li><a href="/CrawlStartExpert_p.html" class="MenuItemLink lock">Crawl Start (expert)</a></li>+ <li><a href="/CrawlStart_p.html" class="MenuItemLink lock">Crawl Start</a></li><li><a href="/CrawlProfileEditor_p.html" class="MenuItemLink lock">Crawl Profile Editor</a></li><li><a href="/WatchCrawler_p.html" class="MenuItemLink lock">Crawler Queues</a></li></ul>diff --git a/htroot/rct_p.java b/htroot/rct_p.javaindex 1c809c645..67d5bc8cc 100644--- a/htroot/rct_p.java+++ b/htroot/rct_p.java@@ -38,7 +38,6 @@ import de.anomic.server.serverSwitch;import de.anomic.xml.RSSFeed;import de.anomic.xml.RSSMessage;import de.anomic.yacy.yacyClient;-import de.anomic.yacy.yacyCore;import de.anomic.yacy.yacySeed;import de.anomic.yacy.yacyURL;@@ -106,7 +105,7 @@ public class rct_p {yacySeed seed;int hc = 0;if (sb.webIndex.seedDB != null && sb.webIndex.seedDB.sizeConnected() > 0) {- Iterator<yacySeed> e = yacyCore.peerActions.dhtAction.getProvidesRemoteCrawlURLs();+ Iterator<yacySeed> e = sb.webIndex.peerActions.dhtAction.getProvidesRemoteCrawlURLs();while (e.hasNext()) {seed = e.next();if (seed != null) {diff --git a/htroot/www/welcome.java b/htroot/www/welcome.javaindex 3a7e02212..4f69211d5 100644--- a/htroot/www/welcome.java+++ b/htroot/www/welcome.java@@ -57,7 +57,6 @@ import de.anomic.server.serverCore;import de.anomic.server.serverDomains;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;-import de.anomic.yacy.yacyCore;import de.anomic.yacy.yacySeed;public class welcome {@@ -69,7 +68,7 @@ public class welcome {final serverObjects prop = new serverObjects();// update seed info- yacyCore.peerActions.updateMySeed();+ sb.updateMySeed();prop.putHTML("peername", env.getConfig("peerName", "<nameless>"));prop.putHTML("peerdomain", env.getConfig("peerName", "<nameless>").toLowerCase());diff --git a/htroot/xml/status_p.java b/htroot/xml/status_p.javaindex 0ed2b5c0e..21a2e4804 100644--- a/htroot/xml/status_p.java+++ b/htroot/xml/status_p.java@@ -47,7 +47,6 @@ import de.anomic.server.serverMemory;import de.anomic.server.serverObjects;import de.anomic.server.serverProcessor;import de.anomic.server.serverSwitch;-import de.anomic.yacy.yacyCore;public class status_p {@@ -59,7 +58,7 @@ public class status_p {if (post == null || !post.containsKey("html"))prop.setLocalized(false);prop.put("rejected", "0");- yacyCore.peerActions.updateMySeed();+ sb.updateMySeed();final int cacheOutSize = sb.webIndex.dhtOutCacheSize();final long cacheMaxSize = sb.getConfigLong(plasmaSwitchboard.WORDCACHE_MAX_COUNT, 10000);prop.putNum("ppm", sb.webIndex.seedDB.mySeed().getPPM());diff --git a/htroot/yacy/hello.java b/htroot/yacy/hello.javaindex 97d48ff47..4f6e7b30b 100644--- a/htroot/yacy/hello.java+++ b/htroot/yacy/hello.java@@ -172,18 +172,17 @@ public final class hello {remoteSeed.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR);}// connect the seed- yacyCore.peerActions.peerArrival(remoteSeed, true);+ sb.webIndex.peerActions.peerArrival(remoteSeed, true);} else {prop.put(yacySeed.YOURTYPE, yacySeed.PEERTYPE_JUNIOR);- yacyCore.peerActions.juniorConnects++; // update statisticsremoteSeed.put(yacySeed.PEERTYPE, yacySeed.PEERTYPE_JUNIOR);yacyCore.log.logInfo("hello: responded remote junior peer '" + remoteSeed.getName() + "' from " + reportedip);// no connection here, instead store junior in connection cacheif ((remoteSeed.hash != null) && (remoteSeed.isProper() == null)) {- yacyCore.peerActions.peerPing(remoteSeed);+ sb.webIndex.peerActions.peerPing(remoteSeed);}}- yacyCore.peerActions.setUserAgent(clientip, userAgent);+ sb.webIndex.peerActions.setUserAgent(clientip, userAgent);if (!((String)prop.get(yacySeed.YOURTYPE)).equals(reportedPeerType)) {yacyCore.log.logInfo("hello: changing remote peer '" + remoteSeed.getName() +"' [" + reportedip +diff --git a/htroot/yacy/search.java b/htroot/yacy/search.javaindex 74c8c9f4b..d4f0dbbd3 100644--- a/htroot/yacy/search.java+++ b/htroot/yacy/search.java@@ -154,7 +154,7 @@ public final class search {if (sb.webIndex.seedDB == null) {yacyCore.log.logSevere("yacy.search: seed cache not initialized");} else {- yacyCore.peerActions.peerArrival(remoteSeed, true);+ sb.webIndex.peerActions.peerArrival(remoteSeed, true);}// prepare searchdiff --git a/source/de/anomic/crawler/CrawlQueues.java b/source/de/anomic/crawler/CrawlQueues.javaindex dcfd8bc77..6f07e071b 100644--- a/source/de/anomic/crawler/CrawlQueues.java+++ b/source/de/anomic/crawler/CrawlQueues.java@@ -46,7 +46,6 @@ import de.anomic.server.logging.serverLog;import de.anomic.xml.RSSFeed;import de.anomic.xml.RSSMessage;import de.anomic.yacy.yacyClient;-import de.anomic.yacy.yacyCore;import de.anomic.yacy.yacySeed;import de.anomic.yacy.yacyURL;@@ -115,6 +114,27 @@ public class CrawlQueues {return null;}+ public void clear() {+ // wait for all workers to finish+ for (crawlWorker w: workers.values()) {+ w.interrupt();+ }+ // TODO: wait some more time until all threads are finished+ workers.clear();+ remoteCrawlProviderHashes.clear();+ noticeURL.clear();+ try {+ errorURL.clear();+ } catch (IOException e) {+ e.printStackTrace();+ }+ try {+ delegatedURL.clear();+ } catch (IOException e) {+ e.printStackTrace();+ }+ }+public void close() {// wait for all workers to finishfor (crawlWorker w: workers.values()) {@@ -263,7 +283,7 @@ public class CrawlQueues {(remoteTriggeredCrawlJobSize() == 0) &&(sb.queueSize() < 10)) {if (sb.webIndex.seedDB != null && sb.webIndex.seedDB.sizeConnected() > 0) {- Iterator<yacySeed> e = yacyCore.peerActions.dhtAction.getProvidesRemoteCrawlURLs();+ Iterator<yacySeed> e = sb.webIndex.peerActions.dhtAction.getProvidesRemoteCrawlURLs();while (e.hasNext()) {seed = e.next();if (seed != null) {diff --git a/source/de/anomic/crawler/CrawlStacker.java b/source/de/anomic/crawler/CrawlStacker.javaindex a1b4f177d..767acc824 100644--- a/source/de/anomic/crawler/CrawlStacker.java+++ b/source/de/anomic/crawler/CrawlStacker.java@@ -179,6 +179,11 @@ public final class CrawlStacker extends Thread {}}+ public void clear() throws IOException {+ this.urlEntryHashCache.clear();+ this.urlEntryCache.clear();+ }+public void close() {if (this.dbtype == QUEUE_DB_TYPE_RAM) {this.log.logInfo("Shutdown. Flushing remaining " + size() + " crawl stacker job entries. please wait.");diff --git a/source/de/anomic/crawler/NoticedURL.java b/source/de/anomic/crawler/NoticedURL.javaindex d113e60ca..57e612ed4 100755--- a/source/de/anomic/crawler/NoticedURL.java+++ b/source/de/anomic/crawler/NoticedURL.java@@ -77,13 +77,18 @@ public class NoticedURL {//private kelondroStack musicStack; // links pointing to music resourcespublic NoticedURL(File cachePath) {- super();coreStack = new Balancer(cachePath, "urlNoticeCoreStack", false);limitStack = new Balancer(cachePath, "urlNoticeLimitStack", false);//overhangStack = new plasmaCrawlBalancer(overhangStackFile);remoteStack = new Balancer(cachePath, "urlNoticeRemoteStack", false);}+ public void clear() {+ coreStack.clear();+ limitStack.clear();+ remoteStack.clear();+ }+public void close() {if (coreStack != null) {coreStack.close();diff --git a/source/de/anomic/crawler/RobotsTxt.java b/source/de/anomic/crawler/RobotsTxt.javaindex d4dd6ee0c..bf9fe5d1e 100644--- a/source/de/anomic/crawler/RobotsTxt.java+++ b/source/de/anomic/crawler/RobotsTxt.java@@ -80,6 +80,10 @@ public class RobotsTxt {robotsTable = new kelondroMapObjects(new kelondroDyn(robotsTableFile, true, true, 256, 512, '_', kelondroNaturalOrder.naturalOrder, false, false, true), 100);}+ public void clear() throws IOException {+ this.robotsTable.clear();+ }+public void close() {this.robotsTable.close();}diff --git a/source/de/anomic/crawler/ZURL.java b/source/de/anomic/crawler/ZURL.javaindex 4a1e270bd..20242f745 100755--- a/source/de/anomic/crawler/ZURL.java+++ b/source/de/anomic/crawler/ZURL.java@@ -82,6 +82,11 @@ public class ZURL {return urlIndex.size() ;}+ public void clear() throws IOException {+ urlIndex.clear();+ stack.clear();+ }+public void close() {if (urlIndex != null) {urlIndex.close();diff --git a/source/de/anomic/plasma/plasmaDHTFlush.java b/source/de/anomic/plasma/plasmaDHTFlush.javaindex 7f5419720..12f4772af 100644--- a/source/de/anomic/plasma/plasmaDHTFlush.java+++ b/source/de/anomic/plasma/plasmaDHTFlush.java@@ -230,7 +230,7 @@ public class plasmaDHTFlush extends Thread {// handover chunk to transfer workerif ((newDHTChunk.containerSize() > 0) || (newDHTChunk.getStatus() == plasmaDHTChunk.chunkStatus_FILLED)) {- this.worker = new plasmaDHTTransfer(this.log, this.wordIndex.seedDB, this.seed, newDHTChunk, this.gzipBody4Transfer, this.timeout4Transfer, 5);+ this.worker = new plasmaDHTTransfer(this.log, this.wordIndex.seedDB, this.wordIndex.peerActions, this.seed, newDHTChunk, this.gzipBody4Transfer, this.timeout4Transfer, 5);this.worker.setTransferMode(plasmaDHTTransfer.TRANSFER_MODE_FLUSH);this.worker.start();}diff --git a/source/de/anomic/plasma/plasmaDHTTransfer.java b/source/de/anomic/plasma/plasmaDHTTransfer.javaindex c3ae49d23..629770baa 100644--- a/source/de/anomic/plasma/plasmaDHTTransfer.java+++ b/source/de/anomic/plasma/plasmaDHTTransfer.java@@ -46,7 +46,7 @@ import java.util.HashMap;import de.anomic.server.logging.serverLog;import de.anomic.yacy.yacyClient;-import de.anomic.yacy.yacyCore;+import de.anomic.yacy.yacyPeerActions;import de.anomic.yacy.yacySeed;import de.anomic.yacy.yacySeedDB;@@ -74,6 +74,7 @@ public class plasmaDHTTransfer extends Thread {// other fieldsprivate yacySeedDB seedDB;+ private yacyPeerActions peerActions;private int maxRetry;private int transferMode = TRANSFER_MODE_DISTRIBUTION;serverLog log;@@ -81,6 +82,7 @@ public class plasmaDHTTransfer extends Thread {public plasmaDHTTransfer(serverLog log,yacySeedDB seedDB,+ yacyPeerActions peerActions,yacySeed destSeed,plasmaDHTChunk dhtChunk,boolean gzipBody,@@ -209,7 +211,7 @@ public class plasmaDHTTransfer extends Thread {this.transferStatusMessage = "Transfer to peer " + this.seed.getName() + ":" + this.seed.hash + " failed:'" + error + "', Trying to reconnect ...";// force disconnection of peer- yacyCore.peerActions.peerDeparture(this.seed, "DHT Transfer: " + this.transferStatusMessage);+ peerActions.peerDeparture(this.seed, "DHT Transfer: " + this.transferStatusMessage);this.log.logWarning(this.transferStatusMessage);// calculate pause time@@ -240,7 +242,7 @@ public class plasmaDHTTransfer extends Thread {return;// doing a peer ping to the remote seed- int added = yacyClient.publishMySeed(this.seedDB.mySeed(), this.seed.getPublicAddress(), this.seed.hash);+ int added = yacyClient.publishMySeed(this.seedDB.mySeed(), this.peerActions, this.seed.getPublicAddress(), this.seed.hash);if (added < 0) {// inc. retry counterretryCount++;diff --git a/source/de/anomic/plasma/plasmaProfiling.java b/source/de/anomic/plasma/plasmaProfiling.javaindex 4c1fd4adf..94027fa94 100644--- a/source/de/anomic/plasma/plasmaProfiling.java+++ b/source/de/anomic/plasma/plasmaProfiling.java@@ -29,29 +29,14 @@ package de.anomic.plasma;import java.util.ConcurrentModificationException;import java.util.Iterator;-import de.anomic.crawler.IndexingStack;import de.anomic.server.serverProfiling;import de.anomic.server.serverProfiling.Event;-import de.anomic.yacy.yacyCore;-import de.anomic.yacy.yacySeed;import de.anomic.ymage.ymageChart;import de.anomic.ymage.ymageMatrix;public class plasmaProfiling {private static ymageChart bufferChart = null;-- public static long lastPPMUpdate = System.currentTimeMillis()- 30000;-- public static void updateIndexedPage(yacySeed mySeed, IndexingStack.QueueEntry entry) {- if (System.currentTimeMillis() - lastPPMUpdate > 30000) {- // we don't want to do this too often- yacyCore.peerActions.updateMySeed();- serverProfiling.update("ppm", new Long(mySeed.getPPM()));- lastPPMUpdate = System.currentTimeMillis();- }- serverProfiling.update("indexed", entry.url().toNormalform(true, false));- }public static long maxPayload(String eventname, long min) {Iterator<Event> i = serverProfiling.history(eventname);diff --git a/source/de/anomic/plasma/plasmaSearchAPI.java b/source/de/anomic/plasma/plasmaSearchAPI.javaindex a936e2252..b59dbd2fa 100644--- a/source/de/anomic/plasma/plasmaSearchAPI.java+++ b/source/de/anomic/plasma/plasmaSearchAPI.java@@ -38,7 +38,7 @@ import de.anomic.index.indexURLReference;import de.anomic.kelondro.kelondroBitfield;import de.anomic.server.serverDate;import de.anomic.server.serverObjects;-import de.anomic.yacy.yacyCore;+import de.anomic.yacy.yacyPeerActions;import de.anomic.yacy.yacySeed;import de.anomic.yacy.yacyURL;@@ -67,12 +67,12 @@ public class plasmaSearchAPI {return b;}- public static void listHosts(serverObjects prop, String startHash) {+ public static void listHosts(serverObjects prop, String startHash, yacyPeerActions peerActions) {// list known hostsyacySeed seed;int hc = 0;prop.put("searchresult_keyhash", startHash);- Iterator<yacySeed> e = yacyCore.peerActions.dhtAction.getAcceptRemoteIndexSeeds(startHash);+ Iterator<yacySeed> e = peerActions.dhtAction.getAcceptRemoteIndexSeeds(startHash);while (e.hasNext()) {seed = (yacySeed) e.next();if (seed != null) {diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.javaindex ce24d2340..6a00837f1 100644--- a/source/de/anomic/plasma/plasmaSwitchboard.java+++ b/source/de/anomic/plasma/plasmaSwitchboard.java@@ -150,6 +150,7 @@ import de.anomic.server.serverAbstractSwitch;import de.anomic.server.serverBusyThread;import de.anomic.server.serverCodings;import de.anomic.server.serverCore;+import de.anomic.server.serverDate;import de.anomic.server.serverDomains;import de.anomic.server.serverFileUtils;import de.anomic.server.serverInstantBusyThread;@@ -178,7 +179,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.public static int xstackCrawlSlots = 2000;private int dhtTransferIndexCount = 100;-+ public static long lastPPMUpdate = System.currentTimeMillis()- 30000;+// we must distinguish the following cases: resource-load was initiated by// 1) global crawling: the index is extern, not here (not possible here)// 2) result of search queries, some indexes are here (not possible here)@@ -867,7 +869,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.// start yacy corelog.logConfig("Starting YaCy Protocol Core");this.yc = new yacyCore(this);- serverInstantBusyThread.oneTimeJob(yacyCore.peerActions, "loadSeedLists", yacyCore.log, 0);+ serverInstantBusyThread.oneTimeJob(this, "loadSeedLists", yacyCore.log, 0);long startedSeedListAquisition = System.currentTimeMillis();// set up local robots.txt@@ -1258,6 +1260,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.if (!rcp) pauseCrawlJob(CRAWLJOB_REMOTE_TRIGGERED_CRAWL);// trigger online cautionproxyLastAccess = System.currentTimeMillis() + 10000; // at least 10 seconds online caution to prevent unnecessary action on database meanwhile+ // clean search events which have cached relations to the old index+ plasmaSearchEvent.cleanupEvents(true);// switch the networkssynchronized (this.webIndex) {this.webIndex.close();@@ -2206,7 +2210,13 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.indexedPages++;// update profiling info- plasmaProfiling.updateIndexedPage(webIndex.seedDB.mySeed(), queueEntry);+ if (System.currentTimeMillis() - lastPPMUpdate > 30000) {+ // we don't want to do this too often+ updateMySeed();+ serverProfiling.update("ppm", new Long(webIndex.seedDB.mySeed().getPPM()));+ lastPPMUpdate = System.currentTimeMillis();+ }+ serverProfiling.update("indexed", queueEntry.url().toNormalform(true, false));// if this was performed for a remote crawl request, notify requesteryacySeed initiatorPeer = queueEntry.initiatorPeer();@@ -2511,7 +2521,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.try {// find a list of DHT-peersdouble maxDist = 0.2;- ArrayList<yacySeed> seeds = yacyCore.peerActions.dhtAction.getDHTTargets(webIndex.seedDB, log, peerCount, Math.min(8, (int) (this.webIndex.seedDB.sizeConnected() * maxDist)), dhtChunk.firstContainer().getWordHash(), dhtChunk.lastContainer().getWordHash(), maxDist);+ ArrayList<yacySeed> seeds = webIndex.peerActions.dhtAction.getDHTTargets(webIndex.seedDB, log, peerCount, Math.min(8, (int) (this.webIndex.seedDB.sizeConnected() * maxDist)), dhtChunk.firstContainer().getWordHash(), dhtChunk.lastContainer().getWordHash(), maxDist);if (seeds.size() < peerCount) {log.logWarning("found not enough (" + seeds.size() + ") peers for distribution for dhtchunk [" + dhtChunk.firstContainer().getWordHash() + " .. " + dhtChunk.lastContainer().getWordHash() + "]");return false;@@ -2537,7 +2547,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.checkInterruption();if (seedIter.hasNext()) {- plasmaDHTTransfer t = new plasmaDHTTransfer(log, webIndex.seedDB, (yacySeed)seedIter.next(), dhtChunk,gzipBody,timeout,retries);+ plasmaDHTTransfer t = new plasmaDHTTransfer(log, webIndex.seedDB, webIndex.peerActions, (yacySeed)seedIter.next(), dhtChunk,gzipBody,timeout,retries);t.start();transfer.add(t);} else {@@ -2609,6 +2619,122 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.crawlQueues.errorURL.push(ee);}+ public void updateMySeed() {+ if (getConfig("peerName", "anomic").equals("anomic")) {+ // generate new peer name+ setConfig("peerName", yacySeed.makeDefaultPeerName());+ }+ webIndex.seedDB.mySeed().put(yacySeed.NAME, getConfig("peerName", "nameless"));+ webIndex.seedDB.mySeed().put(yacySeed.PORT, Integer.toString(serverCore.getPortNr(getConfig("port", "8080"))));++ long uptime = (System.currentTimeMillis() - serverCore.startupTime) / 1000;+ long uptimediff = uptime - lastseedcheckuptime;+ long indexedcdiff = indexedPages - lastindexedPages;+ //double requestcdiff = requestedQueries - lastrequestedQueries;+ if (uptimediff > 300 || uptimediff <= 0 || lastseedcheckuptime == -1 ) {+ lastseedcheckuptime = uptime;+ lastindexedPages = indexedPages;+ lastrequestedQueries = requestedQueries;+ }++ //the speed of indexing (pages/minute) of the peer+ totalPPM = (int) (indexedPages * 60 / Math.max(uptime, 1));+ webIndex.seedDB.mySeed().put(yacySeed.ISPEED, Long.toString(Math.round(Math.max((float) indexedcdiff, 0f) * 60f / Math.max((float) uptimediff, 1f))));+ totalQPM = requestedQueries * 60d / Math.max((double) uptime, 1d);+ webIndex.seedDB.mySeed().put(yacySeed.RSPEED, Double.toString(totalQPM /*Math.max((float) requestcdiff, 0f) * 60f / Math.max((float) uptimediff, 1f)*/ ));++ webIndex.seedDB.mySeed().put(yacySeed.UPTIME, Long.toString(uptime/60)); // the number of minutes that the peer is up in minutes/day (moving average MA30)+ webIndex.seedDB.mySeed().put(yacySeed.LCOUNT, Integer.toString(webIndex.countURL())); // the number of links that the peer has stored (LURL's)+ webIndex.seedDB.mySeed().put(yacySeed.NCOUNT, Integer.toString(crawlQueues.noticeURL.size())); // the number of links that the peer has noticed, but not loaded (NURL's)+ webIndex.seedDB.mySeed().put(yacySeed.RCOUNT, Integer.toString(crawlQueues.noticeURL.stackSize(NoticedURL.STACK_TYPE_LIMIT))); // the number of links that the peer provides for remote crawling (ZURL's)+ webIndex.seedDB.mySeed().put(yacySeed.ICOUNT, Integer.toString(webIndex.size())); // the minimum number of words that the peer has indexed (as it says)+ webIndex.seedDB.mySeed().put(yacySeed.SCOUNT, Integer.toString(webIndex.seedDB.sizeConnected())); // the number of seeds that the peer has stored+ webIndex.seedDB.mySeed().put(yacySeed.CCOUNT, Double.toString(((int) ((webIndex.seedDB.sizeConnected() + webIndex.seedDB.sizeDisconnected() + webIndex.seedDB.sizePotential()) * 60.0 / (uptime + 1.01)) * 100) / 100.0)); // the number of clients that the peer connects (as connects/hour)+ webIndex.seedDB.mySeed().put(yacySeed.VERSION, getConfig("version", ""));+ webIndex.seedDB.mySeed().setFlagDirectConnect(true);+ webIndex.seedDB.mySeed().setLastSeenUTC();+ webIndex.seedDB.mySeed().put(yacySeed.UTC, serverDate.UTCDiffString());+ webIndex.seedDB.mySeed().setFlagAcceptRemoteCrawl(getConfig("crawlResponse", "").equals("true"));+ webIndex.seedDB.mySeed().setFlagAcceptRemoteIndex(getConfig("allowReceiveIndex", "").equals("true"));+ //mySeed.setFlagAcceptRemoteIndex(true);+ }++ public void loadSeedLists() {+ // uses the superseed to initialize the database with known seeds++ yacySeed ys;+ String seedListFileURL;+ yacyURL url;+ ArrayList<String> seedList;+ Iterator<String> enu;+ int lc;+ int sc = webIndex.seedDB.sizeConnected();+ httpHeader header;++ yacyCore.log.logInfo("BOOTSTRAP: " + sc + " seeds known from previous run");++ // - use the superseed to further fill up the seedDB+ int ssc = 0, c = 0;+ while (true) {+ if (Thread.currentThread().isInterrupted()) break;+ seedListFileURL = sb.getConfig("network.unit.bootstrap.seedlist" + c, "");+ if (seedListFileURL.length() == 0) break;+ c++;+ if (+ seedListFileURL.startsWith("http://") ||+ seedListFileURL.startsWith("https://")+ ) {+ // load the seed list+ try {+ httpHeader reqHeader = new httpHeader();+ reqHeader.put(httpHeader.PRAGMA,"no-cache");+ reqHeader.put(httpHeader.CACHE_CONTROL,"no-cache");++ url = new yacyURL(seedListFileURL, null);+ long start = System.currentTimeMillis();+ header = HttpClient.whead(url.toString(), reqHeader);+ long loadtime = System.currentTimeMillis() - start;+ if (header == null) {+ if (loadtime > getConfigLong("bootstrapLoadTimeout", 6000)) {+ yacyCore.log.logWarning("BOOTSTRAP: seed-list URL " + seedListFileURL + " not available, time-out after " + loadtime + " milliseconds");+ } else {+ yacyCore.log.logWarning("BOOTSTRAP: seed-list URL " + seedListFileURL + " not available, no content");+ }+ } else if (header.lastModified() == null) {+ yacyCore.log.logWarning("BOOTSTRAP: seed-list URL " + seedListFileURL + " not usable, last-modified is missing");+ } else if ((header.age() > 86400000) && (ssc > 0)) {+ yacyCore.log.logInfo("BOOTSTRAP: seed-list URL " + seedListFileURL + " too old (" + (header.age() / 86400000) + " days)");+ } else {+ ssc++;+ final byte[] content = HttpClient.wget(url.toString(), reqHeader, null, (int) getConfigLong("bootstrapLoadTimeout", 6000));+ seedList = nxTools.strings(content, "UTF-8");+ enu = seedList.iterator();+ lc = 0;+ while (enu.hasNext()) {+ ys = yacySeed.genRemoteSeed((String) enu.next(), null);+ if ((ys != null) &&+ ((!webIndex.seedDB.mySeedIsDefined()) || (webIndex.seedDB.mySeed().hash != ys.hash))) {+ if (webIndex.peerActions.connectPeer(ys, false)) lc++;+ //seedDB.writeMap(ys.hash, ys.getMap(), "init");+ //System.out.println("BOOTSTRAP: received peer " + ys.get(yacySeed.NAME, "anonymous") + "/" + ys.getAddress());+ //lc++;+ }+ }+ yacyCore.log.logInfo("BOOTSTRAP: " + lc + " seeds from seed-list URL " + seedListFileURL + ", AGE=" + (header.age() / 3600000) + "h");+ }++ } catch (IOException e) {+ // this is when wget fails, commonly because of timeout+ yacyCore.log.logWarning("BOOTSTRAP: failed (1) to load seeds from seed-list URL " + seedListFileURL + ": " + e.getMessage());+ } catch (Exception e) {+ // this is when wget fails; may be because of missing internet connection+ yacyCore.log.logSevere("BOOTSTRAP: failed (2) to load seeds from seed-list URL " + seedListFileURL + ": " + e.getMessage(), e);+ }+ }+ }+ yacyCore.log.logInfo("BOOTSTRAP: " + (webIndex.seedDB.sizeConnected() - sc) + " new seeds while bootstraping.");+ }+public void checkInterruption() throws InterruptedException {Thread curThread = Thread.currentThread();if ((curThread instanceof serverThread) && ((serverThread)curThread).shutdownInProgress()) throw new InterruptedException("Shutdown in progress ...");diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.javaindex d82f0e000..17f3ee32c 100644--- a/source/de/anomic/plasma/plasmaWordIndex.java+++ b/source/de/anomic/plasma/plasmaWordIndex.java@@ -66,6 +66,7 @@ import de.anomic.xml.RSSFeed;import de.anomic.xml.RSSMessage;import de.anomic.yacy.yacyDHTAction;import de.anomic.yacy.yacyNewsPool;+import de.anomic.yacy.yacyPeerActions;import de.anomic.yacy.yacySeedDB;import de.anomic.yacy.yacyURL;@@ -103,7 +104,8 @@ public final class plasmaWordIndex implements indexRI {public CrawlProfile.entry defaultTextSnippetLocalProfile, defaultTextSnippetGlobalProfile;public CrawlProfile.entry defaultMediaSnippetLocalProfile, defaultMediaSnippetGlobalProfile;private File queuesRoot;-+ public yacyPeerActions peerActions;+public plasmaWordIndex(String networkName, serverLog log, File indexPrimaryRoot, File indexSecondaryRoot, int entityCacheMaxSize) {this.log = log;this.primaryRoot = new File(indexPrimaryRoot, networkName);@@ -185,9 +187,12 @@ public final class plasmaWordIndex implements indexRI {new File(networkRoot, "seed.pot.db"),mySeedFile);-+// create or init news databasenewsPool = new yacyNewsPool(networkRoot);++ // deploy peer actions+ this.peerActions = new yacyPeerActions(seedDB, newsPool);}public void clear() {@@ -710,6 +715,7 @@ public final class plasmaWordIndex implements indexRI {newsPool.close();profilesActiveCrawls.close();queuePreStack.close();+ peerActions.close();}public indexContainer deleteContainer(String wordHash) {diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.javaindex 697da408b..cd8d662a0 100644--- a/source/de/anomic/yacy/yacyClient.java+++ b/source/de/anomic/yacy/yacyClient.java@@ -91,7 +91,7 @@ import de.anomic.xml.RSSReader;public final class yacyClient {- public static int publishMySeed(yacySeed mySeed, String address, String otherHash) {+ public static int publishMySeed(yacySeed mySeed, yacyPeerActions peerActions, String address, String otherHash) {// this is called to enrich the seed information by// - own address (if peer is behind a nat/router)// - check peer type (virgin/junior/senior/principal)@@ -214,7 +214,7 @@ public final class yacyClient {if (seedStr.length() > yacySeed.maxsize) {yacyCore.log.logInfo("hello/client: rejected contacting seed; too large (" + seedStr.length() + " > " + yacySeed.maxsize + ")");} else {- if (yacyCore.peerActions.peerArrival(yacySeed.genRemoteSeed(seedStr, salt), (i == 1))) count++;+ if (peerActions.peerArrival(yacySeed.genRemoteSeed(seedStr, salt), (i == 1))) count++;}}return count;@@ -1075,7 +1075,7 @@ public final class yacyClient {try {final plasmaSwitchboard sb = new plasmaSwitchboard(new File(args[0]), "httpProxy.init", "DATA/SETTINGS/yacy.conf", false);/*final yacyCore core =*/ new yacyCore(sb);- yacyCore.peerActions.loadSeedLists();+ sb.loadSeedLists();final yacySeed target = sb.webIndex.seedDB.getConnected(args[1]);final String wordhashe = indexWord.word2hash("test");//System.out.println("permission=" + permissionMessage(args[1]));diff --git a/source/de/anomic/yacy/yacyCore.java b/source/de/anomic/yacy/yacyCore.javaindex ff59ba4df..f599759f2 100644--- a/source/de/anomic/yacy/yacyCore.java+++ b/source/de/anomic/yacy/yacyCore.java@@ -83,7 +83,6 @@ public class yacyCore {// staticspublic static final ThreadGroup publishThreadGroup = new ThreadGroup("publishThreadGroup");public static final HashMap<String, String> seedUploadMethods = new HashMap<String, String>();- public static yacyPeerActions peerActions = null;public static final serverLog log = new serverLog("YACY");public static long lastOnlineTime = 0;/** pseudo-random key derived from a time-interval while YaCy startup*/@@ -121,9 +120,6 @@ public class yacyCore {loadSeedUploadMethods();- // deploy peer actions- peerActions = new yacyPeerActions(sb.webIndex.seedDB, sb);-log.logConfig("CORE INITIALIZED");// ATTENTION, VERY IMPORTANT: before starting the thread, the httpd yacy server must be running!@@ -225,12 +221,12 @@ public class yacyCore {}// before publishing, update some seed data- peerActions.updateMySeed();+ sb.updateMySeed();// publish own seed to other peer, this can every peer, but makes only sense for senior peersif (sb.webIndex.seedDB.sizeConnected() == 0) {// reload the seed lists- peerActions.loadSeedLists();+ sb.loadSeedLists();log.logInfo("re-initialized seed list. received " + sb.webIndex.seedDB.sizeConnected() + " new peer(s)");}final int newSeeds = publishMySeed(false);@@ -273,12 +269,12 @@ public class yacyCore {public final void run() {try {- this.added = yacyClient.publishMySeed(sb.webIndex.seedDB.mySeed(), seed.getClusterAddress(), seed.hash);+ this.added = yacyClient.publishMySeed(sb.webIndex.seedDB.mySeed(), sb.webIndex.peerActions, seed.getClusterAddress(), seed.hash);if (this.added < 0) {// no or wrong response, delete that addressString cause = "peer ping to peer resulted in error response (added < 0)";log.logInfo("publish: disconnected " + this.seed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) + " peer '" + this.seed.getName() + "' from " + this.seed.getPublicAddress() + ": " + cause);- peerActions.peerDeparture(this.seed, cause);+ sb.webIndex.peerActions.peerDeparture(this.seed, cause);} else {// success! we have published our peer to a senior peer// update latest news from the other peer@@ -293,14 +289,14 @@ public class yacyCore {" peer '" + this.seed.getName() + "' at " + this.seed.getPublicAddress() + " with old LastSeen: '" +serverDate.formatShortSecond(new Date(newSeed.getLastSeenUTC())) + "'");newSeed.setLastSeenUTC();- peerActions.peerArrival(newSeed, true);+ sb.webIndex.peerActions.peerArrival(newSeed, true);} else {log.logFine("publish: recently handshaked " + this.seed.get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_SENIOR) +" peer '" + this.seed.getName() + "' at " + this.seed.getPublicAddress() + " with old LastSeen: '" +serverDate.formatShortSecond(new Date(newSeed.getLastSeenUTC())) + "', this is more recent: '" +serverDate.formatShortSecond(new Date(this.seed.getLastSeenUTC())) + "'");this.seed.setLastSeenUTC();- peerActions.peerArrival(this.seed, true);+ sb.webIndex.peerActions.peerArrival(this.seed, true);}}} else {@@ -418,7 +414,7 @@ public class yacyCore {String seederror = seed.isProper();if ((address == null) || (seederror != null)) {// we don't like that address, delete it- peerActions.peerDeparture(seed, "peer ping to peer resulted in address = " + address + "; seederror = " + seederror);+ sb.webIndex.peerActions.peerDeparture(seed, "peer ping to peer resulted in address = " + address + "; seederror = " + seederror);sync.P();} else {// starting a new publisher threaddiff --git a/source/de/anomic/yacy/yacyDHTAction.java b/source/de/anomic/yacy/yacyDHTAction.javaindex daf727861..b3da94476 100644--- a/source/de/anomic/yacy/yacyDHTAction.java+++ b/source/de/anomic/yacy/yacyDHTAction.java@@ -76,6 +76,11 @@ public class yacyDHTAction {}}+ public void close() {+ // the seedDB should be cleared elsewhere+ seedCrawlReady = null;+ }+public Iterator<yacySeed> getDHTSeeds(boolean up, String firstHash, float minVersion) {// enumerates seed-type objects: all seeds with starting point in the middle, rotating at the end/beginningreturn new seedDHTEnum(up, firstHash, minVersion);diff --git a/source/de/anomic/yacy/yacyPeerActions.java b/source/de/anomic/yacy/yacyPeerActions.javaindex 6be57e449..887b37811 100644--- a/source/de/anomic/yacy/yacyPeerActions.java+++ b/source/de/anomic/yacy/yacyPeerActions.java@@ -44,163 +44,38 @@package de.anomic.yacy;import java.io.IOException;-import java.util.ArrayList;import java.util.HashMap;-import java.util.Iterator;--import de.anomic.crawler.NoticedURL;-import de.anomic.http.HttpClient;-import de.anomic.http.httpHeader;-import de.anomic.plasma.plasmaSwitchboard;import de.anomic.server.serverCodings;-import de.anomic.server.serverCore;import de.anomic.server.serverDate;import de.anomic.server.logging.serverLog;-import de.anomic.tools.nxTools;import de.anomic.xml.RSSFeed;import de.anomic.xml.RSSMessage;public class yacyPeerActions {private yacySeedDB seedDB;- private plasmaSwitchboard sb;private HashMap<String, String> userAgents;- public long juniorConnects;- public long seniorConnects;- public long principalConnects;public long disconnects;- private int bootstrapLoadTimeout;public yacyDHTAction dhtAction;+ private yacyNewsPool newsPool;- public yacyPeerActions(yacySeedDB seedDB, plasmaSwitchboard switchboard) {+ public yacyPeerActions(yacySeedDB seedDB, yacyNewsPool newsPool) {this.seedDB = seedDB;- this.sb = switchboard;+ this.newsPool = newsPool;this.userAgents = new HashMap<String, String>();- this.juniorConnects = 0;- this.seniorConnects = 0;- this.principalConnects = 0;this.disconnects = 0;- this.bootstrapLoadTimeout = (int) switchboard.getConfigLong("bootstrapLoadTimeout", 6000);- this.dhtAction = new yacyDHTAction(sb.webIndex.seedDB);- }-- public void updateMySeed() {- if (sb.getConfig("peerName", "anomic").equals("anomic")) {- // generate new peer name- sb.setConfig("peerName", yacySeed.makeDefaultPeerName());- }- seedDB.mySeed().put(yacySeed.NAME, sb.getConfig("peerName", "nameless"));- seedDB.mySeed().put(yacySeed.PORT, Integer.toString(serverCore.getPortNr(sb.getConfig("port", "8080"))));-- long uptime = (System.currentTimeMillis() - serverCore.startupTime) / 1000;- long uptimediff = uptime - sb.lastseedcheckuptime;- long indexedcdiff = sb.indexedPages - sb.lastindexedPages;- //double requestcdiff = sb.requestedQueries - sb.lastrequestedQueries;- if (uptimediff > 300 || uptimediff <= 0 || sb.lastseedcheckuptime == -1 ) {- sb.lastseedcheckuptime = uptime;- sb.lastindexedPages = sb.indexedPages;- sb.lastrequestedQueries = sb.requestedQueries;- }-- //the speed of indexing (pages/minute) of the peer- sb.totalPPM = (int) (sb.indexedPages * 60 / Math.max(uptime, 1));- seedDB.mySeed().put(yacySeed.ISPEED, Long.toString(Math.round(Math.max((float) indexedcdiff, 0f) * 60f / Math.max((float) uptimediff, 1f))));- sb.totalQPM = sb.requestedQueries * 60d / Math.max((double) uptime, 1d);- seedDB.mySeed().put(yacySeed.RSPEED, Double.toString(sb.totalQPM /*Math.max((float) requestcdiff, 0f) * 60f / Math.max((float) uptimediff, 1f)*/ ));-- seedDB.mySeed().put(yacySeed.UPTIME, Long.toString(uptime/60)); // the number of minutes that the peer is up in minutes/day (moving average MA30)- seedDB.mySeed().put(yacySeed.LCOUNT, Integer.toString(sb.webIndex.countURL())); // the number of links that the peer has stored (LURL's)- seedDB.mySeed().put(yacySeed.NCOUNT, Integer.toString(sb.crawlQueues.noticeURL.size())); // the number of links that the peer has noticed, but not loaded (NURL's)- seedDB.mySeed().put(yacySeed.RCOUNT, Integer.toString(sb.crawlQueues.noticeURL.stackSize(NoticedURL.STACK_TYPE_LIMIT))); // the number of links that the peer provides for remote crawling (ZURL's)- seedDB.mySeed().put(yacySeed.ICOUNT, Integer.toString(sb.webIndex.size())); // the minimum number of words that the peer has indexed (as it says)- seedDB.mySeed().put(yacySeed.SCOUNT, Integer.toString(seedDB.sizeConnected())); // the number of seeds that the peer has stored- seedDB.mySeed().put(yacySeed.CCOUNT, Double.toString(((int) ((seedDB.sizeConnected() + seedDB.sizeDisconnected() + seedDB.sizePotential()) * 60.0 / (uptime + 1.01)) * 100) / 100.0)); // the number of clients that the peer connects (as connects/hour)- seedDB.mySeed().put(yacySeed.VERSION, sb.getConfig("version", ""));- seedDB.mySeed().setFlagDirectConnect(true);- seedDB.mySeed().setLastSeenUTC();- seedDB.mySeed().put(yacySeed.UTC, serverDate.UTCDiffString());- seedDB.mySeed().setFlagAcceptRemoteCrawl(sb.getConfig("crawlResponse", "").equals("true"));- seedDB.mySeed().setFlagAcceptRemoteIndex(sb.getConfig("allowReceiveIndex", "").equals("true"));- //mySeed.setFlagAcceptRemoteIndex(true);+ this.dhtAction = new yacyDHTAction(seedDB);}- public void loadSeedLists() {- // uses the superseed to initialize the database with known seeds-- yacySeed ys;- String seedListFileURL;- yacyURL url;- ArrayList<String> seedList;- Iterator<String> enu;- int lc;- int sc = seedDB.sizeConnected();- httpHeader header;-- yacyCore.log.logInfo("BOOTSTRAP: " + sc + " seeds known from previous run");-- // - use the superseed to further fill up the seedDB- int ssc = 0, c = 0;- while (true) {- if (Thread.currentThread().isInterrupted()) break;- seedListFileURL = sb.getConfig("network.unit.bootstrap.seedlist" + c, "");- if (seedListFileURL.length() == 0) break;- c++;- if (- seedListFileURL.startsWith("http://") ||- seedListFileURL.startsWith("https://")- ) {- // load the seed list- try {- httpHeader reqHeader = new httpHeader();- reqHeader.put(httpHeader.PRAGMA,"no-cache");- reqHeader.put(httpHeader.CACHE_CONTROL,"no-cache");-- url = new yacyURL(seedListFileURL, null);- long start = System.currentTimeMillis();- header = HttpClient.whead(url.toString(), reqHeader);- long loadtime = System.currentTimeMillis() - start;- if (header == null) {- if (loadtime > this.bootstrapLoadTimeout) {- yacyCore.log.logWarning("BOOTSTRAP: seed-list URL " + seedListFileURL + " not available, time-out after " + loadtime + " milliseconds");- } else {- yacyCore.log.logWarning("BOOTSTRAP: seed-list URL " + seedListFileURL + " not available, no content");- }- } else if (header.lastModified() == null) {- yacyCore.log.logWarning("BOOTSTRAP: seed-list URL " + seedListFileURL + " not usable, last-modified is missing");- } else if ((header.age() > 86400000) && (ssc > 0)) {- yacyCore.log.logInfo("BOOTSTRAP: seed-list URL " + seedListFileURL + " too old (" + (header.age() / 86400000) + " days)");- } else {- ssc++;- final byte[] content = HttpClient.wget(url.toString(), reqHeader, null, bootstrapLoadTimeout);- seedList = nxTools.strings(content, "UTF-8");- enu = seedList.iterator();- lc = 0;- while (enu.hasNext()) {- ys = yacySeed.genRemoteSeed((String) enu.next(), null);- if ((ys != null) &&- ((!seedDB.mySeedIsDefined()) || (seedDB.mySeed().hash != ys.hash))) {- if (connectPeer(ys, false)) lc++;- //seedDB.writeMap(ys.hash, ys.getMap(), "init");- //System.out.println("BOOTSTRAP: received peer " + ys.get(yacySeed.NAME, "anonymous") + "/" + ys.getAddress());- //lc++;- }- }- yacyCore.log.logInfo("BOOTSTRAP: " + lc + " seeds from seed-list URL " + seedListFileURL + ", AGE=" + (header.age() / 3600000) + "h");- }-- } catch (IOException e) {- // this is when wget fails, commonly because of timeout- yacyCore.log.logWarning("BOOTSTRAP: failed (1) to load seeds from seed-list URL " + seedListFileURL + ": " + e.getMessage());- } catch (Exception e) {- // this is when wget fails; may be because of missing internet connection- yacyCore.log.logSevere("BOOTSTRAP: failed (2) to load seeds from seed-list URL " + seedListFileURL + ": " + e.getMessage(), e);- }- }- }- yacyCore.log.logInfo("BOOTSTRAP: " + (seedDB.sizeConnected() - sc) + " new seeds while bootstraping.");+ public void close() {+ // the seedDB and newsPool should be cleared elsewhere+ if (userAgents != null) userAgents.clear();+ userAgents = null;+ if (dhtAction != null) dhtAction.close();+ dhtAction.close();}-- private synchronized boolean connectPeer(yacySeed seed, boolean direct) {++ public synchronized boolean connectPeer(yacySeed seed, boolean direct) {// store a remote peer's seed// returns true if the peer is new and previously unknownif (seed == null) {@@ -327,10 +202,6 @@ public class yacyPeerActions {// completely new seedyacyCore.log.logFine("connect: saved NEW " + peerType + " peer '" + seed.getName() + "' from " + seed.getPublicAddress());}- if (peerType.equals(yacySeed.PEERTYPE_SENIOR))- this.seniorConnects++; // update statistics- if (peerType.equals(yacySeed.PEERTYPE_PRINCIPAL))- this.principalConnects++; // update statisticsthis.seedDB.addConnected(seed);return true;}@@ -387,7 +258,7 @@ public class yacyPeerActions {return;}try {- synchronized (sb.webIndex.newsPool) {this.sb.webIndex.newsPool.enqueueIncomingNews(record);}+ synchronized (this.newsPool) {this.newsPool.enqueueIncomingNews(record);}} catch (IOException e) {serverLog.logSevere("YACY", "processPeerArrival", e);}diff --git a/source/de/anomic/yacy/yacySearch.java b/source/de/anomic/yacy/yacySearch.javaindex 5357e2f56..abd0f7f5a 100644--- a/source/de/anomic/yacy/yacySearch.java+++ b/source/de/anomic/yacy/yacySearch.java@@ -165,7 +165,7 @@ public class yacySearch extends Thread {//return (yacySeed[]) l.toArray();}- private static yacySeed[] selectSearchTargets(yacySeedDB seedDB, Set<String> wordhashes, int seedcount) {+ private static yacySeed[] selectSearchTargets(yacySeedDB seedDB, yacyPeerActions peerActions, Set<String> wordhashes, int seedcount) {// find out a specific number of seeds, that would be relevant for the given word hash(es)// the result is ordered by relevance: [0] is most relevant// the seedcount is the maximum number of wanted results@@ -185,7 +185,7 @@ public class yacySearch extends Thread {Iterator<String> iter = wordhashes.iterator();while (iter.hasNext()) {wordhash = iter.next();- dhtEnum = yacyCore.peerActions.dhtAction.getDHTSeeds(true, wordhash, (float) 0.0);+ dhtEnum = peerActions.dhtAction.getDHTSeeds(true, wordhash, (float) 0.0);c = seedcount;while (dhtEnum.hasNext() && c > 0) {seed = (yacySeed) dhtEnum.next();@@ -265,7 +265,7 @@ public class yacySearch extends Thread {if (wordIndex.seedDB.mySeed() == null || wordIndex.seedDB.mySeed().getPublicAddress() == null) { return null; }// prepare seed targets and threads- final yacySeed[] targetPeers = (clusterselection == null) ? selectSearchTargets(wordIndex.seedDB, plasmaSearchQuery.hashes2Set(wordhashes), targets) : selectClusterPeers(wordIndex.seedDB, clusterselection);+ final yacySeed[] targetPeers = (clusterselection == null) ? selectSearchTargets(wordIndex.seedDB, wordIndex.peerActions, plasmaSearchQuery.hashes2Set(wordhashes), targets) : selectClusterPeers(wordIndex.seedDB, clusterselection);if (targetPeers == null) return new yacySearch[0];targets = targetPeers.length;if (targets == 0) return new yacySearch[0];