Back

close! (clj)

(source)

multimethod

Perform a side effect of the form `x` passed as argument and attempts to close it. If it doesn't know how to close it, does nothing. Functions tagged with `^::fn` are considered closeable as `java.io.Closeable` and `java.lang.AutoCloseable`. This multimethod is dispatched on the concrete class of its argument. You can extend this method like any other multimethod. ``` clojure (import '(java.util.concurrent ExecutorService)) (defmethod closeable-map/close! ExecutorService [x] (.shutdown ^ExecutorService x)) (import '(io.aleph.dirigiste IPool)) (defmethod closeable-map/close! IPool [x] (.shutdown ^IPool x)) ```

Examples