Skip to content

validate & destroy aren't working as expected #3

@olttwa

Description

@olttwa

Upon object creation & pool closing, the validate & destroy functions aren't called as expected.

Reproducing the error

(defn create-pool [count]
  (doto (pool/get-pool (fn [] (println "creating an object") 1)
                       {:validate (fn [x] (println "validate called") true)
                        :destroy (fn [x] (println "destroy called"))})
    (.setTimeBetweenEvictionRunsMillis 1)
    (.setMinIdle count)
    (.setMaxIdle count)
    (.setMaxTotal count)))

;; Immediately 2 objects will get created as `setMinIdle` is set to 2.
(let [my-pool (create-pool 2)]
  (Thread/sleep 100)
  (pool/close my-pool))

When executing above code, "validate called" & "destroy called" won't get printed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions