@Override public ClassLoader getTempClassloader() { return ( (InstrumentableClassLoader)deploymentContext.getClassLoader() ).copy(); }
public synchronized ClassLoader getClassLoader(boolean sharable) { // if we are in prepare phase, we need to return our sharable temporary class loader // otherwise, we return the final one. if (phase==Phase.PREPARE) { if (sharable) { return sharableTemp; } else { InstrumentableClassLoader cl = InstrumentableClassLoader.class.cast(sharableTemp); return cl.copy(); } } else { // we are out of the prepare phase, destroy the shareableTemp and // return the final classloader if (sharableTemp!=null) { try { PreDestroy.class.cast(sharableTemp).preDestroy(); } catch (Exception e) { // ignore, the classloader does not need to be destroyed } sharableTemp=null; } return cloader; } }