Skip to content

Commit

Permalink
Merge pull request #68 from sunng87/fix/reflec-warns
Browse files Browse the repository at this point in the history
fix: resolves reflection warnings
  • Loading branch information
sunng87 committed Feb 28, 2024
2 parents 0935bf2 + 4b1b499 commit 881906c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/diehard/circuit_breaker.clj
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ on current state:
* `:close` allows all executions
* `:half-open` only allows some of execution requests"
[^CircuitBreaker cb]
(.allowsExecution cb))
(.tryAcquirePermit cb))
6 changes: 3 additions & 3 deletions src/diehard/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

(defn ^:no-doc retry-policy-from-config [policy-map]
(let [policy (if-let [policy (:policy policy-map)]
(RetryPolicy/builder (.getConfig policy))
(RetryPolicy/builder (.getConfig ^RetryPolicy policy))
(RetryPolicy/builder))]

(when (contains? policy-map :abort-if)
Expand All @@ -80,8 +80,8 @@
(let [backoff-config (:backoff-ms policy-map)
[delay max-delay multiplier] backoff-config]
(if (nil? multiplier)
(.withBackoff policy delay max-delay ChronoUnit/MILLIS)
(.withBackoff policy delay max-delay ChronoUnit/MILLIS multiplier))))
(.withBackoff policy ^long delay ^long max-delay ChronoUnit/MILLIS)
(.withBackoff policy ^long delay ^long max-delay ChronoUnit/MILLIS ^double multiplier))))
(when-let [delay (:delay-ms policy-map)]
(.withDelay policy (Duration/ofMillis delay)))
(when-let [duration (:max-duration-ms policy-map)]
Expand Down
4 changes: 2 additions & 2 deletions src/diehard/rate_limiter.clj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
(acquire! [this permits]
(let [sleep (do-acquire this permits)]
(when (> sleep 0)
(Thread/sleep sleep))))
(Thread/sleep ^long sleep))))
(try-acquire [this]
(try-acquire this 1))
(try-acquire [this permits]
Expand All @@ -42,7 +42,7 @@
false
(do
(when (> sleep 0)
(Thread/sleep sleep))
(Thread/sleep ^long sleep))
true)))))

(defn- refill [^TokenBucketRateLimiter rate-limiter]
Expand Down

0 comments on commit 881906c

Please sign in to comment.