Dealing with the Write Skew Anomaly
In Handling Write Skew Anomaly, we discussed write skew and how Clojure STM handles it. Akka also has support for dealing with write skew, but we have to configure it. OK, that word may sound scary, but it’s really simple. Let’s first see the default behavior without any configuration.
Let’s revisit the example of multiple accounts with a restricted combined balance that we looked at earlier. Create a Portfolio class that holds a checking account balance and a savings account balance. These two accounts have a constraint of the total balance not running less than $1,000. This class along with the withdraw method is shown next. In this method, we obtain the two balances first, compute their total, and after ...
Get Programming Concurrency on the JVM now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.