Hi, I'm just starting to get my head wrapped around STM just by reading about it so I can make a decision on whether to port a Java project to Clojure.
a) can STM transactions contain calculations that take a 'long' time, let's say computing the cryptographic hash of a plaintext. I'd 'ensure' the input parameters such as plain text, hash algo and bit- length, compute the hash (can be slow) and store the hash in a ref. What I'd need here is that the calculation is interrupted if the transaction is aborted for a retry. No need to complete the long calculation if we aren't going to store the result anyway. The existing convention in Java is to set the interrupt flag on a thread which is queried ever now and then by long-running calculations. This is a convention that many Java libraries adhere to. So how to do this interrupting? b) With long-running calculations, nested dosyncs should really result in nested transactions. The point being if a transaction has several long-running calculations. E.g. first compute a hash, then encrypt the hash with a public key. In that case, if the 'ensured' parameters that the second encrypt part depends on are changed concurrently but not the parameters/result of the first part, then only the second calculation has to be repeated, not both. The second part could be enclosed in an inner dosync but currently Clojure will unnecessarily redo the whole thing. c) Somewhat different: I'm not supposed to do I/O in a transaction because the transaction might be repeated and that will repeat the I/ O. But maybe that's what I want. The I/O could be a network output sending the computed value over the net to be stored on a remote machine instead of being stored in a local ref. I *do* want the computed value of each retry to be sent over the net. I guess my setup here could be considered an ad-hoc distributed TM, this touches the other discussion of "STM with external transactions" in this group. Thanks -- 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