use of com.navercorp.pinpoint.common.server.bo.event.DeadlockBo 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.DeadlockBo 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