Skip to content

Commit 19b8f1e

Browse files
committed
Merge pull request #5 from mtkp/fix-reflection-warnings
fix reflection warnings
2 parents 1febb9e + 124444b commit 19b8f1e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/clj_http_hystrix/core.clj

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
(ns clj-http-hystrix.core
22
(:require [clj-http.client :as http]
3-
[clojure.set :as set]
43
[clojure.tools.logging :refer [warn error]]
54
[robert.hooke :as hooke]
65
[slingshot.slingshot :refer [get-thrown-object]]
76
[slingshot.support :refer [wrap stack-trace]])
8-
(:import [com.netflix.hystrix HystrixCommand HystrixThreadPoolProperties HystrixCommandProperties HystrixCommand$Setter HystrixCommandGroupKey$Factory HystrixCommandKey$Factory]
7+
(:import [com.netflix.hystrix HystrixCommand
8+
HystrixThreadPoolProperties
9+
HystrixCommandProperties
10+
HystrixCommand$Setter
11+
HystrixCommandGroupKey$Factory
12+
HystrixCommandKey$Factory]
913
[com.netflix.hystrix.exception HystrixBadRequestException]
1014
[org.slf4j MDC]))
1115

@@ -25,7 +29,7 @@
2529

2630
(defn ^:private handle-exception
2731
[f req]
28-
(let [raw-response (try (f) (catch Exception e e))
32+
(let [^Exception raw-response (try (f) (catch Exception e e))
2933
resp (if (instance? HystrixBadRequestException raw-response)
3034
(get-thrown-object (.getCause raw-response))
3135
raw-response)]
@@ -58,7 +62,7 @@
5862
(.andCommandPropertiesDefaults command-configurator)
5963
(.andThreadPoolPropertiesDefaults thread-pool-configurator))))
6064

61-
(defn ^:private log-error [command-name context]
65+
(defn ^:private log-error [command-name ^HystrixCommand context]
6266
(let [message (format "Failed to complete %s %s" command-name (.getExecutionEvents context))]
6367
(if-let [exception (.getFailedExecutionException context)]
6468
(warn exception message)
@@ -92,13 +96,13 @@
9296
:stack-trace (stack-trace)})))
9397
resp))
9498
wrap-exception-reponse (fn [resp] ((http/wrap-exceptions (constantly resp)) (assoc req :throw-exceptions true)))
95-
configurator (configurator req)
99+
^HystrixCommand$Setter configurator (configurator req)
96100
logging-context (or (MDC/getCopyOfContextMap) {})
97101
command (proxy [HystrixCommand] [configurator]
98102
(getFallback []
99103
(MDC/setContextMap logging-context)
100104
(log-error (:hystrix/command-key req) this)
101-
(let [exception (.getFailedExecutionException this)
105+
(let [exception (.getFailedExecutionException ^HystrixCommand this)
102106
response (when exception (get-thrown-object exception))]
103107
(fallback req response)))
104108
(run []

0 commit comments

Comments
 (0)