Skip to content

Commit

Permalink
fix: resolves reflection warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sunng87 committed Feb 28, 2024
1 parent 8d43373 commit db6a3cf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 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))
8 changes: 4 additions & 4 deletions src/diehard/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
(:import [java.time Duration Instant]
[java.time.temporal ChronoUnit]
[java.util List Optional]
[dev.failsafe Failsafe Fallback RetryPolicy FailsafeExecutor
[dev.failsafe Failsafe Fallback RetryPolicy RetryPolicyConfig FailsafeExecutor
ExecutionContext FailsafeException
CircuitBreakerOpenException]
[dev.failsafe.event ExecutionAttemptedEvent
Expand Down 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 db6a3cf

Please sign in to comment.