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


Java DateUtil.getDateMillis方法代码示例

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


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

示例1: getYesterdayData

import scouter.util.DateUtil; //导入方法依赖的package包/类
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,代码行数:36,代码来源:CounterTodayCountView.java

示例2: _offset

import scouter.util.DateUtil; //导入方法依赖的package包/类
private int _offset(long time) {
    int seconds = DateUtil.getDateMillis(time) / 500;
    int hash = seconds % capacity;
    return _keyLength * hash + _memHeadReserved;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:6,代码来源:MemTimeBlock.java

示例3: refresh

import scouter.util.DateUtil; //导入方法依赖的package包/类
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,代码行数:62,代码来源:CounterTodayGroupCountView.java

示例4: load

import scouter.util.DateUtil; //导入方法依赖的package包/类
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,代码行数:55,代码来源:CounterPastDateGroupCountView.java

示例5: run

import scouter.util.DateUtil; //导入方法依赖的package包/类
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,代码行数:44,代码来源:CounterPastCountView.java

示例6: refresh

import scouter.util.DateUtil; //导入方法依赖的package包/类
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,代码行数:54,代码来源:CounterTodayCountView.java


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