JBossClassPool32public class JBossClassPool32 extends org.jboss.aop.classpool.AOPClassPool
Fields Summary |
---|
protected File | tempdirUsed for dynamically created classes (see loadClass(String, byte[]), ClassLoader) | protected final Object | tmplock |
Methods Summary |
---|
public boolean | isUnloadedClassLoader()
if (getClassLoader() instanceof UnifiedClassLoader)
{
UnifiedClassLoader rcl = (UnifiedClassLoader) getClassLoader();
return rcl.getLoaderRepository() == null;
}
return false;
| public java.lang.Class | toClass(javassist.CtClass cc, java.lang.ClassLoader loader, java.security.ProtectionDomain domain)
lockInCache(cc);
if (getClassLoader() == null || tempdir == null)
{
return super.toClass(cc, loader, domain);
}
Class dynClass = null;
try
{
File classFile = null;
String classFileName = cc.getName().replace('.", '/") + ".class";
// Write the clas file to the tmpdir
synchronized (tmplock)
{
classFile = new File(tempdir, classFileName);
File pkgDirs = classFile.getParentFile();
pkgDirs.mkdirs();
FileOutputStream stream = new FileOutputStream(classFile);
stream.write(cc.toBytecode());
stream.flush();
stream.close();
classFile.deleteOnExit();
}
// We have to clear Blacklist caches or the class will never
// be found
//((UnifiedClassLoader)dcl).clearBlacklists();
// To be backward compatible
UnifiedClassLoader rcl = (UnifiedClassLoader) getClassLoader();
rcl.clearBlackLists();
// Now load the class through the cl
dynClass = getClassLoader().loadClass(cc.getName());
}
catch (Exception ex)
{
ClassFormatError cfe = new ClassFormatError("Failed to load dyn class: " + cc.getName());
cfe.initCause(ex);
throw cfe;
}
return dynClass;
|
|