X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fjinetd%2FTreeClassLoader.java;h=b40a74f592e23d127e677c2bc41519548a4ca8bf;hb=HEAD;hp=e9f901feaa6d187896af6a19f8a3cfb626184708;hpb=df13dadbee1a679518ccebbf417a11ec17c77aec;p=org.ibex.jinetd.git diff --git a/src/org/ibex/jinetd/TreeClassLoader.java b/src/org/ibex/jinetd/TreeClassLoader.java index e9f901f..b40a74f 100644 --- a/src/org/ibex/jinetd/TreeClassLoader.java +++ b/src/org/ibex/jinetd/TreeClassLoader.java @@ -23,6 +23,8 @@ public class TreeClassLoader extends URLClassLoader { this.lib = new File(root.getAbsolutePath() + File.separatorChar + "lib"); } + public Enumeration getLoadedClassNames() { return cache.keys(); } + // Classloading ////////////////////////////////////////////////////////////////////////////// public URL[] getURLs() { @@ -69,7 +71,10 @@ public class TreeClassLoader extends URLClassLoader { public synchronized Class findClass(String name) throws ClassNotFoundException { Class c = (Class)cache.get(name); if (c==null) c = defineClass(name); - if (c==null) throw new ClassNotFoundException(name); + if (c==null) { + Log.warn("notfound", "in " + root + ": couldn't find " + name); + throw new ClassNotFoundException(name); + } return c; } @@ -112,4 +117,32 @@ public class TreeClassLoader extends URLClassLoader { return null; } + // Experimental ////////////////////////////////////////////////////////////////////////////// + + protected ThreadGroup tg = null; + private void nuke() { + if (tg.activeCount() == 0) return; + Log.info(this, "killing all threads for: " + root.getAbsolutePath()); + Log.info(this, " thread count before interrupt: " + tg.activeCount()); + tg.interrupt(); + try { Thread.sleep(3000); } catch (Exception e) { Log.error(this, e); } + Log.info(this, " thread count before kill: " + tg.activeCount()); + Thread[] all = new Thread[tg.activeCount()]; + tg.enumerate(all, true); + for(int i=0; i 0) { + Log.warn(this, " annoying threads:"); + Thread[] annoying = new Thread[tg.activeCount()]; + tg.enumerate(annoying, true); + for(int i=0; i