From: David ‘Bombe’ Roden Date: Sat, 16 Oct 2010 10:00:38 +0000 (+0200) Subject: Always download Sones in an own thread. X-Git-Tag: 0.1-RC1~278 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=a7dcf848a480ab879b25976c79e4f46b65022949;p=Sone.git Always download Sones in an own thread. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 94d1169..6225087 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -308,17 +308,24 @@ public class Core extends AbstractService { * @param requestUri * The request URI to load the Sone from */ - public void loadSone(String requestUri) { - try { - FreenetURI realRequestUri = new FreenetURI(requestUri).setMetaString(new String[] { "sone.xml" }); - FetchResult fetchResult = freenetInterface.fetchUri(realRequestUri); - Sone parsedSone = soneDownloader.parseSone(null, fetchResult, realRequestUri); - if (parsedSone != null) { - addSone(parsedSone); + public void loadSone(final String requestUri) { + new Thread(new Runnable() { + + @Override + @SuppressWarnings("synthetic-access") + public void run() { + try { + FreenetURI realRequestUri = new FreenetURI(requestUri).setMetaString(new String[] { "sone.xml" }); + FetchResult fetchResult = freenetInterface.fetchUri(realRequestUri); + Sone parsedSone = soneDownloader.parseSone(null, fetchResult, realRequestUri); + if (parsedSone != null) { + addSone(parsedSone); + } + } catch (MalformedURLException mue1) { + logger.log(Level.INFO, "Could not create URI from “" + requestUri + "”.", mue1); + } } - } catch (MalformedURLException mue1) { - logger.log(Level.INFO, "Could not create URI from “" + requestUri + "”.", mue1); - } + }, "Sone Downloader").start(); } /**