use of core.framework.util.StopWatch in project core-ng-project by neowu.
the class Pool method createNewItem.
private PoolItem<T> createNewItem() {
StopWatch watch = new StopWatch();
size.incrementAndGet();
try {
return new PoolItem<>(factory.get());
} catch (Throwable e) {
size.getAndDecrement();
throw e;
} finally {
logger.debug("create new resource, pool={}, size={}, elapsed={}", name, size.get(), watch.elapsedTime());
}
}
use of core.framework.util.StopWatch in project core-ng-project by neowu.
the class TemplateManager method process.
public String process(String templatePath, Object model, String language) {
StopWatch watch = new StopWatch();
try {
HTMLTemplate template = get(templatePath, model.getClass(), language);
TemplateContext context = new TemplateContext(model, cdnManager);
return template.process(context);
} finally {
logger.debug("process, templatePath={}, elapsedTime={}", templatePath, watch.elapsedTime());
}
}
use of core.framework.util.StopWatch in project core-ng-project by neowu.
the class HTMLTemplateEngine method process.
public String process(String name, Object model) {
StopWatch watch = new StopWatch();
try {
HTMLTemplate template = templates.get(name);
if (template == null)
throw Exceptions.error("template not found, name={}", name);
TemplateContext context = new TemplateContext(model, cdnManager);
return template.process(context);
} finally {
logger.debug("process, name={}, elapsedTime={}", name, watch.elapsedTime());
}
}
use of core.framework.util.StopWatch in project core-ng-project by neowu.
the class DatabaseImpl method select.
@Override
public <T> List<T> select(String sql, Class<T> viewClass, Object... params) {
StopWatch watch = new StopWatch();
int returnedRows = 0;
try {
List<T> results = operation.select(sql, rowMapper(viewClass), params);
returnedRows = results.size();
checkTooManyRowsReturned(returnedRows);
return results;
} finally {
long elapsedTime = watch.elapsedTime();
ActionLogContext.track("db", elapsedTime, returnedRows, 0);
logger.debug("select, sql={}, params={}, updatedRows={}, elapsedTime={}", sql, params, returnedRows, elapsedTime);
checkSlowOperation(elapsedTime);
}
}
use of core.framework.util.StopWatch in project core-ng-project by neowu.
the class DatabaseImpl method repository.
public <T> Repository<T> repository(Class<T> entityClass) {
StopWatch watch = new StopWatch();
try {
new DatabaseClassValidator(entityClass).validateEntityClass();
RowMapper<T> mapper = registerViewClass(entityClass);
return new RepositoryImpl<>(this, entityClass, mapper);
} finally {
logger.info("register db entity, entityClass={}, elapsedTime={}", entityClass.getCanonicalName(), watch.elapsedTime());
}
}
Aggregations