STM Lib is a pragmatic library implementation of software transactional memory (STM) for Java and other JVM languages (such as Scala, Clojure, and Groovy). STM is ideal for applications where data is accessed concurrently by several threads and doesn't have to be persisted in real-time. For example, chat or instant messaging servers, file sharing servers, real time search engines, and massively multiplayer online games or virtual communities. It also works for all kinds of multithreaded programs. STMlib provides transactional collection classes that implement the standard Java APIs. The locking scheme is based on 2 phase locking, which enforces Serializability. Also, transactions are automatically retried when deadlocks occur, so you don't have to.