当前位置: 首页>>代码示例>>Java>>正文


Java DateUtil.MILLIS_PER_DAY属性代码示例

本文整理汇总了Java中scouter.util.DateUtil.MILLIS_PER_DAY属性的典型用法代码示例。如果您正苦于以下问题:Java DateUtil.MILLIS_PER_DAY属性的具体用法?Java DateUtil.MILLIS_PER_DAY怎么用?Java DateUtil.MILLIS_PER_DAY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在scouter.util.DateUtil的用法示例。


在下文中一共展示了DateUtil.MILLIS_PER_DAY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setInput

public void setInput(String sDate, String eDate, String objType, String counter, int serverId) throws Exception {
	this.sDate = sDate;
	this.eDate = eDate;
	this.objType = objType;
	this.counter = counter;
	this.mode = CounterUtil.getTotalMode(objType, counter);
	this.serverId = serverId;
	setViewTab(objType, counter, serverId, false);
	
	Server server = ServerManager.getInstance().getServer(serverId);
	String counterUnit = "";
	String counterDisplay = "";
	if(server != null){
		counterUnit = server.getCounterEngine().getCounterUnit(objType, counter);
		counterDisplay = server.getCounterEngine().getCounterDisplayName(objType, counter);
		desc = "(Period) [" + sDate.substring(0, 4) + "-" + sDate.substring(4, 6) + "-" + sDate.substring(6, 8) + 
				" ~ " + eDate.substring(0, 4) + "-" + eDate.substring(4, 6) + "-" + eDate.substring(6, 8) +
				"] Total " + counterDisplay;
	}
	serverText.setText("ⓢ"+((server == null)? "?":server.getName())+" |"+(!"".equals(counterUnit)?" ("+counterUnit+")":""));
	
	stime = DateUtil.getTime(sDate, "yyyyMMdd");
	etime = DateUtil.getTime(eDate, "yyyyMMdd") + DateUtil.MILLIS_PER_DAY;
	this.xyGraph.primaryXAxis.setRange(stime, etime);
	
	sDateText.setText(DateUtil.format(stime, "yyyy-MM-dd"));
	eDateText.setText(DateUtil.format(etime-1, "yyyy-MM-dd"));
	
	buffer = (int) ((etime - stime) / DateUtil.MILLIS_PER_FIVE_MINUTE);
	traceDataProvider.setBufferSize(buffer);
	
	MenuUtil.createCounterContextMenu(ID, canvas, serverId, objType, counter);
	
	ExUtil.asyncRun(new Runnable() {
		public void run() {
			load();
		}
	});
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:39,代码来源:CounterPastLongDateTotalView.java

示例2: getYesterdayData

private void getYesterdayData(String date) {
	TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
	List<Pack> out = null;
	try {
		MapPack param = new MapPack();
		param.put("counter", this.counter);
		param.put("date", date);
		param.put("objType", this.objType);
		out = tcp.process(RequestCmd.COUNTER_PAST_DATE_ALL, param);
	} catch (Throwable t) {
		ConsoleProxy.errorSafe(t.toString());
	} finally {
		TcpProxy.putTcpProxy(tcp);
	}
	final long[] values = new long[(int)(DateUtil.MILLIS_PER_DAY / DateUtil.MILLIS_PER_HOUR)];
	if (out != null) {
		Map<Long, Double> valueMap = ScouterUtil.getLoadTotalMap(counter, out, mode, TimeTypeEnum.FIVE_MIN);
		Iterator<Long> itr = valueMap.keySet().iterator();
		while (itr.hasNext()) {
			long time = itr.next();
			int index = (int) (DateUtil.getDateMillis(time) / DateUtil.MILLIS_PER_HOUR);
			values[index] += valueMap.get(time);
		}
	}
	ExUtil.exec(this.canvas, new Runnable() {
		public void run() {
			CircularBufferDataProvider yesterdayProvider = (CircularBufferDataProvider) yesterdayTrace.getDataProvider();
			yesterdayProvider.clearTrace();
			for (int i = 0; i < values.length; i++) {
				yesterdayProvider.addSample(new Sample(CastUtil.cdouble(i) + 0.5d, CastUtil.cdouble(values[i])));
			}
			yesterdayMax = ChartUtil.getMax(yesterdayProvider.iterator());
		}
	});
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:35,代码来源:CounterTodayCountView.java

示例3: setInput

public void setInput(String date, String objType) {
	this.date = date;
	this.objType = objType;
	setTitleImage(Images.getObjectIcon(objType, true, serverId));
	openTotalGraph();
	rangeX1 = DateUtil.yyyymmdd(date);
	rangeX2 = rangeX1 + DateUtil.MILLIS_PER_DAY - 1;
	updateTextDate();
	loadTagGroup();
	serviceTable.setInput(new ArrayList<Pack>(), serverId, date);
	alertTable.setInput(new ArrayList<Pack>(), serverId, date);
	totalCanvas.notifyListeners(SWT.Resize, new Event());
	zoomMode = false;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:14,代码来源:TagCountView.java

示例4: getTimeFormat

public static String getTimeFormat(long unit) {
	if (unit <= DateUtil.MILLIS_PER_HOUR)
		return "HH:mm:ss";
	if (unit <= DateUtil.MILLIS_PER_DAY)
		return "HH:mm";
	return "yyyy-MM-dd";
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:7,代码来源:ChartUtil.java

示例5: clearOldLog

protected static void clearOldLog() {
	if (conf.log_rotation_enalbed == false)
		return;
	if (conf.log_keep_days <= 0)
		return;
	long nowUnit = DateUtil.getDateUnit();
	File dir = new File(conf.log_dir);
	File[] files = dir.listFiles();
	for (int i = 0; i < files.length; i++) {
		if (files[i].isDirectory())
			continue;
		String name = files[i].getName();
		if (name.startsWith("agent-") == false)
			continue;
		int x = name.lastIndexOf('.');
		if (x < 0)
			continue;
		String date = name.substring("agent-".length(), x);
		if (date.length() != 8)
			continue;

		try {
			long d = DateUtil.yyyymmdd(date);
			long fileUnit = DateUtil.getDateUnit(d);
			if (nowUnit - fileUnit > DateUtil.MILLIS_PER_DAY * conf.log_keep_days) {
				files[i].delete();
			}
		} catch (Exception e) {
		}
	}

}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:32,代码来源:Logger.java

示例6: refresh

public void refresh() {
	ScouterUtil.collectGroupObjcts(grpName, serverObjMap);
	isActive = false;
	Iterator<Integer> serverIds = serverObjMap.keySet().iterator();
	final List<Pack> result = new ArrayList<Pack>();
	while (serverIds.hasNext()) {
		int serverId = serverIds.next();
		TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
		try {
			MapPack param = new MapPack();
			param.put("counter", counter);
			param.put("objHash", serverObjMap.get(serverId));
			tcp.process(RequestCmd.COUNTER_TODAY_GROUP, param, new INetReader() {
				public void process(DataInputX in) throws IOException {
					Pack p = in.readPack();
					if (p != null) {
						result.add(p);
					}
				}
			});
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			TcpProxy.putTcpProxy(tcp);
		}
	}
	final long[] values = new long[(int)(DateUtil.MILLIS_PER_DAY / DateUtil.MILLIS_PER_HOUR)];
	if (result.size() > 0) {
		Map<Long, Double> valueMap = ScouterUtil.getLoadTotalMap(counter, result, mode, TimeTypeEnum.FIVE_MIN);
		Iterator<Long> itr = valueMap.keySet().iterator();
		while (itr.hasNext()) {
			long time = itr.next();
			int index = (int) (DateUtil.getDateMillis(time) / DateUtil.MILLIS_PER_HOUR);
			values[index] += valueMap.get(time);
		}
		isActive = true;
	}
	ExUtil.exec(this.canvas, new Runnable() {
		public void run() {
			if (isActive == true) {
				setActive();
			} else {
				setInactive();
				return;
			}
			double max = 0;
			traceDataProvider.clearTrace();
			for (int i = 0; i < values.length; i++) {
				traceDataProvider.addSample(new Sample(CastUtil.cdouble(i) + 0.5d, CastUtil.cdouble(values[i])));
			}
			max = Math.max(ChartUtil.getMax(traceDataProvider.iterator()), max);
			if (CounterUtil.isPercentValue(objType, counter)) {
				xyGraph.primaryYAxis.setRange(0, 100);
			} else {
				xyGraph.primaryYAxis.setRange(0, max);
			}
			canvas.redraw();
			xyGraph.repaint();
		}
	});
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:61,代码来源:CounterTodayGroupCountView.java

示例7: load

private void load() {
	final long stime = DateUtil.yyyymmdd(sDate);
	final long etime = DateUtil.yyyymmdd(eDate) + (DateUtil.MILLIS_PER_DAY - 1);
	collectObj();
	Iterator<Integer> serverIds = serverObjMap.keySet().iterator();
	final List<Pack> result = new ArrayList<Pack>();
	while (serverIds.hasNext()) {
		int serverId = serverIds.next();
		TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
		try {
			MapPack param = new MapPack();
			param.put("stime", stime);
			param.put("etime", etime);
			param.put("counter", counter);
			param.put("objHash", serverObjMap.get(serverId));
			tcp.process(RequestCmd.COUNTER_PAST_LONGDATE_GROUP, param, new INetReader() {
				public void process(DataInputX in) throws IOException {
					Pack p = in.readPack();
					result.add(p);
				}
			});
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			TcpProxy.putTcpProxy(tcp);
		}
	}
	ExUtil.exec(canvas, new Runnable() {
		public void run() {
			xyGraph.primaryXAxis.setRange(stime, etime);
			for (Pack pack : result) {
				if ((pack instanceof MapPack) == false) {
					continue;
				}
				MapPack m = (MapPack) pack;
				int objHash = m.getInt("objHash");
				ListValue time = m.getList("time");
				ListValue value = m.getList("value");
				if (time == null || time.size() < 1) {
					continue;
				}
				CircularBufferDataProvider provider = (CircularBufferDataProvider) getDataProvider(objHash, (int) ((etime - stime) / DateUtil.MILLIS_PER_FIVE_MINUTE));
				provider.clearTrace();
				for (int i = 0; i < time.size(); i++) {
					long x = time.getLong(i);
					double y = value.getDouble(i);
					provider.addSample(new Sample(x, y));
				}
			}
			if (CounterUtil.isPercentValue(objType, counter)) {
				xyGraph.primaryYAxis.setRange(0, 100);
			} else {
				double max = getMaxValue();
					xyGraph.primaryYAxis.setRange(0, max);
			}
		}
	});
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:58,代码来源:CounterPastDateGroupAllView.java

示例8: load

public void load() {
	ScouterUtil.collectGroupObjcts(grpName, serverObjMap);
	Iterator<Integer> serverIds = serverObjMap.keySet().iterator();
	final List<Pack> result = new ArrayList<Pack>();
	while (serverIds.hasNext()) {
		int serverId = serverIds.next();
		TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
		try {
			MapPack param = new MapPack();
			param.put("counter", counter);
			param.put("date", date);
			param.put("objHash", serverObjMap.get(serverId));
			tcp.process(RequestCmd.COUNTER_PAST_DATE_GROUP, param, new INetReader() {
				public void process(DataInputX in) throws IOException {
					Pack p = in.readPack();
					if (p != null) {
						result.add(p);
					}
				}
			});
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			TcpProxy.putTcpProxy(tcp);
		}
	}
	final long[] values = new long[(int)(DateUtil.MILLIS_PER_DAY / DateUtil.MILLIS_PER_HOUR)];
	if (result.size() > 0) {
		Map<Long, Double> valueMap = ScouterUtil.getLoadTotalMap(counter, result, mode, TimeTypeEnum.FIVE_MIN);
		Iterator<Long> itr = valueMap.keySet().iterator();
		while (itr.hasNext()) {
			long time = itr.next();
			int index = (int) (DateUtil.getDateMillis(time) / DateUtil.MILLIS_PER_HOUR);
			values[index] += valueMap.get(time);
		}
	}
	ExUtil.exec(this.canvas, new Runnable() {
		public void run() {
			double max = 0;
			traceDataProvider.clearTrace();
			for (int i = 0; i < values.length; i++) {
				traceDataProvider.addSample(new Sample(CastUtil.cdouble(i) + 0.5d, CastUtil.cdouble(values[i])));
			}
			max = Math.max(ChartUtil.getMax(traceDataProvider.iterator()), max);
			if (CounterUtil.isPercentValue(objType, counter)) {
				xyGraph.primaryYAxis.setRange(0, 100);
			} else {
					xyGraph.primaryYAxis.setRange(0, max);
			}
			canvas.redraw();
			xyGraph.repaint();
		}
	});
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:54,代码来源:CounterPastDateGroupCountView.java

示例9: load

private void load() {
	final long stime = DateUtil.getTime(sDate, "yyyyMMdd");
	final long etime = DateUtil.getTime(eDate, "yyyyMMdd") + (DateUtil.MILLIS_PER_DAY - 1);
	collectObj();
	Iterator<Integer> serverIds = serverObjMap.keySet().iterator();
	final List<Pack> result = new ArrayList<Pack>();
	while (serverIds.hasNext()) {
		int serverId = serverIds.next();
		TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
		try {
			MapPack param = new MapPack();
			param.put("stime", stime);
			param.put("etime", etime);
			param.put("counter", counter);
			param.put("objHash", serverObjMap.get(serverId));
			tcp.process(RequestCmd.COUNTER_PAST_LONGDATE_GROUP, param, new INetReader() {
				public void process(DataInputX in) throws IOException {
					Pack p = in.readPack();
					result.add(p);
				}
			});
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			TcpProxy.putTcpProxy(tcp);
		}
	}
	final Map<Long, Double> valueMap = ScouterUtil.getLoadTotalMap(counter, result, mode, TimeTypeEnum.FIVE_MIN);
	ExUtil.exec(canvas, new Runnable() {
		public void run() {
			xyGraph.primaryXAxis.setRange(stime, etime);
			CircularBufferDataProvider provider = (CircularBufferDataProvider) getDataProvider((int)((etime - stime) / DateUtil.MILLIS_PER_FIVE_MINUTE));
			provider.clearTrace();
			Set<Long> timeSet = valueMap.keySet();
			for (long time : timeSet) {
				provider.addSample(new Sample(time, CastUtil.cdouble(valueMap.get(time))));
			}
			if (CounterUtil.isPercentValue(objType, counter)) {
				xyGraph.primaryYAxis.setRange(0, 100);
			} else {
				double max = ChartUtil.getMax(provider.iterator());
				xyGraph.primaryYAxis.setRange(0, max);
			}
			applyBtn.setEnabled(true);
			canvas.redraw();
		}
	});
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:48,代码来源:CounterPastDateGroupTotalView.java

示例10: setInput

public void setInput(String sDate, String eDate, String objType, String counter, int serverId) throws Exception {
	this.sDate = sDate;
	this.eDate = eDate;
	this.objType = objType;
	this.counter = counter;
	this.serverId = serverId;
	setViewTab(objType, counter, serverId, false);
	
	stime = DateUtil.getTime(sDate, "yyyyMMdd");
	etime = DateUtil.getTime(eDate, "yyyyMMdd") + DateUtil.MILLIS_PER_DAY;
	this.xyGraph.primaryXAxis.setRange(stime, etime);
	
	Server server = ServerManager.getInstance().getServer(serverId);
	String counterUnit = "";
	String counterDisplay = "";
	if(server != null){
		counterUnit = server.getCounterEngine().getCounterUnit(objType, counter);
		counterDisplay = server.getCounterEngine().getCounterDisplayName(objType, counter);
		desc = "(Daily All) [" + sDate.substring(0, 4) + "-" + sDate.substring(4, 6) + "-" + sDate.substring(6, 8) + 
				" ~ " + eDate.substring(0, 4) + "-" + eDate.substring(4, 6) + "-" + eDate.substring(6, 8) +
				"]" + counterDisplay;
	}
	serverText.setText("ⓢ"+((server == null)? "?":server.getName())+" |"+(!"".equals(counterUnit)?" ("+counterUnit+")":""));
	sDateText.setText(DateUtil.format(stime, "yyyy-MM-dd"));
	eDateText.setText(DateUtil.format(etime-1, "yyyy-MM-dd"));
	
	buffer = (int) ((etime - stime) / DateUtil.MILLIS_PER_FIVE_MINUTE);
	
	Iterator<Trace> itr = traces.values().iterator();
	while (itr.hasNext()) {
		Trace tr = itr.next();
		this.xyGraph.removeTrace(tr);
	}
	traces.clear();
	
	MenuUtil.createCounterContextMenu(ID, canvas, serverId, objType, counter);
	
	ExUtil.asyncRun(new Runnable() {
		public void run() {
			load(CounterPastLongDateAllView.this.sDate, CounterPastLongDateAllView.this.eDate, CounterPastLongDateAllView.this.counter);
		}
	});
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:43,代码来源:CounterPastLongDateAllView.java

示例11: run

protected IStatus run(IProgressMonitor monitor) {
	TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
	List<Pack> out = null;
	try {
		MapPack param = new MapPack();
		param.put("date", date);
		param.put("counter", counter);
		param.put("objType", objType);
		out = tcp.process(RequestCmd.COUNTER_PAST_DATE_ALL, param);
	} catch (Throwable t) {
		ConsoleProxy.errorSafe(t.toString());
	} finally {
		TcpProxy.putTcpProxy(tcp);
	}
	final long[] values = new long[(int)(DateUtil.MILLIS_PER_DAY / DateUtil.MILLIS_PER_HOUR)];
	if (out != null) {
		Map<Long, Double> valueMap = ScouterUtil.getLoadTotalMap(counter, out, mode, TimeTypeEnum.FIVE_MIN);
		Iterator<Long> itr = valueMap.keySet().iterator();
		while (itr.hasNext()) {
			long time = itr.next();
			int index = (int) (DateUtil.getDateMillis(time) / DateUtil.MILLIS_PER_HOUR);
			values[index] += valueMap.get(time);
		}
	}
	
	ExUtil.exec(canvas, new Runnable() {
		public void run() {
			double max = 0;
			traceDataProvider.clearTrace();
			for (int i = 0; i < values.length; i++) {
				traceDataProvider.addSample(new Sample(CastUtil.cdouble(i) + 0.5d, CastUtil.cdouble(values[i])));
			}
			max = Math.max(ChartUtil.getMax(traceDataProvider.iterator()), max);
			if (CounterUtil.isPercentValue(objType, counter)) {
				xyGraph.primaryYAxis.setRange(0, 100);
			} else {
					xyGraph.primaryYAxis.setRange(0, max);
			}
			redraw();
		}
	});
	return Status.OK_STATUS;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:43,代码来源:CounterPastCountView.java

示例12: refresh

public void refresh() {
	String date =  DateUtil.yyyymmdd(TimeUtil.getCurrentTime(serverId) - DateUtil.MILLIS_PER_DAY);
	if (date.equals(yesterday) == false) {
		yesterday = date;
		getYesterdayData(date);
	}
	isActive = false;
	TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
	List<Pack> out = null;
	try {
		MapPack param = new MapPack();
		param.put("counter", this.counter);
		param.put("objType", this.objType);
		out = tcp.process(RequestCmd.COUNTER_TODAY_ALL, param);
	} catch (Throwable t) {
		ConsoleProxy.errorSafe(t.toString());
	} finally {
		TcpProxy.putTcpProxy(tcp);
	}
	final long[] values = new long[(int)(DateUtil.MILLIS_PER_DAY / DateUtil.MILLIS_PER_HOUR)];
	if (out != null && out.size() > 0) {
		Map<Long, Double> valueMap = ScouterUtil.getLoadTotalMap(counter, out, mode, TimeTypeEnum.FIVE_MIN);
		Iterator<Long> itr = valueMap.keySet().iterator();
		while (itr.hasNext()) {
			long time = itr.next();
			int index = (int) (DateUtil.getDateMillis(time) / DateUtil.MILLIS_PER_HOUR);
			values[index] += valueMap.get(time);
		}
		isActive = true;
	}
	ExUtil.exec(this.canvas, new Runnable() {
		public void run() {
			if (isActive == true) {
				setActive();
				traceDataProvider.clearTrace();
				for (int i = 0; i < values.length; i++) {
					traceDataProvider.addSample(new Sample(CastUtil.cdouble(i) + 0.5d, CastUtil.cdouble(values[i])));
				}
			} else {
				setInactive();
			}
			if (CounterUtil.isPercentValue(objType, counter)) {
				xyGraph.primaryYAxis.setRange(0, 100);
			} else {
				double max = ChartUtil.getMax(traceDataProvider.iterator());
				max = Math.max(max, yesterdayMax);
					xyGraph.primaryYAxis.setRange(0, max);
			}
			canvas.redraw();
			xyGraph.repaint();
		}
	});
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:53,代码来源:CounterTodayCountView.java

示例13: run

protected IStatus run(IProgressMonitor monitor) {
    TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
    List<Pack> packList = new ArrayList<>();
    try {
        while (stime <= etime) {
            String date = DateUtil.yyyymmdd(stime);
            long lastTimestampOfDay = DateUtil.getTime(date, "yyyyMMdd") + DateUtil.MILLIS_PER_DAY - 1;
            param.put("date", date);
            param.put("stime", stime);
            param.put("etime", lastTimestampOfDay <= etime ? lastTimestampOfDay : etime);
            packList.add(tcp.getSingle(RequestCmd.LOAD_SERVICE_SUMMARY, param));
            stime += DateUtil.MILLIS_PER_DAY;
        }
    } catch (Exception e) {
        e.printStackTrace();
        return Status.CANCEL_STATUS;
    } finally {
        TcpProxy.putTcpProxy(tcp);
    }

    if (packList.size() > 0) {
        Map<Integer, SummaryData> summaryDataMap = new HashMap<>();
        for (Pack p : packList) {
            MapPack m = (MapPack) p;
            ListValue idLv = m.getList("id");
            ListValue countLv = m.getList("count");
            ListValue errorLv = m.getList("error");
            ListValue elapsedLv = m.getList("elapsed");
            ListValue cpuLv = m.getList("cpu");
            ListValue memLv = m.getList("mem");
            for (int i = 0; i < idLv.size(); i++) {
                SummaryData data = new SummaryData();
                data.hash = idLv.getInt(i);
                data.count = countLv.getInt(i);
                data.errorCount = errorLv.getInt(i);
                data.elapsedSum = elapsedLv.getLong(i);
                data.cpu = cpuLv.getLong(i);
                data.mem = memLv.getLong(i);
                if (summaryDataMap.containsKey(data.hash)) {
                    summaryDataMap.get(data.hash).addData(data);
                } else {
                    summaryDataMap.put(data.hash, data);
                }
            }
            TextProxy.service.load(date, idLv, serverId);
        }
        ExUtil.exec(viewer.getTable(), new Runnable() {
            public void run() {
                viewer.setInput(summaryDataMap.values());
            }
        });
    }
    return Status.OK_STATUS;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:54,代码来源:ServiceSummaryComposite.java

示例14: run

protected IStatus run(IProgressMonitor monitor) {
    TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
    List<Pack> packList = new ArrayList<>();
    try {
        while (stime <= etime) {
            String date = DateUtil.yyyymmdd(stime);
            long lastTimestampOfDay = DateUtil.getTime(date, "yyyyMMdd") + DateUtil.MILLIS_PER_DAY - 1;
            param.put("date", date);
            param.put("stime", stime);
            param.put("etime", lastTimestampOfDay <= etime ? lastTimestampOfDay : etime);
            packList.add(tcp.getSingle(RequestCmd.LOAD_UA_SUMMARY, param));
            stime += DateUtil.MILLIS_PER_DAY;
        }
    } catch (Exception e) {
        e.printStackTrace();
        return Status.CANCEL_STATUS;
    } finally {
        TcpProxy.putTcpProxy(tcp);
    }

    if (packList.size() > 0) {
        Map<Integer, SummaryData> summaryDataMap = new HashMap<>();
        for (Pack p : packList) {
            MapPack m = (MapPack) p;
            ListValue idLv = m.getList("id");
            ListValue countLv = m.getList("count");
            for (int i = 0; i < idLv.size(); i++) {
                SummaryData data = new SummaryData();
                data.hash = idLv.getInt(i);
                data.count = countLv.getInt(i);
                if (summaryDataMap.containsKey(data.hash)) {
                    summaryDataMap.get(data.hash).addData(data);
                } else {
                    summaryDataMap.put(data.hash, data);
                }
            }
            TextProxy.userAgent.load(date, idLv, serverId);
        }
        ExUtil.exec(viewer.getTable(), new Runnable() {
            public void run() {
                viewer.setInput(summaryDataMap.values());
            }
        });
    }
    return Status.OK_STATUS;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:46,代码来源:UserAgentSummaryComposite.java

示例15: run

protected IStatus run(IProgressMonitor monitor) {
    TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
    List<Pack> packList = new ArrayList<>();
    try {
        while (stime <= etime) {
            String date = DateUtil.yyyymmdd(stime);
            long lastTimestampOfDay = DateUtil.getTime(date, "yyyyMMdd") + DateUtil.MILLIS_PER_DAY - 1;
            param.put("date", date);
            param.put("stime", stime);
            param.put("etime", lastTimestampOfDay <= etime ? lastTimestampOfDay : etime);
            packList.add(tcp.getSingle(RequestCmd.LOAD_ALERT_SUMMARY, param));
            stime += DateUtil.MILLIS_PER_DAY;
        }
    } catch (Exception e) {
        e.printStackTrace();
        return Status.CANCEL_STATUS;
    } finally {
        TcpProxy.putTcpProxy(tcp);
    }

    if (packList.size() > 0) {
        Map<String, AlertData> alertDataMap = new HashMap<>();
        for (Pack p : packList) {
            MapPack m = (MapPack) p;
            
            ListValue titleLv = m.getList("title");
	ListValue levelLv = m.getList("level");
	ListValue countLv = m.getList("count");
	for (int i = 0; i < titleLv.size(); i++) {
		AlertData data = new AlertData();
		data.title = titleLv.getString(i);
		data.level = (byte) levelLv.getInt(i);
		data.count = countLv.getInt(i);
		if (alertDataMap.containsKey(data.title)) {
			alertDataMap.get(data.title).addData(data);
		} else {
			alertDataMap.put(data.title, data);
		}
	}                    
        }
        ExUtil.exec(viewer.getTable(), new Runnable() {
            public void run() {
                viewer.setInput(alertDataMap.values());
            }
        });
    }
    return Status.OK_STATUS;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:48,代码来源:AlertSummaryComposite.java


注:本文中的scouter.util.DateUtil.MILLIS_PER_DAY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。