use of com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo in project pinpoint by naver.
the class GrpcThreadDumpBoMapper method map.
public ThreadDumpBo map(final PThreadDump threadDump) {
final ThreadDumpBo threadDumpBo = new ThreadDumpBo();
threadDumpBo.setThreadName(threadDump.getThreadName());
threadDumpBo.setThreadId(threadDump.getThreadId());
threadDumpBo.setBlockedTime(threadDump.getBlockedTime());
threadDumpBo.setBlockedCount(threadDump.getBlockedCount());
threadDumpBo.setWaitedTime(threadDump.getWaitedTime());
threadDumpBo.setWaitedCount(threadDump.getWaitedCount());
threadDumpBo.setLockName(threadDump.getLockName());
threadDumpBo.setLockOwnerId(threadDump.getLockOwnerId());
threadDumpBo.setLockOwnerName(threadDump.getLockOwnerName());
threadDumpBo.setInNative(threadDump.getInNative());
threadDumpBo.setSuspended(threadDump.getSuspended());
final PThreadState threadState = threadDump.getThreadState();
threadDumpBo.setThreadState(this.threadStateMapper.map(threadState));
threadDumpBo.setStackTraceList(threadDump.getStackTraceList());
if (CollectionUtils.hasLength(threadDump.getLockedMonitorList())) {
final List<MonitorInfoBo> monitorInfoBoList = new ArrayList<>();
for (PMonitorInfo monitorInfo : threadDump.getLockedMonitorList()) {
final MonitorInfoBo monitorInfoBo = this.monitorInfoBoMapper.map(monitorInfo);
monitorInfoBoList.add(monitorInfoBo);
}
threadDumpBo.setLockedMonitorInfoList(monitorInfoBoList);
}
threadDumpBo.setLockedSynchronizerList(threadDump.getLockedSynchronizerList());
return threadDumpBo;
}
use of com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo in project pinpoint by naver.
the class ThriftThreadDumpBoMapper method map.
public ThreadDumpBo map(final TThreadDump threadDump) {
final ThreadDumpBo threadDumpBo = new ThreadDumpBo();
threadDumpBo.setThreadName(threadDump.getThreadName());
threadDumpBo.setThreadId(threadDump.getThreadId());
threadDumpBo.setBlockedTime(threadDump.getBlockedTime());
threadDumpBo.setBlockedCount(threadDump.getBlockedCount());
threadDumpBo.setWaitedTime(threadDump.getWaitedTime());
threadDumpBo.setWaitedCount(threadDump.getWaitedCount());
threadDumpBo.setLockName(threadDump.getLockName());
threadDumpBo.setLockOwnerId(threadDump.getLockOwnerId());
threadDumpBo.setLockOwnerName(threadDump.getLockOwnerName());
threadDumpBo.setInNative(threadDump.isInNative());
threadDumpBo.setSuspended(threadDump.isSuspended());
final TThreadState threadState = threadDump.getThreadState();
threadDumpBo.setThreadState(this.threadStateMapper.map(threadState));
threadDumpBo.setStackTraceList(threadDump.getStackTrace());
if (CollectionUtils.hasLength(threadDump.getLockedMonitors())) {
final List<MonitorInfoBo> monitorInfoBoList = new ArrayList<>();
for (TMonitorInfo monitorInfo : threadDump.getLockedMonitors()) {
final MonitorInfoBo monitorInfoBo = this.monitorInfoBoMapper.map(monitorInfo);
monitorInfoBoList.add(monitorInfoBo);
}
threadDumpBo.setLockedMonitorInfoList(monitorInfoBoList);
}
threadDumpBo.setLockedSynchronizerList(threadDump.getLockedSynchronizers());
return threadDumpBo;
}
use of com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo in project pinpoint by naver.
the class AgentEventMessageDeserializerV1 method deserializeDeadlockBo.
private DeadlockBo deserializeDeadlockBo(final byte[] eventBody) {
final Buffer buffer = new FixedBuffer(eventBody);
final int deadlockedThreadCount = buffer.readInt();
final int threadDumpBoListSize = buffer.readVInt();
final List<ThreadDumpBo> threadDumpBoList = new ArrayList<>(threadDumpBoListSize);
if (threadDumpBoListSize > 0) {
threadDumpBoList.add(readThreadDumpBo(buffer));
}
final DeadlockBo deadlockBo = new DeadlockBo();
deadlockBo.setDeadlockedThreadCount(deadlockedThreadCount);
deadlockBo.setThreadDumpBoList(threadDumpBoList);
return deadlockBo;
}
use of com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo in project pinpoint by naver.
the class AgentEventMessageSerializerV1Test method serialize.
@Test
public void serialize() throws Exception {
AgentEventMessageSerializerV1 serializer = new AgentEventMessageSerializerV1();
// Mock
final DeadlockBo deadlockBo = new DeadlockBo();
deadlockBo.setDeadlockedThreadCount(1);
List<ThreadDumpBo> threadDumpBoList = new ArrayList<>();
ThreadDumpBo threadDumpBo = new ThreadDumpBo();
threadDumpBo.setThreadName("threadName");
threadDumpBo.setThreadId(0);
threadDumpBo.setBlockedTime(1);
threadDumpBo.setBlockedCount(2);
threadDumpBo.setWaitedTime(3);
threadDumpBo.setWaitedCount(4);
threadDumpBo.setLockName("lockName");
threadDumpBo.setLockOwnerId(5);
threadDumpBo.setLockOwnerName("lockOwnerName");
threadDumpBo.setInNative(Boolean.TRUE);
threadDumpBo.setSuspended(Boolean.FALSE);
threadDumpBo.setThreadState(ThreadState.RUNNABLE);
threadDumpBo.setStackTraceList(Arrays.asList("foo", "bar"));
List<MonitorInfoBo> monitorInfoBoList = new ArrayList<>();
MonitorInfoBo monitorInfoBo = new MonitorInfoBo();
monitorInfoBo.setStackDepth(9);
monitorInfoBo.setStackFrame("Frame");
monitorInfoBoList.add(monitorInfoBo);
threadDumpBo.setLockedMonitorInfoList(monitorInfoBoList);
threadDumpBo.setLockedSynchronizerList(Arrays.asList("foo", "bar"));
threadDumpBoList.add(threadDumpBo);
deadlockBo.setThreadDumpBoList(threadDumpBoList);
byte[] bytes = serializer.serialize(AgentEventType.AGENT_DEADLOCK_DETECTED, deadlockBo);
// deserialize
AgentEventMessageDeserializerV1 deserializer = new AgentEventMessageDeserializerV1();
Object object = deserializer.deserialize(AgentEventType.AGENT_DEADLOCK_DETECTED, bytes);
if (false == (object instanceof DeadlockBo)) {
fail("Failed to deserialize, expected object is DeadlockBo");
}
DeadlockBo result = (DeadlockBo) object;
assertEquals(1, result.getDeadlockedThreadCount());
assertEquals(1, result.getThreadDumpBoList().size());
assertThreadDumpBo(threadDumpBo, result.getThreadDumpBoList().get(0));
}
Aggregations