Aug 172012
 

There are many ways to update a value atomically, so without introducing racing conditions in multithreaded environments. A well-performing way of doing this in Java is to use an AtomicReference or one of its companion classes in the package java.util.concurrent.atomic. However, using an AtomicReference is quite cumbersome. But with Scala, you can easily factor out the cumbersome usage pattern like follows. Continue reading »

 Comments Off on Generic CAS (compare-and-set) for Scala  Tagged with: ,
Jan 082012
 

When getting an exception, it’s often vital to understand the context of the issue by reading the stack trace. However, with foreign code and certain design patterns it’s often hard to comprehend it. Here’s why and what you can do about it in your own code. Continue reading »