File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
src/main/java/com/apptasticsoftware/rssreader Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 24
24
package com .apptasticsoftware .rssreader ;
25
25
26
26
import com .apptasticsoftware .rssreader .util .Mapper ;
27
+ import com .apptasticsoftware .rssreader .util .DaemonThreadFactory ;
27
28
28
29
import javax .net .ssl .SSLContext ;
29
30
import javax .xml .stream .XMLInputFactory ;
64
65
*/
65
66
public abstract class AbstractRssReader <C extends Channel , I extends Item > {
66
67
private static final String LOG_GROUP = "com.apptasticsoftware.rssreader" ;
67
- private static final ScheduledThreadPoolExecutor EXECUTOR = new ScheduledThreadPoolExecutor (1 );
68
+ private static final ScheduledExecutorService EXECUTOR = new ScheduledThreadPoolExecutor (1 , new DaemonThreadFactory ( "RssReaderWorker" ) );
68
69
private final HttpClient httpClient ;
69
70
private DateTimeParser dateTimeParser = new DateTime ();
70
71
private String userAgent = "" ;
Original file line number Diff line number Diff line change
1
+ package com .apptasticsoftware .rssreader .util ;
2
+
3
+ import java .util .concurrent .ThreadFactory ;
4
+
5
+ /**
6
+ * Thread factory that creates daemon threads
7
+ */
8
+ public class DaemonThreadFactory implements ThreadFactory {
9
+ private final String name ;
10
+ private int counter ;
11
+
12
+ public DaemonThreadFactory (String name ) {
13
+ this .name = name ;
14
+ }
15
+
16
+ @ Override
17
+ public Thread newThread (Runnable r ) {
18
+ Thread t = new Thread (r , name + "-" + counter ++);
19
+ t .setDaemon (true );
20
+ return t ;
21
+ }
22
+
23
+ }
You can’t perform that action at this time.
0 commit comments