[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [metrics-lib/release] Make the reader thread a daemon thread.



commit 74ee2145eedacb61b14e9c234b8f4266710e5eb9
Author: iwakeh <iwakeh@xxxxxxxxxxxxxx>
Date:   Tue Oct 25 12:33:24 2016 +0200

    Make the reader thread a daemon thread.
---
 CHANGELOG.md                                                          | 4 ++++
 .../java/org/torproject/descriptor/impl/DescriptorReaderImpl.java     | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index afaa1e8..755428d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,10 @@
      process.
    - Avoid deleting extraneous local descriptor files when collecting
      descriptors from CollecTor.
+   - Turn the descriptor reader thread into a daemon thread, so that
+     the application can decide at any time to stop consuming
+     descriptors without having to worry about the reader thread not
+     being done.
 
 
 # Changes in version 1.5.0 - 2016-10-19
diff --git a/src/main/java/org/torproject/descriptor/impl/DescriptorReaderImpl.java b/src/main/java/org/torproject/descriptor/impl/DescriptorReaderImpl.java
index cb14588..12d73ad 100644
--- a/src/main/java/org/torproject/descriptor/impl/DescriptorReaderImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/DescriptorReaderImpl.java
@@ -153,7 +153,9 @@ public class DescriptorReaderImpl implements DescriptorReader {
         this.tarballs, descriptorQueue, this.autoSaveHistoryFile,
         this.manualSaveHistoryFile, this.excludedFiles,
         this.failUnrecognizedDescriptorLines);
-    new Thread(this.reader).start();
+    Thread readerThread = new Thread(this.reader);
+    readerThread.setDaemon(true);
+    readerThread.start();
     return descriptorQueue;
   }
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits