Thread Safe singleton class
You are implementing the lazy initialization pattern – where the instance is created when first used. But there is a simple trick that allows you to code a threadsafe implementation that doesn’t require synchronization! It is known as the Initialization-on-demand holder idiom, and it looks like this: public class CassandraAstyanaxConnection { private CassandraAstyanaxConnection(){ } private … Read more