* @return the named MetricsContext
*/
public synchronized MetricsContext getContext(String contextName)
throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException
{
AbstractMetricsContext metricsContext = contextMap.get(contextName);
if (metricsContext == null) {
String classNameAttribute = contextName + CONTEXT_CLASS_SUFFIX;
String className = (String) getAttribute(classNameAttribute);
if (className == null) {
className = DEFAULT_CONTEXT_CLASSNAME;
}
Class contextClass = Class.forName(className);
metricsContext = (AbstractMetricsContext) contextClass.newInstance();
metricsContext.init(contextName, this);
contextMap.put(contextName, metricsContext);
}
return metricsContext;
}