Download new Sones in a background thread.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 16 Oct 2010 03:07:39 +0000 (05:07 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 16 Oct 2010 03:07:39 +0000 (05:07 +0200)
src/main/java/net/pterodactylus/sone/web/AddSonePage.java

index 647a635..92b9407 100644 (file)
@@ -48,8 +48,17 @@ public class AddSonePage extends SoneTemplatePage {
        @Override
        protected void processTemplate(Request request, Template template) throws RedirectException {
                super.processTemplate(request, template);
-               String soneKey = request.getHttpRequest().getPartAsStringFailsafe("request-uri", 256);
-               webInterface.core().loadSone(soneKey);
+               final String soneKey = request.getHttpRequest().getPartAsStringFailsafe("request-uri", 256);
+               new Thread(new Runnable() {
+
+                       /**
+                        * {@inheritDoc}
+                        */
+                       @Override
+                       public void run() {
+                               webInterface.core().loadSone(soneKey);
+                       }
+               }, "Sone Downloader").start();
        }
 
 }