• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DateUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: xlog

import scouter.util.DateUtil; //导入依赖的package包/类
@ServerPlugin(PluginConstants.PLUGIN_SERVER_XLOG)
public void xlog(XLogPack pack) {
	if (conf.getBoolean("ext_plugin_teamup_xlog_enabled", true)) {
		println("[ext_plugin_teamup_xlog_enabled true]");
		if (pack.error != 0) {
			String date = DateUtil.yyyymmdd(pack.endTime);
			String service = TextRD.getString(date, TextTypes.SERVICE, pack.service);
			String patterns = conf.getValue("ext_plugin_teamup_error_escape_method_patterns").length()>0?conf.getValue("ext_plugin_teamup_error_escape_method_patterns"):"*";
			if (!PatternsUtil.isValid(patterns, service)) {
				AlertPack ap = new AlertPack();
				ap.level = AlertLevel.ERROR;
				ap.objHash = pack.objHash;
				ap.title = "Ultron Error";
				ap.message = service + " - " + TextRD.getString(date, TextTypes.ERROR, pack.error);
				ap.time = System.currentTimeMillis();
				ap.objType = "scouter";
				alert(ap);
			}else{
				println("escape service : " + service);
			}
		}
	}
}
 
开发者ID:kingbbode,项目名称:scouter-plugin-server-alert-teamup,代码行数:24,代码来源:TeamUpPlugin.java


示例2: xlog

import scouter.util.DateUtil; //导入依赖的package包/类
/**
   * XLogPack 발생 시 처리
   * @param pack
   */
  @ServerPlugin(PluginConstants.PLUGIN_SERVER_XLOG)
  public void xlog(XLogPack pack) {
  	try {
   	if (serviceStatMap.get(pack.objHash) == null) {
   		serviceStatMap.put(pack.objHash, new ConcurrentHashMap<Integer, ServiceStat>());
   	}
   	
   	if (serviceStatMap.get(pack.objHash).get(pack.service) == null) {
   		serviceStatMap.get(pack.objHash).put(pack.service, new ServiceStat(pack.objHash, pack.service));
   	}

   	String serviceName = TextRD.getString(DateUtil.yyyymmdd(pack.endTime), TextTypes.SERVICE, pack.service);
  		InetAddress inetAddr = InetAddress.getByAddress(pack.ipaddr);
  		serviceStatMap.get(pack.objHash).get(pack.service).add(serviceName, pack.elapsed, pack.error != 0, inetAddr == null ? null : inetAddr.getHostAddress(), pack.userAgent, pack.sqlCount, pack.sqlTime);
} catch (Exception e) {
	Logger.printStackTrace(e);
}
  }
 
开发者ID:OpenSourceConsulting,项目名称:scouter-plugin-server-reporting,代码行数:23,代码来源:ReportingPlugin.java


示例3: clear

import scouter.util.DateUtil; //导入依赖的package包/类
public void clear() {
	isProcessing = true;
	
	try {
		Slot s = meter.getCurrentBucket();
		lastSlot.requestCount = s.requestCount;
		lastSlot.errorCount = s.errorCount;
		lastSlot.elapsed = s.elapsed;
		lastSlot.sqlCount = s.sqlCount;
		lastSlot.sqlTime = s.sqlTime;
		
		this.maxElapsed = 0;
		this.maxSqlCount = 0;
		this.maxSqlTime = 0;
		this.elapsedExceedCount = 0;
		this.requestCount = 0;
		this.errorCount = 0;
		this.ipAddr = new HashMap<String, Map<String, Integer>>();
		this.userAgent = new HashMap<Integer, Map<String, Integer>>();
		
		// 현재 시간의 (0, 5, 10, 15, ... 50, 55분 단위로 변경)
		this.startTime = System.currentTimeMillis() / DateUtil.MILLIS_PER_FIVE_MINUTE * DateUtil.MILLIS_PER_FIVE_MINUTE;
	} finally {
		isProcessing = false;
	}
}
 
开发者ID:OpenSourceConsulting,项目名称:scouter-plugin-server-reporting,代码行数:27,代码来源:ServiceStat.java


