Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Make compatible with graalvm #543

Merged
merged 1 commit into from
Jun 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/clj_http/conn_mgr.clj
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
(SSLIOSessionStrategy. ^SSLContext context ^HostnameVerifier verifier))))

(def ^:private ^SSLConnectionSocketFactory secure-ssl-socket-factory
(SSLConnectionSocketFactory/getSocketFactory))
(delay (SSLConnectionSocketFactory/getSocketFactory)))

(def ^:private ^SSLIOSessionStrategy secure-strategy
(SSLIOSessionStrategy/getDefaultStrategy))
(delay (SSLIOSessionStrategy/getDefaultStrategy)))

(defn ^SSLConnectionSocketFactory SSLGenericSocketFactory
"Given a function that returns a new socket, create an
Expand Down Expand Up @@ -178,16 +178,16 @@
(.build))))

(def ^:private regular-scheme-registry
(-> (RegistryBuilder/create)
(.register "http" (PlainConnectionSocketFactory/getSocketFactory))
(.register "https" secure-ssl-socket-factory)
(.build)))
(delay (-> (RegistryBuilder/create)
(.register "http" (PlainConnectionSocketFactory/getSocketFactory))
(.register "https" @secure-ssl-socket-factory)
(.build))))

(def ^:private regular-strategy-registry
(-> (RegistryBuilder/create)
(.register "http" NoopIOSessionStrategy/INSTANCE)
(.register "https" secure-strategy)
(.build)))
(delay (-> (RegistryBuilder/create)
(.register "http" NoopIOSessionStrategy/INSTANCE)
(.register "https" @secure-strategy)
(.build))))

(defn ^Registry get-custom-scheme-registry
[{:keys [context verifier]}]
Expand Down Expand Up @@ -245,7 +245,7 @@
(opt req :insecure) (BasicHttpClientConnectionManager.
@insecure-scheme-registry)

:else (BasicHttpClientConnectionManager. regular-scheme-registry))]
:else (BasicHttpClientConnectionManager. @regular-scheme-registry))]
(when socket-timeout
(.setSocketConfig conn-manager
(-> (.getSocketConfig conn-manager)
Expand Down Expand Up @@ -286,7 +286,7 @@
(opt req :insecure)
@insecure-strategy-registry

:else regular-strategy-registry)
:else @regular-strategy-registry)
io-reactor (make-ioreactor {:shutdown-grace-period 1})]
(doto (PoolingNHttpClientConnectionManager. io-reactor registry)
(.setMaxTotal 1))))
Expand All @@ -312,7 +312,7 @@
(or keystore trust-store)
(get-keystore-scheme-registry config)

:else regular-scheme-registry)]
:else @regular-scheme-registry)]
(PoolingHttpClientConnectionManager.
registry nil nil nil timeout java.util.concurrent.TimeUnit/SECONDS)))

Expand Down Expand Up @@ -375,7 +375,7 @@
(or keystore trust-store)
(get-keystore-scheme-registry config)

:else regular-strategy-registry)
:else @regular-strategy-registry)
io-reactor (make-ioreactor io-config)
protocol-handler (HttpAsyncRequestExecutor.)
io-event-dispatch (DefaultHttpClientIODispatch. protocol-handler
Expand Down