protected void onRefresh() {
if (runtime != null) { // egregious hack to prevent recursion in refresh()
return;
}
ServletContext servletContext = getServletContext();
WebappUtil utils = getUtils(servletContext);
try {
ClassLoader webappClassLoader = Thread.currentThread().getContextClassLoader();
ClassLoader bootClassLoader = utils.getBootClassLoader(webappClassLoader);
runtime = utils.getRuntime(bootClassLoader);
URL systemScdl = utils.getSystemScdl(bootClassLoader);
URL applicationScdl = utils.getApplicationScdl(webappClassLoader);
runtime.setMonitorFactory(runtime.createDefaultMonitorFactory());
runtime.setApplicationName(utils.getApplicationName());
runtime.setServletContext(servletContext);
runtime.setHostClassLoader(webappClassLoader);
runtime.setSystemScdl(systemScdl);
runtime.setApplicationScdl(applicationScdl);
runtime.setRuntimeInfo(new SpringWebappRuntimeInfo(getApplicationRootDirectory(), this));