I’m having trouble with a module losing a singleton that I’ve created when a client logs out.
Client Hook Example:
public class ClientHook extends AbstractClientModuleHook {
@Override
public void startup(ClientContext context, LicenseState activationState) throws Exception {
super.startup(context, activationState);
this.context = context;
MySingleton.initialize(context);
}
}
Then my singleton looks like:
public class MySingleton {
private static final Logger logger = LoggerFactory.getLogger();
private static MySingleton instance;
private ReplayRequestEngine(ClientContext context){
this.context = context;
}
public synchronized static void initialize(ClientContext context){
logger.trace("Initializing Singleton Instance");
if(instance == null)
instance = new MySingleton(context);
}
public static ReplayRequestEngine getInstance(){
return instance;
}
}
The first time I run this code I can see the logger working, but after I log in and back out the logger doesn’t seem to work anymore, and neither do any methods of my singleton. Any ideas?