forked from j62/ctbrec
Code cleanup
This commit is contained in:
parent
d8e78bb910
commit
abef15a5f7
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue