> You just discard all references to an object.

And then afterwards I called (makea), creating a new 'a object. But
then why does it throw an exception when I deref it?

I searched the archives and learned that my intended coding style
(using global vars) isn't idiomatic:
http://groups.google.com/group/clojure/msg/e40c4bed7dc28ebb

so then I settled with the following code, to handle the db and server
variables, which i sometimes redefine. in case of freeing the objects,
then i'd reset! them to nil. i hope this is a good method of managing
global vars that are accessible from everywhere.


(defn create-db [] (EmbeddedGraphDatabase. (:dir-db (:directories
*config*))))
(defn create-server [] (run-jetty (var routes) (:jetty *config*)))

(defonce db (atom (create-db)))
(defonce server (atom (create-server)))

(defn stop "stop the servers." []
  (.stop @server)
  (.shutdown @db))

(defn restart "restart the servers." []
  (stop)
  (reset! db (create-db))
  (reset! server (create-server)))

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to