Skip to content

Loading…

threads are mutable. .setPriority and .setDaemon return nil. Fixing so t... #3

Merged
merged 1 commit into from

2 participants

@timewarrior

Hi
Just fixed a bug, where threads were dying because java thread is mutable and .setPriority and .setDaemon were returning nil.

Thanks
Anand

@niclasmeier niclasmeier merged commit 8212910 into HEROLABS:master
@timewarrior

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 4, 2012
  1. @timewarrior

    threads are mutable. .setPriority and .setDaemon return nil. Fixing s…

    timewarrior committed
    …o that correct object is returned
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/herolabs/apns/push.clj
View
6 src/herolabs/apns/push.clj
@@ -28,9 +28,9 @@
sm (System/getSecurityManager)
group (if sm (.getThreadGroup sm) (.getThreadGroup (Thread/currentThread)))]
(reify ThreadFactory
- (newThread [_ r] (let [t (Thread. group r (str "apns-push-pool-" (swap! number inc)) 0)
- t (if (.isDaemon t) (.setDaemon t false) t)
- t (if (not= Thread/NORM_PRIORITY (.getPriority t)) (.setPriority t Thread/NORM_PRIORITY) t)]
+ (newThread [_ r] (let [t (Thread. group r (str "apns-push-pool-" (swap! number inc)) 0)]
+ (when (.isDaemon t) (.setDaemon t false))
+ (when (not= Thread/NORM_PRIORITY (.getPriority t)) (.setPriority t Thread/NORM_PRIORITY))
t)))))))))
(def ^:private timer* (ref nil))
Something went wrong with that request. Please try again.