use of org.perf4j.StopWatch in project cuba by cuba-platform.
the class WindowManager method initWrapperFrame.
protected void initWrapperFrame(Window wrappingWindow, ComponentLoaderContext context, Element element, Map<String, Object> params) {
if (wrappingWindow instanceof AbstractWindow) {
Element companionsElem = element.element("companions");
if (companionsElem != null) {
StopWatch companionStopWatch = new Slf4JStopWatch(wrappingWindow.getId() + "#" + LifeCycle.COMPANION, LoggerFactory.getLogger(UIPerformanceLogger.class));
initCompanion(companionsElem, (AbstractWindow) wrappingWindow);
companionStopWatch.stop();
}
}
StopWatch injectStopWatch = new Slf4JStopWatch(wrappingWindow.getId() + "#" + LifeCycle.INJECTION, LoggerFactory.getLogger(UIPerformanceLogger.class));
ControllerDependencyInjector dependencyInjector = AppBeans.getPrototype(ControllerDependencyInjector.NAME, wrappingWindow, params);
dependencyInjector.inject();
injectStopWatch.stop();
context.executeInjectTasks();
context.executePostWrapTasks();
init(wrappingWindow, params);
context.executeInitTasks();
}
use of org.perf4j.StopWatch in project cuba by cuba-platform.
the class AbstractViewRepository method replaceOverridden.
protected void replaceOverridden(View replacementView) {
StopWatch replaceTiming = new Slf4JStopWatch("ViewRepository.replaceOverridden");
HashSet<View> checked = new HashSet<>();
for (View view : getAllInitialized()) {
if (!checked.contains(view)) {
replaceOverridden(view, replacementView, checked);
}
}
replaceTiming.stop();
}
use of org.perf4j.StopWatch in project cuba by cuba-platform.
the class AbstractViewRepository method init.
protected void init() {
StopWatch initTiming = new Slf4JStopWatch("ViewRepository.init." + getClass().getSimpleName());
storage.clear();
readFileNames.clear();
String configName = AppContext.getProperty("cuba.viewsConfig");
if (!StringUtils.isBlank(configName)) {
Element rootElem = DocumentHelper.createDocument().addElement("views");
StrTokenizer tokenizer = new StrTokenizer(configName);
for (String fileName : tokenizer.getTokenArray()) {
addFile(rootElem, fileName);
}
checkDuplicates(rootElem);
for (Element viewElem : Dom4j.elements(rootElem, "view")) {
deployView(rootElem, viewElem, new HashSet<>());
}
}
initTiming.stop();
}
use of org.perf4j.StopWatch in project cuba by cuba-platform.
the class JavaClassLoader method loadClass.
@Override
public Class loadClass(final String fullClassName, boolean resolve) throws ClassNotFoundException {
String containerClassName = StringUtils.substringBefore(fullClassName, "$");
StopWatch loadingWatch = new Slf4JStopWatch("LoadClass");
try {
lock(containerClassName);
Class clazz;
if (!sourceProvider.getSourceFile(containerClassName).exists()) {
clazz = super.loadClass(fullClassName, resolve);
return clazz;
}
CompilationScope compilationScope = new CompilationScope(this, containerClassName);
if (!compilationScope.compilationNeeded()) {
TimestampClass timestampClass = getTimestampClass(fullClassName);
if (timestampClass == null) {
throw new ClassNotFoundException(fullClassName);
}
return timestampClass.clazz;
}
String src;
try {
src = sourceProvider.getSourceString(containerClassName);
} catch (IOException e) {
throw new ClassNotFoundException("Could not load java sources for class " + containerClassName);
}
try {
log.debug("Compiling " + containerClassName);
final DiagnosticCollector<JavaFileObject> errs = new DiagnosticCollector<>();
SourcesAndDependencies sourcesAndDependencies = new SourcesAndDependencies(rootDir, this);
sourcesAndDependencies.putSource(containerClassName, src);
sourcesAndDependencies.collectDependencies(containerClassName);
Map<String, CharSequence> sourcesForCompilation = sourcesAndDependencies.collectSourcesForCompilation(containerClassName);
@SuppressWarnings("unchecked") Map<String, Class> compiledClasses = createCompiler().compile(sourcesForCompilation, errs);
Map<String, TimestampClass> compiledTimestampClasses = wrapCompiledClasses(compiledClasses);
compiled.putAll(compiledTimestampClasses);
linkDependencies(compiledTimestampClasses, sourcesAndDependencies.dependencies);
clazz = compiledClasses.get(fullClassName);
springBeanLoader.updateContext(compiledClasses.values());
return clazz;
} catch (Exception e) {
proxyClassLoader.restoreRemoved();
throw new RuntimeException(e);
} finally {
proxyClassLoader.cleanupRemoved();
}
} finally {
unlock(containerClassName);
loadingWatch.stop();
}
}
use of org.perf4j.StopWatch in project cuba by cuba-platform.
the class DesktopTableCellEditor method getCellComponent.
protected Component getCellComponent(int row) {
Entity item = desktopAbstractTable.getTableModel().getItem(row);
StopWatch sw = new Slf4JStopWatch("TableColumnGenerator." + desktopAbstractTable.getId());
@SuppressWarnings("unchecked") com.haulmont.cuba.gui.components.Component component = columnGenerator.generateCell(item);
sw.stop();
Component comp;
if (component == null) {
comp = new JLabel("");
} else if (component instanceof Table.PlainTextCell) {
comp = new JLabel(((Table.PlainTextCell) component).getText());
} else {
if (component instanceof BelongToFrame) {
BelongToFrame belongToFrame = (BelongToFrame) component;
if (belongToFrame.getFrame() == null) {
belongToFrame.setFrame(desktopAbstractTable.getFrame());
}
}
component.setParent(desktopAbstractTable);
JComponent jComposition = DesktopComponentsHelper.getComposition(component);
jComposition.putClientProperty(CELL_EDITOR_TABLE, desktopAbstractTable.getComponent());
jComposition.putClientProperty(CELL_COMPONENT, component);
comp = jComposition;
}
cache.put(row, comp);
return comp;
}
Aggregations