use of org.perf4j.slf4j.Slf4JStopWatch in project cuba by cuba-platform.
the class ScreenXmlLoader method load.
/**
* Loads a descriptor.
* @param resourcePath path to the resource containing the XML
* @param id screen ID
* @param params screen parameters
* @return root XML element
*/
public Element load(String resourcePath, String id, Map<String, Object> params) {
StopWatch xmlLoadWatch = new Slf4JStopWatch(id + "#" + UIPerformanceLogger.LifeCycle.XML, LoggerFactory.getLogger(UIPerformanceLogger.class));
String template = loadTemplate(resourcePath);
Document document = getDocument(template, params);
xmlLoadWatch.stop();
return document.getRootElement();
}
use of org.perf4j.slf4j.Slf4JStopWatch in project cuba by cuba-platform.
the class AbstractTreeDatasource method loadData.
@Override
protected void loadData(Map<String, Object> params) {
String tag = getLoggingTag("TDS");
StopWatch sw = new Slf4JStopWatch(tag, LoggerFactory.getLogger(UIPerformanceLogger.class));
clear();
this.tree = loadTree(params);
Map<K, Node<T>> targetNodes = new HashMap<>();
if (tree != null) {
for (Node<T> node : tree.toList()) {
final T entity = node.getData();
final K id = entity.getId();
data.put(id, entity);
attachListener(entity);
targetNodes.put(id, node);
}
}
this.nodes = targetNodes;
sw.stop();
}
use of org.perf4j.slf4j.Slf4JStopWatch in project cuba by cuba-platform.
the class ValueGroupDatasourceImpl method loadData.
@Override
protected void loadData(Map<String, Object> params) {
String tag = getLoggingTag("VGDS");
StopWatch sw = new Slf4JStopWatch(tag, LoggerFactory.getLogger(UIPerformanceLogger.class));
delegate.loadData(params);
sw.stop();
}
use of org.perf4j.slf4j.Slf4JStopWatch in project cuba by cuba-platform.
the class ValueHierarchicalDatasourceImpl method loadData.
@Override
protected void loadData(Map<String, Object> params) {
String tag = getLoggingTag("VHDS");
StopWatch sw = new Slf4JStopWatch(tag, LoggerFactory.getLogger(UIPerformanceLogger.class));
delegate.loadData(params);
sw.stop();
}
use of org.perf4j.slf4j.Slf4JStopWatch in project cuba by cuba-platform.
the class FoldersServiceBean method loadSearchFolders.
@Override
public List<SearchFolder> loadSearchFolders() {
log.debug("Loading SearchFolders");
StopWatch stopWatch = new Slf4JStopWatch("SearchFolders");
stopWatch.start();
Transaction tx = persistence.createTransaction();
try {
EntityManager em = persistence.getEntityManager();
MetaClass effectiveMetaClass = metadata.getExtendedEntities().getEffectiveMetaClass(SearchFolder.class);
TypedQuery<SearchFolder> q = em.createQuery("select f from " + effectiveMetaClass.getName() + " f " + "left join fetch f.user u on u.id = ?1 " + "left join fetch f.presentation " + "where (u.id = ?1 or u is null) " + "order by f.sortOrder, f.name", SearchFolder.class);
q.setParameter(1, userSessionSource.currentOrSubstitutedUserId());
List<SearchFolder> list = q.getResultList();
// fetch parents
for (SearchFolder folder : list) {
folder.getParent();
}
tx.commit();
return list;
} finally {
tx.end();
stopWatch.stop();
}
}
Aggregations