Skip to content

Instantly share code, notes, and snippets.

View Lambeaux's full-sized avatar

Steven Lombardi Lambeaux

  • Centripetal Networks
  • Arizona, United States
View GitHub Profile
@RutledgePaulV
RutledgePaulV / self-cleaning-pool.clj
Last active July 7, 2022 19:57
self-cleaning-pool.clj
(defn gc-managed-pool
"Wraps a manually managed pool to create an automatically managed pool
that returns resources to the pool as the doled out references are
garbage collected by the jvm."
[pool borrow return]
(letfn [(interfaces [x]
(->> (ancestors (class x))
(filter class?)
(filter #(.isInterface %))))
(create-facade [x]