jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [2/2] jena git commit: JENA-1162 : Use daemon threads for AlarmClocks.
Date Thu, 07 Apr 2016 22:15:42 GMT
JENA-1162 : Use daemon threads for AlarmClocks.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/0f1babe5
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/0f1babe5
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/0f1babe5

Branch: refs/heads/master
Commit: 0f1babe52663133cb05d49e5b14e6ea01e9edb7c
Parents: 0c938ec
Author: Andy Seaborne <andy@apache.org>
Authored: Thu Apr 7 23:15:27 2016 +0100
Committer: Andy Seaborne <andy@apache.org>
Committed: Thu Apr 7 23:15:27 2016 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/jena/atlas/lib/AlarmClock.java  | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/0f1babe5/jena-base/src/main/java/org/apache/jena/atlas/lib/AlarmClock.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/AlarmClock.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/AlarmClock.java
index 8272fe0..3d0d485 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/AlarmClock.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/lib/AlarmClock.java
@@ -20,13 +20,22 @@ package org.apache.jena.atlas.lib ;
 
 import java.util.concurrent.* ;
 
+import org.apache.commons.lang3.concurrent.BasicThreadFactory ;
+
 /**
  * An AlarmClock is an object that will make a callback (with a value) at a
  * preset time. Simple abstraction of add/reset/cancel of a Runnable. Currently,
  * backed by {@link ScheduledThreadPoolExecutor}
  */
 public class AlarmClock {
-    private ScheduledThreadPoolExecutor timer = new ScheduledThreadPoolExecutor(1) ;
+    // A ThreadFactory that creates daemons
+    private static ThreadFactory threadFactory = new BasicThreadFactory.Builder()
+        .daemon(true)
+        .namingPattern("alarm-clock-")
+        //.uncaughtExceptionHandler(null)
+        .build() ;
+    
+    private ScheduledThreadPoolExecutor timer = new ScheduledThreadPoolExecutor(1, threadFactory)
;
 
     /* package */AlarmClock() {}
 


Mime
View raw message