diff --git a/source/net/filebot/CachedResource2.java b/source/net/filebot/CachedResource2.java index 70ff36ad..727b0877 100644 --- a/source/net/filebot/CachedResource2.java +++ b/source/net/filebot/CachedResource2.java @@ -15,7 +15,7 @@ import net.filebot.web.WebRequest; import org.w3c.dom.Document; -public class CachedResource2 implements Resource { +public class CachedResource2 { public static final int DEFAULT_RETRY_LIMIT = 2; public static final Duration DEFAULT_RETRY_DELAY = Duration.ofSeconds(2); @@ -50,7 +50,6 @@ public class CachedResource2 implements Resource { this.cache = cache; } - @Override public synchronized R get() throws Exception { Object value = cache.computeIfStale(key, expirationTime, element -> { URL resource = source.source(key); diff --git a/source/net/filebot/Resource.java b/source/net/filebot/Resource.java deleted file mode 100644 index 6e7fe158..00000000 --- a/source/net/filebot/Resource.java +++ /dev/null @@ -1,8 +0,0 @@ -package net.filebot; - -@FunctionalInterface -public interface Resource { - - R get() throws Exception; - -} diff --git a/source/net/filebot/web/TVMazeClient.java b/source/net/filebot/web/TVMazeClient.java index 532eeabe..feaf92f9 100644 --- a/source/net/filebot/web/TVMazeClient.java +++ b/source/net/filebot/web/TVMazeClient.java @@ -15,7 +15,6 @@ import javax.swing.Icon; import net.filebot.Cache; import net.filebot.CacheType; -import net.filebot.Resource; import net.filebot.ResourceManager; public class TVMazeClient extends AbstractEpisodeListProvider { @@ -113,8 +112,7 @@ public class TVMazeClient extends AbstractEpisodeListProvider { protected Object request(String resource) throws Exception { Cache cache = Cache.getCache(getName(), CacheType.Monthly); - Resource json = cache.json(resource, s -> getResource(resource), Cache.ONE_DAY); - return json.get(); + return cache.json(resource, s -> getResource(resource), Cache.ONE_DAY).get(); } protected URL getResource(String resource) throws Exception { diff --git a/source/net/filebot/web/TheTVDBClient.java b/source/net/filebot/web/TheTVDBClient.java index 82ea0d7c..6c2a88ab 100644 --- a/source/net/filebot/web/TheTVDBClient.java +++ b/source/net/filebot/web/TheTVDBClient.java @@ -28,7 +28,6 @@ import javax.swing.Icon; import net.filebot.Cache; import net.filebot.CacheType; -import net.filebot.Resource; import net.filebot.ResourceManager; import net.filebot.util.FileUtilities; import net.filebot.web.TheTVDBClient.BannerDescriptor.BannerProperty; @@ -301,8 +300,7 @@ public class TheTVDBClient extends AbstractEpisodeListProvider { protected Document getXmlResource(MirrorType mirror, String resource) throws Exception { Cache cache = Cache.getCache(getName(), CacheType.Monthly); - Resource xml = cache.xml(resource, s -> getResource(mirror, s), Cache.ONE_DAY); - return xml.get(); + return cache.xml(resource, s -> getResource(mirror, s), Cache.ONE_DAY).get(); } protected URL getResource(MirrorType mirror, String path) throws Exception {