Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add :allow-pool-suspension option #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## unreleased

* updated `HikariCP` to `4.0.3`
* add `:allow-pool-suspension` option

## 2.13.0

Expand Down
28 changes: 18 additions & 10 deletions src/hikari_cp/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
[clojure.spec.alpha :as s]))

(def default-datasource-options
{:auto-commit true
:read-only false
:connection-timeout 30000
:validation-timeout 5000
:idle-timeout 600000
:max-lifetime 1800000
:minimum-idle 10
:maximum-pool-size 10
:register-mbeans false})
{:allow-pool-suspension false
:auto-commit true
:read-only false
:connection-timeout 30000
:validation-timeout 5000
:idle-timeout 600000
:max-lifetime 1800000
:minimum-idle 10
:maximum-pool-size 10
:register-mbeans false})

(def ^{:private true} adapters-to-datasource-class-names
{"derby" "org.apache.derby.jdbc.ClientDataSource"
Expand Down Expand Up @@ -55,6 +56,9 @@
[x]
(or (== 0 x) (>= x 2000)))

(s/def ::allow-pool-suspension
boolean?)

(s/def ::auto-commit
boolean?)

Expand Down Expand Up @@ -101,7 +105,8 @@
::read-only
::register-mbeans
::validation-timeout]
:opt-un [::connection-timeout
:opt-un [::allow-pool-suspension
::connection-timeout
::transaction-isolation
::leak-detection-threshold])
;; Make sure that if the user provides the class
Expand Down Expand Up @@ -168,6 +173,7 @@

(def ^:private core-options
[:adapter
:allow-pool-suspension
:auto-commit
:configure
:connection-init-sql
Expand Down Expand Up @@ -199,6 +205,7 @@
options (validate-options datasource-options)
not-core-options (apply dissoc options core-options)
{:keys [adapter
allow-pool-suspension
datasource
datasource-class-name
auto-commit
Expand All @@ -225,6 +232,7 @@
metrics-tracker-factory]} options]
;; Set pool-specific properties
(doto config
(.setAllowPoolSuspension allow-pool-suspension)
(.setAutoCommit auto-commit)
(.setReadOnly read-only)
(.setConnectionTimeout connection-timeout)
Expand Down