Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
package com.apptasticsoftware.rssreader;

import com.apptasticsoftware.rssreader.util.Mapper;
import com.apptasticsoftware.rssreader.util.DaemonThreadFactory;

import javax.net.ssl.SSLContext;
import javax.xml.stream.XMLInputFactory;
Expand Down Expand Up @@ -64,7 +65,7 @@
*/
public abstract class AbstractRssReader<C extends Channel, I extends Item> {
private static final String LOG_GROUP = "com.apptasticsoftware.rssreader";
private static final ScheduledThreadPoolExecutor EXECUTOR = new ScheduledThreadPoolExecutor(1);
private static final ScheduledExecutorService EXECUTOR = new ScheduledThreadPoolExecutor(1, new DaemonThreadFactory("RssReaderWorker"));
private final HttpClient httpClient;
private DateTimeParser dateTimeParser = new DateTime();
private String userAgent = "";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.apptasticsoftware.rssreader.util;

import java.util.concurrent.ThreadFactory;

/**
* Thread factory that creates daemon threads
*/
public class DaemonThreadFactory implements ThreadFactory {
private final String name;
private int counter;

public DaemonThreadFactory(String name) {
this.name = name;
}

@Override
public Thread newThread(Runnable r) {
Thread t = new Thread(r, name + "-" + counter++);
t.setDaemon(true);
return t;
}

}