Create instances for classes
Posted: Tue Jan 17, 2017 5:23 am
I have separate packages in my project and I need to create instances for all classes in this packages. I create instance of class by the below code.
But I have problem with deleting my packages and applet after I call Digest.getInstance(). I need to implement clearInstacePool() method to set reference of digest to null in unistall() method of my applet. How can I create instance of class without implementing clearInstacePool()?
But I have problem with deleting my packages and applet after I call Digest.getInstance(). I need to implement clearInstacePool() method to set reference of digest to null in unistall() method of my applet. How can I create instance of class without implementing clearInstacePool()?
Code: Select all
public class Digest
{
private static Digest digest = null;
protected Digest ()
{
}
public static Digest getInstance()
{
if(digest == null)
digest = new Digest();
return digest;
}
public static void clearInstacePool()
{
digest = null;
}
}