Use fetch action instead of custom Runnable.
[Sone.git] / src / main / java / net / pterodactylus / sone / core / FreenetInterface.java
index 9ccf5fc..5dd8fbf 100644 (file)
@@ -39,6 +39,7 @@ import com.db4o.ObjectContainer;
 import com.google.common.base.Function;
 import com.google.common.eventbus.EventBus;
 import com.google.inject.Inject;
+import com.google.inject.Singleton;
 
 import freenet.client.ClientMetadata;
 import freenet.client.FetchException;
@@ -66,6 +67,7 @@ import freenet.support.io.ArrayBucket;
  *
  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
  */
+@Singleton
 public class FreenetInterface {
 
        /** The logger. */
@@ -200,13 +202,7 @@ public class FreenetInterface {
                                        logger.log(Level.FINE, String.format("Found USK update for Sone “%s” at %s, new known good: %s, new slot too: %s.", sone, key, newKnownGood, newSlotToo));
                                        if (edition > sone.getLatestEdition()) {
                                                sone.setLatestEdition(edition);
-                                               new Thread(new Runnable() {
-
-                                                       @Override
-                                                       public void run() {
-                                                               soneDownloader.fetchSone(sone);
-                                                       }
-                                               }, "Sone Downloader").start();
+                                               new Thread(soneDownloader.fetchSoneAction(sone), "Sone Downloader").start();
                                        }
                                }