* cleanup
This commit is contained in:
parent
a2c84e22dc
commit
af511aef7a
|
@ -17,10 +17,6 @@ public class CachedJsonResource extends AbstractCachedResource<String, String> {
|
|||
super(resource, String.class, ONE_DAY, 2, 1000);
|
||||
}
|
||||
|
||||
public CachedJsonResource(String resource, long expirationTime, int retryCountLimit, long retryWaitTime) {
|
||||
super(resource, String.class, expirationTime, retryCountLimit, retryWaitTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Cache getCache() {
|
||||
return CacheManager.getInstance().getCache("web-datasource-lv3");
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
package net.filebot.web;
|
||||
|
||||
import static net.filebot.util.FileUtilities.*;
|
||||
import static net.filebot.web.WebRequest.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.net.URL;
|
||||
|
||||
import net.sf.ehcache.Cache;
|
||||
import net.sf.ehcache.CacheManager;
|
||||
|
||||
public class CachedPage extends AbstractCachedResource<String, String> {
|
||||
|
||||
public CachedPage(URL url) {
|
||||
super(url.toString(), String.class, ONE_DAY, 0, 0); // 24h update interval
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Cache getCache() {
|
||||
return CacheManager.getInstance().getCache("web-datasource");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String process(String data) throws Exception {
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String fetchData(URL url, long lastModified) throws IOException {
|
||||
return readAll(openConnection(url));
|
||||
}
|
||||
|
||||
protected Reader openConnection(URL url) throws IOException {
|
||||
return getReader(url.openConnection());
|
||||
}
|
||||
|
||||
}
|
|
@ -10,10 +10,6 @@ import net.sf.ehcache.CacheManager;
|
|||
|
||||
public abstract class CachedResource<T extends Serializable> extends AbstractCachedResource<ByteBuffer, T> {
|
||||
|
||||
public CachedResource(String resource, Class<T> type) {
|
||||
this(resource, type, Long.MAX_VALUE);
|
||||
}
|
||||
|
||||
public CachedResource(String resource, Class<T> type, long expirationTime) {
|
||||
this(resource, type, expirationTime, 2, 1000); // 3 retries in 1s intervals by default
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.io.IOException;
|
|||
import java.io.StringReader;
|
||||
import java.net.URL;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
|
@ -23,10 +23,6 @@ public class CachedXmlResource extends AbstractCachedResource<String, String> {
|
|||
super(resource, String.class, ONE_DAY, 2, 1000);
|
||||
}
|
||||
|
||||
public CachedXmlResource(String resource, long expirationTime, int retryCountLimit, long retryWaitTime) {
|
||||
super(resource, String.class, expirationTime, retryCountLimit, retryWaitTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Cache getCache() {
|
||||
return CacheManager.getInstance().getCache("web-datasource-lv3");
|
||||
|
@ -65,7 +61,7 @@ public class CachedXmlResource extends AbstractCachedResource<String, String> {
|
|||
if (data == null)
|
||||
return null; // not modified
|
||||
|
||||
return Charset.forName("UTF-8").decode(data).toString();
|
||||
return StandardCharsets.UTF_8.decode(data).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class FanartTVClient {
|
|||
String resource = getResource(category, id);
|
||||
|
||||
// cache results
|
||||
CachedResource<FanartDescriptor[]> data = new CachedResource<FanartDescriptor[]>(resource, FanartDescriptor[].class) {
|
||||
CachedResource<FanartDescriptor[]> data = new CachedResource<FanartDescriptor[]>(resource, FanartDescriptor[].class, CachedResource.ONE_WEEK) {
|
||||
|
||||
@Override
|
||||
public FanartDescriptor[] process(ByteBuffer data) throws Exception {
|
||||
|
|
Loading…
Reference in New Issue