Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. public class Singleton {
  2.  
  3. private static Singleton instance;
  4.  
  5. // other code, construct, getters, no matter
  6. }
  7.  
  8. Singleton singleton = Singleton.getInstance();
  9. singleton = null;
  10.  
  11. private static Class getClass(String classname) throws ClassNotFoundException {
  12. ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
  13. if(classLoader == null)
  14. classLoader = Singleton.class.getClassLoader();
  15. return (classLoader.loadClass(classname));
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement