You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2014/06/09 15:48:25 UTC
[20/32] git commit: STORM-297: give timer thread a meaningful name
STORM-297: give timer thread a meaningful name
Project: http://git-wip-us.apache.org/repos/asf/incubator-storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-storm/commit/04b4907e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-storm/tree/04b4907e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-storm/diff/04b4907e
Branch: refs/heads/master
Commit: 04b4907e10c152072dcb1fcdae9d0198d7dc9603
Parents: f18d98f
Author: Sean Zhong <cl...@gmail.com>
Authored: Tue May 20 22:10:43 2014 +0800
Committer: Sean Zhong <cl...@gmail.com>
Committed: Tue May 20 22:10:43 2014 +0800
----------------------------------------------------------------------
storm-core/src/clj/backtype/storm/daemon/worker.clj | 15 ++++++++-------
storm-core/src/clj/backtype/storm/timer.clj | 5 +++--
2 files changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/04b4907e/storm-core/src/clj/backtype/storm/daemon/worker.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/daemon/worker.clj b/storm-core/src/clj/backtype/storm/daemon/worker.clj
index 2648237..437e8dd 100644
--- a/storm-core/src/clj/backtype/storm/daemon/worker.clj
+++ b/storm-core/src/clj/backtype/storm/daemon/worker.clj
@@ -165,11 +165,12 @@
;; actually just do it via interfaces. just need to make sure to hide setResource from tasks
{})
-(defn mk-halting-timer []
+(defn mk-halting-timer [timer-name]
(mk-timer :kill-fn (fn [t]
(log-error t "Error when processing event")
(halt-process! 20 "Error when processing an event")
- )))
+ )
+ :timer-name timer-name))
(defn worker-data [conf mq-context storm-id assignment-id port worker-id]
(let [cluster-state (cluster/mk-distributed-cluster-state conf)
@@ -202,11 +203,11 @@
:storm-conf storm-conf
:topology topology
:system-topology (system-topology! storm-conf topology)
- :heartbeat-timer (mk-halting-timer)
- :refresh-connections-timer (mk-halting-timer)
- :refresh-active-timer (mk-halting-timer)
- :executor-heartbeat-timer (mk-halting-timer)
- :user-timer (mk-halting-timer)
+ :heartbeat-timer (mk-halting-timer "heartbeat-timer")
+ :refresh-connections-timer (mk-halting-timer "refresh-connections-timer")
+ :refresh-active-timer (mk-halting-timer "refresh-active-timer")
+ :executor-heartbeat-timer (mk-halting-timer "executor-heartbeat-timer")
+ :user-timer (mk-halting-timer "user-timer")
:task->component (HashMap. (storm-task-info topology storm-conf)) ; for optimized access when used in tasks later on
:component->stream->fields (component->stream->fields (:system-topology <>))
:component->sorted-tasks (->> (:task->component <>) reverse-map (map-val sort))
http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/04b4907e/storm-core/src/clj/backtype/storm/timer.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/timer.clj b/storm-core/src/clj/backtype/storm/timer.clj
index 78b1f1c..9c5a99f 100644
--- a/storm-core/src/clj/backtype/storm/timer.clj
+++ b/storm-core/src/clj/backtype/storm/timer.clj
@@ -23,7 +23,7 @@
;; The timer defined in this file is very similar to java.util.Timer, except it integrates with
;; Storm's time simulation capabilities. This lets us test code that does asynchronous work on the timer thread
-(defnk mk-timer [:kill-fn (fn [& _] )]
+(defnk mk-timer [:kill-fn (fn [& _] ) :timer-name nil]
(let [queue (PriorityQueue. 10
(reify Comparator
(compare [this o1 o2]
@@ -35,6 +35,7 @@
active (atom true)
lock (Object.)
notifier (Semaphore. 0)
+ thread-name (if timer-name timer-name "timer")
timer-thread (Thread.
(fn []
(while @active
@@ -63,7 +64,7 @@
(reset! active false)
(throw t))
)))
- (.release notifier)))]
+ (.release notifier)) thread-name)]
(.setDaemon timer-thread true)
(.setPriority timer-thread Thread/MAX_PRIORITY)
(.start timer-thread)