I’m working on a plugin that intends to save certain information about a user specific to my systems (such as information not related to openfire, but tied into a user’s JID). It will query this data as needed and save it into a cache (glorified hash table) so that on future references certain data does not need to be queried again from the DB. I have a few questions relating to such a system concerning threads and multiple instances.
First of all, will my plugin ever have more than one instance of itself being created? I have opted out of using Singletons for testing reasons but I suppose I am still open to them. Right now I just use dependency injection to send an important class to any other classes that need to know about it.
And secondly, if I have this Cache system where new connections will query the cache for a hit based on a JID, will I need to make this thread safe, or will all calls to my plugin automatically be syncronized?