use of com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo in project pinpoint by naver.
the class GrpcDeadlockBoMapper method map.
public DeadlockBo map(final PDeadlock deadlock) {
final DeadlockBo deadlockBo = new DeadlockBo();
deadlockBo.setDeadlockedThreadCount(deadlock.getCount());
final List<PThreadDump> threadDumpList = deadlock.getThreadDumpList();
if (CollectionUtils.hasLength(threadDumpList)) {
final List<ThreadDumpBo> threadDumpBoList = new ArrayList<>();
for (PThreadDump threadDump : threadDumpList) {
final ThreadDumpBo threadDumpBo = this.threadDumpBoMapper.map(threadDump);
threadDumpBoList.add(threadDumpBo);
}
deadlockBo.setThreadDumpBoList(threadDumpBoList);
}
return deadlockBo;
}
use of com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo in project pinpoint by naver.
the class ThriftDeadlockBoMapper method map.
public DeadlockBo map(final TDeadlock tDeadlock) {
final DeadlockBo deadlockBo = new DeadlockBo();
deadlockBo.setDeadlockedThreadCount(tDeadlock.getDeadlockedThreadCount());
if (tDeadlock.isSetDeadlockedThreadList()) {
final List<ThreadDumpBo> threadDumpBoList = new ArrayList<>();
for (TThreadDump threadDump : tDeadlock.getDeadlockedThreadList()) {
final ThreadDumpBo threadDumpBo = this.threadDumpBoMapper.map(threadDump);
threadDumpBoList.add(threadDumpBo);
}
deadlockBo.setThreadDumpBoList(threadDumpBoList);
}
return deadlockBo;
}
use of com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo in project pinpoint by naver.
the class AgentEventMessageDeserializerV1 method readThreadDumpBo.
private ThreadDumpBo readThreadDumpBo(final Buffer buffer) {
final String threadName = buffer.readPrefixedString();
final long threadId = buffer.readLong();
final long blockedTime = buffer.readLong();
final long blockedCount = buffer.readLong();
final long waitedTime = buffer.readLong();
final long waitedCount = buffer.readLong();
final String lockName = buffer.readPrefixedString();
final long lockOwnerId = buffer.readLong();
final String lockOwnerName = buffer.readPrefixedString();
final boolean inNative = buffer.readBoolean();
final boolean suspended = buffer.readBoolean();
final int threadStateValue = buffer.readInt();
final int stackTraceListSize = buffer.readVInt();
final List<String> stackTraceList = new ArrayList<>(stackTraceListSize);
if (stackTraceListSize > 0) {
for (int i = 0; i < stackTraceListSize; i++) {
final String string = buffer.readPrefixedString();
stackTraceList.add(string);
}
}
final int lockedMonitorListSize = buffer.readVInt();
final List<MonitorInfoBo> monitorInfoBoList = new ArrayList<>(lockedMonitorListSize);
if (lockedMonitorListSize > 0) {
for (int i = 0; i < lockedMonitorListSize; i++) {
final MonitorInfoBo monitorInfoBo = readMonitorInfoBo(buffer);
monitorInfoBoList.add(monitorInfoBo);
}
}
final int lockedSynchronizerListSize = buffer.readVInt();
final List<String> lockedSynchronizerList = new ArrayList<>(lockedSynchronizerListSize);
if (lockedSynchronizerListSize > 0) {
for (int i = 0; i < lockedSynchronizerListSize; i++) {
final String string = buffer.readPrefixedString();
lockedSynchronizerList.add(string);
}
}
final ThreadDumpBo threadDumpBo = new ThreadDumpBo();
threadDumpBo.setThreadName(threadName);
threadDumpBo.setThreadId(threadId);
threadDumpBo.setBlockedTime(blockedTime);
threadDumpBo.setBlockedCount(blockedCount);
threadDumpBo.setWaitedTime(waitedTime);
threadDumpBo.setWaitedCount(waitedCount);
threadDumpBo.setLockName(lockName);
threadDumpBo.setLockOwnerId(lockOwnerId);
threadDumpBo.setLockOwnerName(lockOwnerName);
threadDumpBo.setInNative(inNative);
threadDumpBo.setSuspended(suspended);
threadDumpBo.setThreadState(ThreadState.findByValue(threadStateValue));
threadDumpBo.setStackTraceList(stackTraceList);
threadDumpBo.setLockedMonitorInfoList(monitorInfoBoList);
threadDumpBo.setLockedSynchronizerList(lockedSynchronizerList);
return threadDumpBo;
}
use of com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo in project pinpoint by naver.
the class AgentEventMessageSerializerV1 method serializeDeadlockBo.
private byte[] serializeDeadlockBo(final DeadlockBo deadlockBo) {
final Buffer buffer = new AutomaticBuffer();
buffer.putInt(deadlockBo.getDeadlockedThreadCount());
// Put ThreadDumpBoList
final int threadDumpBoListSize = deadlockBo.getThreadDumpBoList() == null ? 0 : deadlockBo.getThreadDumpBoList().size();
buffer.putVInt(threadDumpBoListSize);
if (threadDumpBoListSize > 0) {
for (ThreadDumpBo threadDumpBo : deadlockBo.getThreadDumpBoList()) {
putThreadDumpBo(buffer, threadDumpBo);
}
}
return buffer.getBuffer();
}
use of com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo in project pinpoint by naver.
the class AgentEventSerializer method serialize.
@Override
public void serialize(AgentEvent agentEvent, JsonGenerator jgen, SerializerProvider serializers) throws IOException {
jgen.writeStartObject();
if (agentEvent.getAgentId() != null) {
jgen.writeStringField("agentId", agentEvent.getAgentId());
}
jgen.writeNumberField("startTimestamp", agentEvent.getStartTimestamp());
jgen.writeNumberField("eventTimestamp", agentEvent.getEventTimestamp());
jgen.writeNumberField("eventTypeCode", agentEvent.getEventTypeCode());
if (agentEvent.getEventTypeDesc() != null) {
jgen.writeStringField("eventTypeDesc", agentEvent.getEventTypeDesc());
}
jgen.writeBooleanField("hasEventMessage", agentEvent.hasEventMessage());
if (agentEvent.getEventMessage() != null) {
Object eventMessage = agentEvent.getEventMessage();
if (eventMessage instanceof TDeadlock) {
StringBuilder message = new StringBuilder();
List<TThreadDump> deadlockedThreadList = ((TDeadlock) eventMessage).getDeadlockedThreadList();
for (TThreadDump threadDump : deadlockedThreadList) {
message.append(ThreadDumpUtils.createDumpMessage(threadDump));
}
jgen.writeObjectField("eventMessage", message.toString());
} else if (eventMessage instanceof DeadlockBo) {
final StringBuilder message = new StringBuilder();
final List<ThreadDumpBo> threadDumpBoList = ((DeadlockBo) eventMessage).getThreadDumpBoList();
for (ThreadDumpBo threadDump : threadDumpBoList) {
message.append(ThreadDumpUtils.createDumpMessage(threadDump));
}
jgen.writeObjectField("eventMessage", message.toString());
} else {
jgen.writeObjectField("eventMessage", eventMessage);
}
}
jgen.writeEndObject();
}
Aggregations