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


Java DateUtil类代码示例

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


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


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