public Object[] getElements(Object input) { LongEnumer keys = xlogMap.keys(); ArrayList<XLogConnection> list = new ArrayList<XLogConnection>(); LongKeyMap<Integer> countMap = new LongKeyMap<Integer>(); while (keys.hasMoreElements()) { long key = keys.nextLong(); XLogData d = xlogMap.get(key); long caller = d.p.caller; Integer cntInt = countMap.get(caller); if (cntInt == null) { cntInt = new Integer(1); countMap.put(caller, cntInt); } else { cntInt = new Integer(cntInt.intValue() + 1); countMap.put(caller, cntInt); } XLogConnection conn = new XLogConnection(caller, d); String serviceName = TextProxy.service.getLoadText(DateUtil.yyyymmdd(d.p.endTime), d.p.service, d.serverId); conn.name = "(" + cntInt.intValue() + ") " + serviceName.substring(serviceName.lastIndexOf("/"), serviceName.length()); conn.elapsed = d.p.elapsed; conn.error = d.p.error != 0; list.add(conn); } return list.toArray(); }
protected IStatus run(IProgressMonitor monitor) { monitor.beginTask("Find " + Hexa32.toString32(xlogData.p.txid), IProgressMonitor.UNKNOWN); final LongKeyLinkedMap<XLogData> xlogMap = new LongKeyLinkedMap<XLogData>(); xlogMap.put(xlogData.p.txid, xlogData); long callerId = xlogData.p.caller; boolean found = true; while (found && callerId != 0) { found = false; Iterator<Integer> itr = ServerManager.getInstance().getOpenServerList().iterator(); while (itr.hasNext()) { final int serverId = itr.next(); monitor.subTask(ServerManager.getInstance().getServer(serverId).getName()); TcpProxy tcp = TcpProxy.getTcpProxy(serverId); try { MapPack param = new MapPack(); param.put("date", date); param.put("txid", callerId); Pack p = tcp.getSingle(RequestCmd.XLOG_READ_BY_TXID, param); if (p != null) { XLogPack xlog = XLogUtil.toXLogPack(p); XLogData d = new XLogData(xlog, serverId); d.objName = TextProxy.object.getLoadText(date, d.p.objHash, serverId); xlogMap.put(xlog.txid, d); callerId = xlog.caller; found = true; break; } } catch (Throwable th) { ConsoleProxy.errorSafe(th.toString()); callerId = 0; } finally { TcpProxy.putTcpProxy(tcp); } } } ExUtil.exec( viewer.getGraphControl(), new Runnable() { public void run() { viewer.setInput(xlogMap); } }); return Status.OK_STATUS; }
public Object getSource(Object obj) { if (obj instanceof XLogConnection) { long key = ((XLogConnection) obj).sourceId; if (key == 0) { XLogData d = ((XLogConnection) obj).destXlog; return new StartHome(IPUtil.toString(d.p.ipaddr)); } return xlogMap.get(key); } return null; }