 
   The result it saves is kept in the metadata under key `:init-resource`."
   [name & args]
-  (let [init-inst (atom nil)
-        {:keys [doc args forms]} (parse-macro-arguments args)]
-    `(do
-       (def ^:private monitor# (Object.))
-       (def ^:private init-inst# ~init-inst)
-       (defn ~(vary-meta name assoc :init-resource init-inst :doc doc) ~args
+  (let [{:keys [doc args forms]} (parse-macro-arguments args)]
+    `(let [init-inst# (atom nil)
+           monitor# (Object.)]
+       (defn ~(vary-meta name assoc :doc doc) ~args
          (let [res# (volatile! nil)
                res-name# ~name]
            (log/debugf "fetching resource: %s" res-name#)
-           (locking monitor#
+           (locking init-inst#
              (when-not (deref init-inst#)
                (log/debugf "creating resource: %s" res-name#)
                (swap! init-inst#
                       #(or % (do ~@forms)))
                (log/debug "create resource")))
-           (deref init-inst#))))))
+           (deref init-inst#)))
+       (alter-meta! (var ~name) assoc :init-resource init-inst#)
+       (var ~name))))
 
 (doseq [var-fn [#'def-prime #'def-lockres]]
   (alter-meta! var-fn assoc

  (let [args (java.util.LinkedList. arg-list)
        mres (transient {})]
    (if (and (.peek args)
             (= (type (.peek args))) java.lang.String)
      (assoc! mres :doc (.pop args)))
    (if (empty? args)
      (-> (format "Missing [params*] argument list: %s" arg-list)


  The result it saves is kept in the metadata under key `:init-resource`."
  [name & args]
  (let [{:keys [doc args forms]} (parse-macro-arguments args)]
    `(let [init-inst# (atom nil)
           monitor# (Object.)]
       (defn ~(vary-meta name assoc :doc doc) ~args
         (letfn [(create-fn# ~args
                   (do ~@forms))]
           (let [res# (volatile! nil)]
