> Is there any easy workaround which doesn't involve defing a global
> conn.
To do all in a single place you'll have to mimic the Java idiom.
(let [conn (atom nil)]
(try
(reset! conn (API/getConnection ...) ...
(catch ...)
(finally (if @conn (API/closeConnection @conn)))))
As it's been explained, a better way would be a variant of with-open,
maybe within a try form if you want to handle open errors locally.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en