From 90fa8fd4d4b3910453d50fc7fc55da6357f6786a Mon Sep 17 00:00:00 2001 From: orbiter Date: Wed, 12 May 2010 08:49:20 +0000 Subject: [PATCH] - support gpx file extension - non-blocking location search (time-out handling was wrong) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6871 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- defaults/httpd.mime | 1 + htroot/yacysearch_location.java | 3 ++- source/de/anomic/http/server/HTTPDFileHandler.java | 1 + source/de/anomic/yacy/yacyClient.java | 14 ++++++-------- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/defaults/httpd.mime b/defaults/httpd.mime index 9dabb1c70..8838cccb5 100644 --- a/defaults/httpd.mime +++ b/defaults/httpd.mime @@ -29,6 +29,7 @@ eps = application/postscript exe = application/octet-stream gif = image/gif gz = application/gzip +gpx = text/xml hqx = application/mac-binhex40 htm = text/html html = text/html diff --git a/htroot/yacysearch_location.java b/htroot/yacysearch_location.java index 8a6e22a1e..7786bb254 100644 --- a/htroot/yacysearch_location.java +++ b/htroot/yacysearch_location.java @@ -20,6 +20,7 @@ import java.util.HashSet; import java.util.Set; import java.util.concurrent.BlockingQueue; +import java.util.concurrent.TimeUnit; import net.yacy.document.content.RSSMessage; import net.yacy.document.geolocalization.Location; @@ -54,7 +55,7 @@ public class yacysearch_location { RSSMessage message; int placemarkCounter = 0; try { - loop: while ((message = results.take()) != RSSMessage.POISON) { + loop: while ((message = results.poll(maximumTime, TimeUnit.MILLISECONDS)) != RSSMessage.POISON) { // find all associated locations Set locations = new HashSet(); String words = message.getTitle() + " " + message.getCopyright() + " " + message.getAuthor(); diff --git a/source/de/anomic/http/server/HTTPDFileHandler.java b/source/de/anomic/http/server/HTTPDFileHandler.java index 5bba6422d..e73692b50 100644 --- a/source/de/anomic/http/server/HTTPDFileHandler.java +++ b/source/de/anomic/http/server/HTTPDFileHandler.java @@ -738,6 +738,7 @@ public final class HTTPDFileHandler { path.endsWith("src") || path.endsWith("vcf") || path.endsWith("kml") || + path.endsWith("gpx") || path.endsWith("/") || path.equals("/robots.txt")) { diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.java index e62d6313b..6b02612e9 100644 --- a/source/de/anomic/yacy/yacyClient.java +++ b/source/de/anomic/yacy/yacyClient.java @@ -460,26 +460,24 @@ public final class yacyClient { public void run() { RSSMessage message; - while (timeout > 0 && maximumRecords > 0) { + mainloop: while (timeout > 0 && maximumRecords > 0) { long st = System.currentTimeMillis(); RSSFeed feed = search(urlBase, query, verify, global, timeout, startRecord, recordsPerSession); - if (feed == null || feed.isEmpty()) { - try { queue.put(RSSMessage.POISON); } catch (InterruptedException e) {} - return; - } + if (feed == null || feed.isEmpty()) break mainloop; maximumRecords -= feed.size(); - loop: while (!feed.isEmpty()) { + innerloop: while (!feed.isEmpty()) { message = feed.pollMessage(); - if (message == null) break loop; + if (message == null) break innerloop; try { queue.put(message); } catch (InterruptedException e) { - break loop; + break innerloop; } } startRecord += recordsPerSession; timeout -= System.currentTimeMillis() - st; } + try { queue.put(RSSMessage.POISON); } catch (InterruptedException e) {} } }