Skip to content
Snippets Groups Projects
Commit 16282558 authored by Nils Christian Ehmke's avatar Nils Christian Ehmke
Browse files

Classloading issue (#1069)

parent fc50fd79
No related branches found
No related tags found
No related merge requests found
......@@ -22,14 +22,17 @@ import javax.servlet.ServletContextListener;
import kieker.common.logging.Log;
import kieker.common.logging.LogFactory;
import org.eclipse.emf.common.util.CommonUtil;
/**
* This is a context listener, which will be activated during the initialization of the application. It initializes some environment properties, which are necessary
* for the web application.<br>
* </br>
*
* The only environment property which is currently set by this listener is the property for the web application logger. This makes sure that later created analyses
* use the correct logger, whose messages can be intercepted by this application. If this environment property is not set, the log entries of the analyses cannot be
* shown in the corresponding control panel.<br>
* The only two environment properties, which are currently set by this listener are the property for the web application logger and the property for the EMF cleaner
* thread. The first ones makes sure that later created analyses use the correct logger, whose messages can be intercepted by this application. If this environment
* property is not set, the log entries of the analyses cannot be shown in the corresponding control panel. The second property makes sure that later created
* analyses do not start a cleaner thread, which would result in further problems with the hot deployment and the GC.<br>
* </br>
*
* As this class is used by the servlet container, it is <b>not</b> recommended to use or access it in any way.
......@@ -54,12 +57,12 @@ public final class EnvironmentLoaderListener implements ServletContextListener {
@Override
public void contextInitialized(final ServletContextEvent event) {
// We have to use the logger before setting the environment property. This makes sure, that our own logger is not initialized with the web application
// logger. All components which are created later use the correct logger though (they are loaded with another class loader and use another instance of the
// logging factory class therefore).
LOG.info("Starting Kieker.WebGUI environment initialization.");
final long timeIn = System.currentTimeMillis();
// We have to use some classes before setting the environment properties. This makes sure that the classes used within the WebGUI are initialized without
// these environments. The later created classes use another class loader and are therefore initialized with the modified environment settings.
this.initializeClasses();
this.initializeProperties();
final long timeOut = System.currentTimeMillis();
......@@ -68,8 +71,14 @@ public final class EnvironmentLoaderListener implements ServletContextListener {
LOG.info(String.format("Kieker.WebGUI environment initialized in %d ms.", timeDelta));
}
private void initializeClasses() {
// The Log class has already been initialized. All that remains is the CommonUtil class.
CommonUtil.internToUpperCase(null);
}
private void initializeProperties() {
System.setProperty("kieker.common.logging.Log", "WEBGUI");
System.setProperty("org.eclipse.emf.common.util.ReferenceClearingQueue", "false");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment