forked from j62/ctbrec
1
0
Fork 0

Code cleanup

This commit is contained in:
0xboobface 2019-12-31 12:53:50 +01:00
parent d8e78bb910
commit abef15a5f7
1 changed files with 11 additions and 11 deletions

View File

@ -6,7 +6,6 @@ import java.util.List;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;
@ -28,20 +27,17 @@ import okhttp3.Response;
public class Cam4FollowedUpdateService extends PaginatedScheduledService { public class Cam4FollowedUpdateService extends PaginatedScheduledService {
private static final transient Logger LOG = LoggerFactory.getLogger(Cam4FollowedUpdateService.class); private static final Logger LOG = LoggerFactory.getLogger(Cam4FollowedUpdateService.class);
private Cam4 site; private Cam4 site;
private boolean showOnline = true; private boolean showOnline = true;
public Cam4FollowedUpdateService(Cam4 site) { public Cam4FollowedUpdateService(Cam4 site) {
this.site = site; this.site = site;
ExecutorService executor = Executors.newSingleThreadExecutor(new ThreadFactory() { ExecutorService executor = Executors.newSingleThreadExecutor(r -> {
@Override Thread t = new Thread(r);
public Thread newThread(Runnable r) { t.setDaemon(true);
Thread t = new Thread(r); t.setName("ThumbOverviewTab UpdateService");
t.setDaemon(true); return t;
t.setName("ThumbOverviewTab UpdateService");
return t;
}
}); });
setExecutor(executor); setExecutor(executor);
} }
@ -75,7 +71,11 @@ public class Cam4FollowedUpdateService extends PaginatedScheduledService {
.filter(m -> { .filter(m -> {
try { try {
return m.isOnline() == showOnline; return m.isOnline() == showOnline;
} catch (IOException | ExecutionException | InterruptedException e) { } catch (IOException | ExecutionException e) {
LOG.error("Couldn't determine online state", e);
return false;
} catch(InterruptedException e) {
Thread.currentThread().interrupt();
LOG.error("Couldn't determine online state", e); LOG.error("Couldn't determine online state", e);
return false; return false;
} }