X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=inline;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FCore.java;h=00594c9cd799f3e0cdb44b5cbab2ff35645b0f70;hb=f04178199732093e3e0b74a9243ac2fc0da8ea52;hp=b838216860d0593ac5a8d6badf959cb63d067a33;hpb=358a9a2ab0ead0cc4dd86e3b97fa387ec958ec01;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index b838216..00594c9 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -308,14 +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); - soneDownloader.parseSone(null, fetchResult, realRequestUri); - } catch (MalformedURLException mue1) { - logger.log(Level.INFO, "Could not create URI from “" + requestUri + "”.", mue1); - } + 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); + } + } + }, "Sone Downloader").start(); } /** @@ -483,7 +493,7 @@ public class Core extends AbstractService { String friendKey = configuration.getStringValue(friendPrefix + "/Key").getValue(null); String friendName = configuration.getStringValue(friendPrefix + "/Name").getValue(null); friendSone.setRequestUri(new FreenetURI(friendKey)).setName(friendName); - soneDownloader.addSone(friendSone); + loadSone(friendKey); sone.addFriend(friendSone); }