How can I see the number of rollbacks in my STM in Clojure?
You can't... unless you are willing to cheat:
(defmacro spy-dosync [& body]
`(let [retries# (atom -1)
result# (dosync
(swap! retries# inc)
~@body)]
(println "retries count:" @retries#)
result#))
and then replace your dosync by a spy-dosync.