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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With