示例4: clear

import scouter.util.DateUtil; //导入依赖的package包/类
public void clear() {
	isProcessing = true;
	
	try {
		this.maxActiveService = 0;
		this.heapTotal = 0F;
		this.maxHeapUsed = 0F;
		this.maxRecentUser = 0;
		this.maxServiceCount = 0;
		this.maxSqlTps = 0F;
		this.maxTps = 0F;
		
		// 현재 시간의 (0, 5, 10, 15, ... 50, 55분 단위로 변경)
		this.startTime = System.currentTimeMillis() / DateUtil.MILLIS_PER_FIVE_MINUTE * DateUtil.MILLIS_PER_FIVE_MINUTE;
	} finally {
		isProcessing = false;
	}
}
 
开发者ID:OpenSourceConsulting,项目名称:scouter-plugin-server-reporting,代码行数:19,代码来源:JavaAgentStat.java


示例5: clear

import scouter.util.DateUtil; //导入依赖的package包/类
public void clear() {
	isProcessing = true;
	
	try {
		Slot s = meter.getCurrentBucket();
		lastSlot.netTx = s.netTx;
		lastSlot.netRx = s.netRx;
		lastSlot.diskRead = s.diskRead;
		lastSlot.diskWrite = s.diskWrite;
		lastSlot.count = s.count;

		this.maxCpu = 0F;
		this.memTotal = 0;
		this.maxMem = 0F;
		this.maxMemUsed = 0;
		this.maxNetTx = 0;
		this.maxNetRx = 0;
		this.maxDiskRead = 0;
		this.maxDiskWrite = 0;
		
		// 현재 시간의 (0, 5, 10, 15, ... 50, 55분 단위로 변경)
		this.startTime = System.currentTimeMillis() / DateUtil.MILLIS_PER_FIVE_MINUTE * DateUtil.MILLIS_PER_FIVE_MINUTE;
	} finally {
		isProcessing = false;
	}
}
 
开发者ID:OpenSourceConsulting,项目名称:scouter-plugin-server-reporting,代码行数:27,代码来源:HostAgentStat.java


示例6: xlog

import scouter.util.DateUtil; //导入依赖的package包/类
@ServerPlugin(PluginConstants.PLUGIN_SERVER_XLOG)
  public void xlog(XLogPack pack) {
  	try {
  		int elapsedThreshold = conf.getInt("ext_plugin_elapsed_time_threshold", 0);
  		
  		if (elapsedThreshold != 0 && pack.elapsed > elapsedThreshold) {
  			String serviceName = TextRD.getString(DateUtil.yyyymmdd(pack.endTime), TextTypes.SERVICE, pack.service);
  			
  			AlertPack ap = new AlertPack();
  			
        ap.level = AlertLevel.WARN;
        ap.objHash = pack.objHash;
        ap.title = "Elapsed time exceed a threshold.";
        ap.message = "[" + AgentManager.getAgentName(pack.objHash) + "] " 
        				+ pack.service + "(" + serviceName + ") "
        				+ "elapsed time(" + pack.elapsed + " ms) exceed a threshold.";
        ap.time = System.currentTimeMillis();
        ap.objType = AgentManager.getAgent(pack.objHash).objType;
		
        alert(ap);
  		}
  		
} catch (Exception e) {
	Logger.printStackTrace(e);
}
  }
 
开发者ID:scouter-project,项目名称:scouter-plugin-server-alert-email,代码行数:27,代码来源:EmailPlugin.java


示例7: refresh

