public MapPack fetch() { TcpProxy tcp = TcpProxy.getTcpProxy(serverId); Pack pack = null; try { MapPack param = new MapPack(); ListValue objLv = param.newList("objHash"); Map<Integer, AgentObject> agentMap = AgentModelThread.getInstance().getAgentObjectMap(); for (AgentObject p : agentMap.values()) { if (p.getObjType().equals(objType)) { objLv.add(p.getObjHash()); } } pack = tcp.getSingle(RequestCmd.REALTIME_SERVICE_GROUP, param); } catch (Throwable th) { th.printStackTrace(); } finally { TcpProxy.putTcpProxy(tcp); } MapPack m = null; if (pack != null) { m = (MapPack) pack; long time = TimeUtil.getCurrentTime(serverId); m.put("time", time); fiveMinMap.put(time, m); } return m; }
@ServiceHandler(RequestCmd.SERVER_DB_LIST) public void listDbFiles(DataInputX din, DataOutputX dout, boolean login) throws IOException { String rootPath = DBCtr.getRootPath(); MapPack m = new MapPack(); ListValue nameLv = m.newList("name"); ListValue sizeLv = m.newList("size"); ListValue lastModifiedLv = m.newList("lastModified"); File dbDir = new File(rootPath); long totalLength = 0; if (dbDir.exists() && dbDir.isDirectory()) { totalLength = collectDirectory(dbDir, nameLv, sizeLv, lastModifiedLv, dbDir.getAbsolutePath()); } if (SystemUtil.IS_JAVA_1_5 == false) { m.put("free", dbDir.getUsableSpace()); } m.put("total", totalLength); dout.writeByte(TcpFlag.HasNEXT); dout.writePack(m); dout.flush(); }
protected IStatus run(IProgressMonitor monitor) { TcpProxy tcp = TcpProxy.getTcpProxy(serverId); try { monitor.beginTask("Delete Server Files.....", IProgressMonitor.UNKNOWN); MapPack param = new MapPack(); ListValue fileLv = param.newList("file"); for (int i = 0; i < elements.length; i++) { if (elements[i] instanceof DirObject) { DirObject obj = (DirObject) elements[i]; fileLv.add(obj.name); } } MapPack m = (MapPack) tcp.getSingle(RequestCmd.SERVER_DB_DELETE, param); monitor.done(); int size = m.getInt("size"); ConsoleProxy.infoSafe(size + " directories is deleted."); load(); } catch (Exception e) { e.printStackTrace(); } finally { TcpProxy.putTcpProxy(tcp); } return Status.OK_STATUS; }