/** * Public factory method to guarantee singleton */ public static synchronized PubSub getInstance() { if (instance != null) { LOGGER.info(instance + " requested"); } else { instance = new PubSub(); LOGGER.info(instance + " created"); } return instance; }