use of org.perf4j.slf4j.Slf4JStopWatch in project cuba by cuba-platform.
the class ClusterManager method internalSend.
protected void internalSend(Serializable message, boolean sync) {
StopWatch sw = new Slf4JStopWatch(String.format("sendClusterMessage(%s)", message.getClass().getSimpleName()));
try {
byte[] bytes = SerializationSupport.serialize(message);
log.debug("Sending message: {}: {} ({} bytes)", message.getClass(), message, bytes.length);
MessageStat stat = messagesStat.get(message.getClass().getName());
if (stat != null) {
stat.updateSent(bytes.length);
}
Message msg = new Message(null, null, bytes);
if (sync) {
msg.setFlag(Message.Flag.RSVP);
}
try {
channel.send(msg);
} catch (Exception e) {
log.error("Error sending message", e);
}
} finally {
sw.stop();
}
}
use of org.perf4j.slf4j.Slf4JStopWatch in project cuba by cuba-platform.
the class PerformanceLogInterceptor method aroundInvoke.
@SuppressWarnings({ "UnusedDeclaration", "UnnecessaryLocalVariable" })
private Object aroundInvoke(ProceedingJoinPoint ctx) throws Throwable {
StopWatch stopWatch = new Slf4JStopWatch(ctx.getSignature().toShortString());
try {
stopWatch.start();
Object res = ctx.proceed();
return res;
} finally {
stopWatch.stop();
}
}
use of org.perf4j.slf4j.Slf4JStopWatch in project cuba by cuba-platform.
the class JmxInstancesDatasource method loadData.
@Override
protected void loadData(Map<String, Object> params) {
String tag = getLoggingTag("CDS");
StopWatch sw = new Slf4JStopWatch(tag, LoggerFactory.getLogger(UIPerformanceLogger.class));
detachListener(data.values());
data.clear();
for (JmxInstance jmxInstance : jmxControlAPI.getInstances()) {
data.put(jmxInstance.getId(), jmxInstance);
attachListener(jmxInstance);
}
sw.stop();
}
use of org.perf4j.slf4j.Slf4JStopWatch in project cuba by cuba-platform.
the class FrameComponentLoader method loadComponent.
@Override
public void loadComponent() {
if (resultComponent.getMessagesPack() == null) {
resultComponent.setMessagesPack(messagesPack);
}
assignXmlDescriptor(resultComponent, element);
loadVisible(resultComponent, element);
loadStyleName(resultComponent, element);
loadResponsive(resultComponent, element);
loadAlign(resultComponent, element);
loadHeight(resultComponent, element, ComponentsHelper.getComponentHeigth(resultComponent));
loadWidth(resultComponent, element, ComponentsHelper.getComponentWidth(resultComponent));
loadIcon(resultComponent, element);
loadCaption(resultComponent, element);
loadDescription(resultComponent, element);
if (context.getFrame() != null) {
resultComponent.setFrame(context.getFrame());
}
String src = element.attributeValue("src");
String screenId = element.attributeValue("screen");
String screenPath = StringUtils.isEmpty(screenId) ? src : screenId;
if (element.attributeValue("id") != null) {
screenPath = element.attributeValue("id");
}
if (context.getFrame() != null) {
String parentId = context.getFullFrameId();
if (StringUtils.isNotEmpty(parentId)) {
screenPath = parentId + "." + screenPath;
}
}
StopWatch loadDescriptorWatch = new Slf4JStopWatch(screenPath + "#" + UIPerformanceLogger.LifeCycle.LOAD, LoggerFactory.getLogger(UIPerformanceLogger.class));
loadDescriptorWatch.start();
String currentFrameId = context.getCurrentFrameId();
try {
context.setCurrentFrameId(frameId);
frameLoader.loadComponent();
} finally {
context.setCurrentFrameId(currentFrameId);
loadDescriptorWatch.stop();
}
}
use of org.perf4j.slf4j.Slf4JStopWatch in project cuba by cuba-platform.
the class RuntimePropertiesFrameLoader method loadComponent.
@Override
public void loadComponent() {
if (resultComponent.getMessagesPack() == null) {
resultComponent.setMessagesPack(messagesPack);
}
assignXmlDescriptor(resultComponent, element);
loadVisible(resultComponent, element);
loadStyleName(resultComponent, element);
loadAlign(resultComponent, element);
loadHeight(resultComponent, element, ComponentsHelper.getComponentHeigth(resultComponent));
loadWidth(resultComponent, element, ComponentsHelper.getComponentWidth(resultComponent));
String src = element.attributeValue("src");
if (src == null) {
src = DEFAULT_DESCRIPTOR;
}
String runtimeDs = element.attributeValue("runtimeDs");
if (StringUtils.isEmpty(runtimeDs)) {
throw new GuiDevelopmentException("runtimePropsDatasource is not set for runtimeProperties component", context.getFullFrameId());
}
context.getParams().put("runtimeDs", runtimeDs);
String categoriesDs = element.attributeValue("categoriesDs");
if (StringUtils.isEmpty(categoriesDs)) {
throw new GuiDevelopmentException("categoriesDs is not set for runtimeProperties component", context.getFullFrameId());
}
context.getParams().put("categoriesDs", categoriesDs);
String rows = element.attributeValue("rows");
context.getParams().put("rows", rows);
String cols = element.attributeValue("cols");
context.getParams().put("cols", cols);
String fieldWidth = element.attributeValue("fieldWidth");
context.getParams().put("fieldWidth", fieldWidth);
String fieldCaptionWidth = element.attributeValue("fieldCaptionWidth");
context.getParams().put("fieldCaptionWidth", fieldCaptionWidth);
String screenPath = Objects.equals(src, DEFAULT_DESCRIPTOR) ? "runtimeProperties" : src;
if (element.attributeValue("id") != null) {
screenPath = element.attributeValue("id");
}
if (context.getFrame() != null) {
String parentId = context.getFullFrameId();
if (StringUtils.isNotEmpty(parentId)) {
screenPath = parentId + "." + screenPath;
}
}
StopWatch loadDescriptorWatch = new Slf4JStopWatch(screenPath + "#" + UIPerformanceLogger.LifeCycle.LOAD, LoggerFactory.getLogger(UIPerformanceLogger.class));
loadDescriptorWatch.start();
String currentFrameId = context.getCurrentFrameId();
try {
context.setCurrentFrameId(frameId);
frameLoader.loadComponent();
} finally {
context.setCurrentFrameId(currentFrameId);
loadDescriptorWatch.stop();
}
}
Aggregations