import scouter.util.DateUtil; //导入依赖的package包/类
public void refresh() {
	if (stopRefresh) {
		return;
	}
	MapPack m = fetch();
	if (m == null) {
		ExUtil.exec(canvas, new Runnable() {
			public void run() {
				setTitleImage(Images.inactive);
				long now = TimeUtil.getCurrentTime();
				xyGraph.primaryXAxis.setRange(now - DateUtil.MILLIS_PER_FIVE_MINUTE, now + 1);
			}
		});
		return;
	}
	removeDeadGroup(m);
	processElapsedData(m);
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:19,代码来源:AbstractServiceGroupElapsedView.java


示例8: processElapsedData

import scouter.util.DateUtil; //导入依赖的package包/类
private void processElapsedData(final MapPack m) {
	final ListValue nameLv = m.getList("name");
	final ListValue elapsedLv = m.getList("elapsed");
	ExUtil.exec(canvas, new Runnable() {
		public void run() {
			setTitleImage(Images.active);
			long now = m.getLong("time");
			long stime = now - DateUtil.MILLIS_PER_FIVE_MINUTE;
			xyGraph.primaryXAxis.setRange(stime, now + 1);
			for (int i = 0; i < nameLv.size(); i++) {
				String name = nameLv.getString(i);
				double value = CastUtil.cdouble(elapsedLv.get(i));
				CircularBufferDataProvider provider = (CircularBufferDataProvider) getTrace(name).getDataProvider();
				provider.addSample(new Sample(now, value));
			}
			xyGraph.primaryYAxis.setRange(0, getMaxValue());
		}
	});
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:20,代码来源:AbstractServiceGroupElapsedView.java


示例9: refresh

import scouter.util.DateUtil; //导入依赖的package包/类
public void refresh() {
	if (stopRefresh) {
		return;
	}
	MapPack m = fetch();
	if (m == null) {
		ExUtil.exec(canvas, new Runnable() {
			public void run() {
				setTitleImage(Images.inactive);
				long now = TimeUtil.getCurrentTime();
				xyGraph.primaryXAxis.setRange(now - DateUtil.MILLIS_PER_FIVE_MINUTE, now + 1);
			}
		});
		return;
	}
	removeDeadGroup(m);
	 processThroughputData(m);
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:19,代码来源:AbstractServiceGroupTPSView.java


示例10: getColumnText

import scouter.util.DateUtil; //导入依赖的package包/类
public String getColumnText(Object element, int columnIndex) {
	if (element instanceof DirObject) {
		DirObject obj = (DirObject) element;
		switch (columnIndex) {
		case 0:
			int lastIndex = obj.name.lastIndexOf("/");
			if (lastIndex < 0) {
				lastIndex = obj.name.lastIndexOf("\\");
			}
			if (lastIndex > -1) {
				return obj.name.substring(lastIndex + 1);
			} else {
				return obj.name;
			}
		case 1:
			return ScouterUtil.humanReadableByteCount(obj.size, true);
		case 2:
			return DateUtil.format(obj.lastModified,
					"yyyy-MM-dd HH:mm:ss");
		}
	}
	return null;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:24,代码来源:ServerFileManagementView.java


示例11: openFile

import scouter.util.DateUtil; //导入依赖的package包/类
private static synchronized void openFile() throws IOException {
	if (pw == null) {
		lastDataUnit = DateUtil.getDateUnit();
		lastDir = conf.log_dir;
		lastFileRotation = conf.log_rotation_enalbed;

		new File(lastDir).mkdirs();
		if (conf.log_rotation_enalbed) {
			FileWriter fw = new FileWriter(new File(conf.log_dir, "agent-" + DateUtil.yyyymmdd() + ".log"), true);
			pw = new PrintWriter(fw);
		} else {
			pw = new PrintWriter(new File(conf.log_dir, "agent.log"));
		}
		lastDataUnit = DateUtil.getDateUnit();
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:17,代码来源:Logger.java


示例12: ariseAlert

import scouter.util.DateUtil; //导入依赖的package包/类
public void ariseAlert(final int serverId, final AlertPack alert) {
	ExUtil.exec(table, new Runnable() {
		public void run() {
			while (table.getItemCount() > 500) {
				table.remove(table.getItemCount() - 1);
			}
			AlertData data = new AlertData(serverId, alert);
			TableItem t = new TableItem(table, SWT.NONE, 0);
			t.setText(new String[] { //
					FormatUtil.print(new Date(alert.time), "HH:mm:ss.SSS"),
					AlertLevel.getName(alert.level), //
					alert.title, //
					alert.message,//
					TextProxy.object.getLoadText(DateUtil.yyyymmdd(TimeUtil.getCurrentTime()), data.p.objHash, serverId),//
			});
			t.setData(data);
		}
	});
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:20,代码来源:AlertView.java


示例13: loadAgentStackList

import scouter.util.DateUtil; //导入依赖的package包/类
private void loadAgentStackList(final List<Long> list){
	if(list == null){
		return;
	}
	ExUtil.exec(table, new Runnable() {
		public void run() {
			long value;
			for (int i = 0 ; i < list.size(); i++) {
				value = list.get(i);
				TableItem item = new TableItem(table, SWT.NONE);
				item.setText(0, String.valueOf(i+1));
				item.setText(1, DateUtil.format(value, "yyyy-MM-dd HH:mm:ss"));
				item.setData(value);
			}
		}
	});		
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:18,代码来源:ObjectThreadDumpView.java


示例14: setInput

import scouter.util.DateUtil; //导入依赖的package包/类
public void setInput(long stime, long etime) {
	this.stime = stime;
	this.etime = etime;
	viewPainter.setEndTime(etime);
	viewPainter.setTimeRange(etime - stime);
	setDate(DateUtil.yyyymmdd(stime));
	String objTypeDisplay = defaultServer.getCounterEngine().getDisplayNameObjectType(objType);
	setContentDescription(grpName +" | "+objTypeDisplay+"\'s "+"XLog Pasttime"
			+ " | " + DateUtil.format(stime, "yyyy-MM-dd") + "(" + DateUtil.format(stime, "HH:mm")
			+ "~" + DateUtil.format(etime, "HH:mm") + ")");
	try {
		loadJob = new LoadXLogJob();
		loadJob.schedule();
	} catch (Exception e) {
		MessageDialog.openError(shell, "Error", e.getMessage());
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:18,代码来源:XLogLoadTimeGroupView.java


示例15: getText

import scouter.util.DateUtil; //导入依赖的package包/类
public String getText(long date, int hash, int serverId) {
	if (hash == 0) {
		return null;
	}

	String value = getCachedText(hash);
	if (value != null) {
		return value;
	}

	ArrayList list = new ArrayList();
	list.add(hash);
	String yyyymmdd = DateUtil.yyyymmdd(date);
	load(yyyymmdd, list, serverId);

	return getCachedText(hash);
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:18,代码来源:TextModel.java


示例16: run

import scouter.util.DateUtil; //导入依赖的package包/类
public void run(){
	ExUtil.asyncRun(new Runnable() {
		public void run() {
			TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
			try {
				MapPack param = new MapPack();
				param.put("objHash", objHash);
				param.put("time", DateUtil.MILLIS_PER_FIVE_MINUTE);
				tcp.getSingle(RequestCmd.PSTACK_ON, param);
			} catch (Exception e) {
				e.printStackTrace();
			} finally {
				TcpProxy.putTcpProxy(tcp);
			}
			
		}
	});
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:19,代码来源:TurnOnStackAction.java


示例17: getDataProvider

import scouter.util.DateUtil; //导入依赖的package包/类
private CircularBufferDataProvider getDataProvider(int objHash) {
	CircularBufferDataProvider data = datas.get(objHash);
	if (data == null) {
		data = new CircularBufferDataProvider(true);
		datas.put(objHash, data);

		data.setBufferSize(155);
		data.setCurrentXDataArray(new double[] {});
		data.setCurrentYDataArray(new double[] {});
		String name = StringUtil.trimToEmpty(TextProxy.object.getLoadText(
				DateUtil.yyyymmdd(TimeUtil.getCurrentTime(serverId)), objHash,
				serverId));
		final Trace trace = new Trace(name, xyGraph.primaryXAxis, xyGraph.primaryYAxis, data);
		trace.setPointStyle(PointStyle.NONE);

		trace.setLineWidth(PManager.getInstance().getInt(PreferenceConstants.P_CHART_LINE_WIDTH));
		trace.setTraceType(TraceType.SOLID_LINE);
		trace.setTraceColor(AgentColorManager.getInstance().assignColor(objType, objHash));
		
		xyGraph.addTrace(trace);
		traces.add(trace);
	}
	return data;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:25,代码来源:CounterRealTimeAllView.java


示例18: run

import scouter.util.DateUtil; //导入依赖的package包/类
protected IStatus run(IProgressMonitor monitor) {
	monitor.beginTask("Load Thread Profile....", IProgressMonitor.UNKNOWN);
	String date = DateUtil.yyyymmdd(data.p.endTime);
	final Step[] steps =XLogProxy.getProfile(date, threadTxid, data.serverId);
	ExUtil.exec(Display.getDefault(), new Runnable() {
		public void run() {
			try {
				IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
				XLogThreadProfileView view = (XLogThreadProfileView) win.getActivePage().showView(XLogThreadProfileView.ID, Hexa32.toString32(threadTxid),
						IWorkbenchPage.VIEW_ACTIVATE);
				view.setInput(data, steps, threadTxid, data.serverId);
			} catch (Exception ex) {
			}
		}
	});
	return Status.OK_STATUS;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:18,代码来源:OpenXLogThreadProfileJob.java


示例19: run

import scouter.util.DateUtil; //导入依赖的package包/类
public void run() {
	if(startTime <= 0 && endTime <= 0){
		startTime = TimeUtil.getCurrentTime(serverId) - AfterMinuteUnit.FIVE_MIN.getTime();
		endTime = 0;
		String afterMinute = "5 min";
		AfterMinuteUnit m = AfterMinuteUnit.fromString(afterMinute);
		if (m != null) {
		 endTime = startTime + m.getTime();
		}
		if (DateUtil.isSameDay(new Date(startTime), new Date(endTime)) == false) {
		    endTime = DateUtil.getTime(DateUtil.format(startTime, "MM/dd/yyyy") + " 23:59", "MM/dd/yyyy HH:mm");
		}
	}
	if (window != null) {
		try {
			CounterPastTimeTotalView v = (CounterPastTimeTotalView) window.getActivePage().showView(CounterPastTimeTotalView.ID, 
					objType+counter + startTime + endTime+TimeUtil.getCurrentTime(serverId), IWorkbenchPage.VIEW_ACTIVATE);
			if (v != null) {
				v.setInput(startTime, endTime, objType, counter, serverId);
			}
		} catch (Exception e) {
			MessageDialog.openError(window.getShell(), "Error", "[OpenTotalLoadTimeCounterAction] Error opening view:" + e.getMessage());
		}
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:26,代码来源:OpenPastTimeTotalAction.java


示例20: run

import scouter.util.DateUtil; //导入依赖的package包/类
public void run() {
	if(startTime <= 0 && endTime <= 0){
		startTime = TimeUtil.getCurrentTime(serverId) - AfterMinuteUnit.FIVE_MIN.getTime();
		endTime = 0;
		String afterMinute = "5 min";
		AfterMinuteUnit m = AfterMinuteUnit.fromString(afterMinute);
		if (m != null) {
		 endTime = startTime + m.getTime();
		}
		if (DateUtil.isSameDay(new Date(startTime), new Date(endTime)) == false) {
		    endTime = DateUtil.getTime(DateUtil.format(startTime, "MM/dd/yyyy") + " 23:59", "MM/dd/yyyy HH:mm");
		}
	}
	if (window != null) {
		try {
			CounterPastTimeAllView v = (CounterPastTimeAllView) window.getActivePage().showView(CounterPastTimeAllView.ID, 
					objType+counter+startTime+endTime+TimeUtil.getCurrentTime(serverId), IWorkbenchPage.VIEW_ACTIVATE);
			if (v != null) {
				v.setInput(startTime, endTime, objType, counter, serverId);
			}
		} catch (Exception e) {
			MessageDialog.openError(window.getShell(), "Error", "Error opening view:" + e.getMessage());
		}
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:26,代码来源:OpenPastTimeAllAction.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EncryptedContentInfo类代码示例发布时间:2022-05-22
下一篇:
Java BCPGInputStream类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap