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.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.stream.Collectors;
import org.jsoup.nodes.Element;
@ -28,20 +27,17 @@ import okhttp3.Response;
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 boolean showOnline = true;
public Cam4FollowedUpdateService(Cam4 site) {
this.site = site;
ExecutorService executor = Executors.newSingleThreadExecutor(new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread t = new Thread(r);
t.setDaemon(true);
t.setName("ThumbOverviewTab UpdateService");
return t;
}
ExecutorService executor = Executors.newSingleThreadExecutor(r -> {
Thread t = new Thread(r);
t.setDaemon(true);
t.setName("ThumbOverviewTab UpdateService");
return t;
});
setExecutor(executor);
}
@ -75,7 +71,11 @@ public class Cam4FollowedUpdateService extends PaginatedScheduledService {
.filter(m -> {
try {
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);
return false;
}