public ClassLoader run() throws IOException { Thread currentThread = Thread.currentThread(); ClassLoader context = currentThread.getContextClassLoader(); try { currentThread.setContextClassLoader(parent); return ClassLoading.getClassLoader(path); } finally { if (context != null) currentThread.setContextClassLoader(context); } } }
@Override public Object run() { ClassLoader bcl = base.getClassLoader(); if (bcl == null) { return null; } ClassLoader pcl = bcl.getParent(); Thread t = Thread.currentThread(); ClassLoader ccl = t.getContextClassLoader(); boolean proper = false; try { t.setContextClassLoader(pcl); proper = (ClassLoading.getClassLoader(bcb) == bcl); } catch (MalformedURLException e) { } finally { t.setContextClassLoader(ccl); } if (proper) { try { return Proxy.newProxyInstance( pcl, new Class[]{ProxyTrust.class, RemoteMethodControl.class}, ih); } catch (IllegalArgumentException e) { } } return null; } });