It started when David tried to access a Singleton and got a null-pointer exception. Then he noticed some bugs where the Singleton had inconsistent state. And then he looked at the codeā€¦

public class KpiService {
    private static KpiService instance = null;

    public static KpiService getInstance() {
        return instance;

    public KpiService() {
        instance = this;
    /* SNIP */