Iv stumbled this also when using Threads, (http:// javadevelopmentforthemasses.blogspot.com/2009/07/easiest-singleton- around.html)
user=> (defn singleton-factory [] (println "creating object") (+ 1 2)) user=> (use 'clojure.contrib.singleton) nil user=> (def t-singleton (per-thread-singleton singleton-factory)) #'user/t-singleton user=> (defn use-twice [] (+ 1 (t-singleton)) (+ 1 (t-singleton))) #'user/use-twice user=> (. (Thread. use-twice) start) nil user=> creating object ; REPL prints on the wrong line --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---