Question: A team member has been having trouble with the implementation of his Singleton. Review the code below and indicate what changes are required. public class
A team member has been having trouble with the implementation of his Singleton. Review the code below and indicate what changes are required.
public class DataConnectionManager implements JSONSerialization{
private static DataConnectionManager msManager = null;
public DataConnectionManager() {
//Initialize connection
}
public static DataConnectionManager getInstance() {
if(msManager == null) {
msManager = new DataConnectionManager();
}
return msManager;
}
public static void deserialize(JSONObject obj) {
msManager = new DataConnectionManager();
msManager.setFromJSON(obj);
}
}
Step by Step Solution
3.34 Rating (151 Votes )
There are 3 Steps involved in it
Thread Safety The current implementation is not threadsafe If multiple threads try to access getInst... View full answer
Get step-by-step solutions from verified subject matter experts
