Minborg's Java Pot
This is my Java blog with various tips and tricks that are targeted for medium and advanced Java users. I am a guy living in Palo Alto, California, but I am originally from Sweden. I am working as CTO on Speedment with Java and database application acceleration. Check it out on www.speedment.com Pull down all the source code on this blog using "git clone https://github.com/minborg/javapot.git". I encourage any contribution and improvement on the source code. Happy Reading! /Per Minborg Enforcing Java Singletons is Very Hard Background A singleton is a class that is instantiated exactly one time and can be used to represent "global" or system wide components. Common usages of singletons include loggers, factories, window managers or platform components. My general tip is to avoid using singletons when possible, because it is difficult to break out or override functionality and also to write test mocks and they also tend to create a bad over all code structure. As...