- 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
pull/1/head
orbiter 15 years ago
parent b0927d26e0
commit 90fa8fd4d4

@ -29,6 +29,7 @@ eps = application/postscript
exe = application/octet-stream exe = application/octet-stream
gif = image/gif gif = image/gif
gz = application/gzip gz = application/gzip
gpx = text/xml
hqx = application/mac-binhex40 hqx = application/mac-binhex40
htm = text/html htm = text/html
html = text/html html = text/html

@ -20,6 +20,7 @@
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
import net.yacy.document.content.RSSMessage; import net.yacy.document.content.RSSMessage;
import net.yacy.document.geolocalization.Location; import net.yacy.document.geolocalization.Location;
@ -54,7 +55,7 @@ public class yacysearch_location {
RSSMessage message; RSSMessage message;
int placemarkCounter = 0; int placemarkCounter = 0;
try { try {
loop: while ((message = results.take()) != RSSMessage.POISON) { loop: while ((message = results.poll(maximumTime, TimeUnit.MILLISECONDS)) != RSSMessage.POISON) {
// find all associated locations // find all associated locations
Set<Location> locations = new HashSet<Location>(); Set<Location> locations = new HashSet<Location>();
String words = message.getTitle() + " " + message.getCopyright() + " " + message.getAuthor(); String words = message.getTitle() + " " + message.getCopyright() + " " + message.getAuthor();

@ -738,6 +738,7 @@ public final class HTTPDFileHandler {
path.endsWith("src") || path.endsWith("src") ||
path.endsWith("vcf") || path.endsWith("vcf") ||
path.endsWith("kml") || path.endsWith("kml") ||
path.endsWith("gpx") ||
path.endsWith("/") || path.endsWith("/") ||
path.equals("/robots.txt")) { path.equals("/robots.txt")) {

@ -460,26 +460,24 @@ public final class yacyClient {
public void run() { public void run() {
RSSMessage message; RSSMessage message;
while (timeout > 0 && maximumRecords > 0) { mainloop: while (timeout > 0 && maximumRecords > 0) {
long st = System.currentTimeMillis(); long st = System.currentTimeMillis();
RSSFeed feed = search(urlBase, query, verify, global, timeout, startRecord, recordsPerSession); RSSFeed feed = search(urlBase, query, verify, global, timeout, startRecord, recordsPerSession);
if (feed == null || feed.isEmpty()) { if (feed == null || feed.isEmpty()) break mainloop;
try { queue.put(RSSMessage.POISON); } catch (InterruptedException e) {}
return;
}
maximumRecords -= feed.size(); maximumRecords -= feed.size();
loop: while (!feed.isEmpty()) { innerloop: while (!feed.isEmpty()) {
message = feed.pollMessage(); message = feed.pollMessage();
if (message == null) break loop; if (message == null) break innerloop;
try { try {
queue.put(message); queue.put(message);
} catch (InterruptedException e) { } catch (InterruptedException e) {
break loop; break innerloop;
} }
} }
startRecord += recordsPerSession; startRecord += recordsPerSession;
timeout -= System.currentTimeMillis() - st; timeout -= System.currentTimeMillis() - st;
} }
try { queue.put(RSSMessage.POISON); } catch (InterruptedException e) {}
} }
} }

Loading…
Cancel
Save