示例#1
0
    public final Object getColumnValue(Object row, int columnIndex) {
      try {
        Node node = (Node) row;

        switch (columnIndex) {
          case 0:
            if (node.label == null) {
              IObject obj = snapshot.getObject(node.objectId);
              node.label = obj.getDisplayName();
              node.shallowHeap = obj.getUsedHeapSize();
            }
            return node.label;
          case 1:
            if (node.shallowHeap == -1) node.shallowHeap = snapshot.getHeapSize(node.objectId);
            return node.shallowHeap;
          case 2:
            if (node.retainedHeap == -1)
              node.retainedHeap = snapshot.getRetainedHeapSize(node.objectId);
            return node.retainedHeap;
        }
      } catch (SnapshotException e) {
        throw new RuntimeException(e);
      }

      return null;
    }
示例#2
0
    public final String suffix(Object row) {
      Node node = (Node) row;
      if (node.gcRoots == null) {
        try {
          GCRootInfo[] gc = snapshot.getGCRootInfo(node.objectId);
          node.gcRoots = gc != null ? GCRootInfo.getTypeSetAsString(gc) : Node.NOT_A_GC_ROOT;
        } catch (SnapshotException e) {
          throw new RuntimeException(e);
        }
      }

      return node.gcRoots == Node.NOT_A_GC_ROOT ? null : node.gcRoots;
    }