Search in sources :

Example 6 with ThreadDumpBo

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;
}
Also used : PMonitorInfo(com.navercorp.pinpoint.grpc.trace.PMonitorInfo) ArrayList(java.util.ArrayList) PThreadState(com.navercorp.pinpoint.grpc.trace.PThreadState) MonitorInfoBo(com.navercorp.pinpoint.common.server.bo.event.MonitorInfoBo) ThreadDumpBo(com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo)

Example 7 with 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;
}
Also used : TThreadState(com.navercorp.pinpoint.thrift.dto.command.TThreadState) TMonitorInfo(com.navercorp.pinpoint.thrift.dto.command.TMonitorInfo) ArrayList(java.util.ArrayList) MonitorInfoBo(com.navercorp.pinpoint.common.server.bo.event.MonitorInfoBo) ThreadDumpBo(com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo)

Example 8 with 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;
}
Also used : FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) DeadlockBo(com.navercorp.pinpoint.common.server.bo.event.DeadlockBo) FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) ArrayList(java.util.ArrayList) ThreadDumpBo(com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo)

Example 9 with ThreadDumpBo

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));
}
Also used : DeadlockBo(com.navercorp.pinpoint.common.server.bo.event.DeadlockBo) ArrayList(java.util.ArrayList) MonitorInfoBo(com.navercorp.pinpoint.common.server.bo.event.MonitorInfoBo) ThreadDumpBo(com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo) Test(org.junit.Test)

Aggregations

ThreadDumpBo (com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo)9 ArrayList (java.util.ArrayList)7 DeadlockBo (com.navercorp.pinpoint.common.server.bo.event.DeadlockBo)5 MonitorInfoBo (com.navercorp.pinpoint.common.server.bo.event.MonitorInfoBo)4 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)2 TThreadDump (com.navercorp.pinpoint.thrift.dto.command.TThreadDump)2 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)1 FixedBuffer (com.navercorp.pinpoint.common.buffer.FixedBuffer)1 PMonitorInfo (com.navercorp.pinpoint.grpc.trace.PMonitorInfo)1 PThreadDump (com.navercorp.pinpoint.grpc.trace.PThreadDump)1 PThreadState (com.navercorp.pinpoint.grpc.trace.PThreadState)1 TDeadlock (com.navercorp.pinpoint.thrift.dto.TDeadlock)1 TMonitorInfo (com.navercorp.pinpoint.thrift.dto.command.TMonitorInfo)1 TThreadState (com.navercorp.pinpoint.thrift.dto.command.TThreadState)1 List (java.util.List)1 Test (org.junit.Test)1