reverted change of search event processing in SVN 5460. The new code did not work properly,

it gave remote search requests too less time


git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5479 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent c7c291bc6b
commit a6b29cf72c

@ -555,6 +555,7 @@ public final class plasmaSearchEvent {
serverLog.logInfo("search", "sorted out hash " + urlhash + " during search: " + reason); serverLog.logInfo("search", "sorted out hash " + urlhash + " during search: " + reason);
} }
/*
public ResultEntry oneResult(final int item) { public ResultEntry oneResult(final int item) {
return oneResult(item, System.currentTimeMillis() + 100); return oneResult(item, System.currentTimeMillis() + 100);
} }
@ -598,6 +599,46 @@ public final class plasmaSearchEvent {
if (this.result.size() <= item) return null; if (this.result.size() <= item) return null;
return this.result.element(item).element; return this.result.element(item).element;
} }
*/
public ResultEntry oneResult(final int item) {
// check if we already retrieved this item (happens if a search
// pages is accessed a second time)
serverProfiling.update("SEARCH", new plasmaProfiling.searchEvent(query.id(true), "obtain one result entry - start", 0, 0));
if (this.result.sizeStore() > item) {
// we have the wanted result already in the result array .. return that
return this.result.element(item).element;
}
if ((query.domType == plasmaSearchQuery.SEARCHDOM_GLOBALDHT) ||
(query.domType == plasmaSearchQuery.SEARCHDOM_CLUSTERALL)) {
// this is a search using remote search threads. Also the local
// search thread is started as background process
if ((localSearchThread != null) && (localSearchThread.isAlive())) {
// in case that the local search takes longer than some other
// remote search requests, do some sleeps to give the local process
// a chance to contribute
try {Thread.sleep(item * 50L);} catch (final InterruptedException e) {}
}
// now wait until as many remote worker threads have finished, as we
// want to display results
while (this.primarySearchThreads != null &&
this.primarySearchThreads.length > item &&
anyWorkerAlive() &&
(result.size() <= item || countFinishedRemoteSearch() <= item)) {
try {Thread.sleep(item * 50L);} catch (final InterruptedException e) {}
}
}
// finally wait until enough results are there produced from the
// snippet fetch process
while ((anyWorkerAlive()) && (result.size() <= item)) {
try {Thread.sleep(item * 50L);} catch (final InterruptedException e) {}
}
// finally, if there is something, return the result
if (this.result.size() <= item) return null;
return this.result.element(item).element;
}
private int resultCounter = 0; private int resultCounter = 0;
public ResultEntry nextResult() { public ResultEntry nextResult() {

@ -42,7 +42,7 @@ import de.anomic.plasma.plasmaSwitchboard;
public class serverDomains { public class serverDomains {
private static final String localPatterns = "10.*,127.*,172.16.*,169.254.*,192.168.*,localhost"; private static final String localPatterns = "10\\..*,127.*,172.(1[6-9]|2[0-9]|3[0-1])\\..*,169.254.*,192.168.*,localhost";
// a dns cache // a dns cache
private static final Map<String, InetAddress> nameCacheHit = new ConcurrentHashMap<String, InetAddress>(); // a not-synchronized map resulted in deadlocks private static final Map<String, InetAddress> nameCacheHit = new ConcurrentHashMap<String, InetAddress>(); // a not-synchronized map resulted in deadlocks

Loading…
Cancel
Save