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


Java ThreadUtil.sleep方法代码示例

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


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

示例1: run

import scouter.util.ThreadUtil; //导入方法依赖的package包/类
@Override
public void run() {
	while (brun) {
		long now = System.currentTimeMillis();
		Enumeration<String> en = writingBlockTable.keys();
		while (en.hasMoreElements()) {
			String key = en.nextElement();
			Block bk = writingBlockTable.get(key);
			if (bk == null)
				continue;
			if (now > bk.lastAccessTime + 10000 && bk.dirty) {
				IOChannel.getInstance().store(bk);
				bk.lastAccessTime = System.currentTimeMillis();
			}
		}
		for (int i = 0; i < 100 && brun; i++) {
			ThreadUtil.sleep(100);
		}
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:21,代码来源:GZipStore.java

示例2: waitOnExit

import scouter.util.ThreadUtil; //导入方法依赖的package包/类
private static void waitOnExit(Server server) throws Exception {
    File exit = new File(SysJMX.getProcessPID() + ".scouter");
    try {
        exit.createNewFile();
    } catch (Exception e) {
        String tmp = System.getProperty("user.home", "/tmp");
        exit = new File(tmp, SysJMX.getProcessPID() + ".scouter.run");
        try {
            exit.createNewFile();
        } catch (Exception k) {
            System.exit(1);
        }
    }
    exit.deleteOnExit();
    System.out.println("System JRE version : " + System.getProperty("java.version"));
    while (true) {
        if (exit.exists() == false) {
            server.setStopTimeout(3000);
            server.stop();
            System.exit(0);
        }
        ThreadUtil.sleep(1000);
    }
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:25,代码来源:WebAppMain.java

示例3: run

import scouter.util.ThreadUtil; //导入方法依赖的package包/类
public void run() {
	while (true) {
		ThreadUtil.sleep(1000);
		if (conf.counter_enabled == false) {
			continue;
		}
		long now = System.currentTimeMillis();
		CounterBasket pw = new CounterBasket();
		for (int i = 0; i < taskSec.size(); i++) {
			CountStat r = taskSec.get(i);
			try {
				if (r.counter.interval() <= now - r.xtime) {
					r.xtime = now;
					r.counter.process(pw);
				}
			} catch (Throwable t) {
				t.printStackTrace();
			}
		}
		//
		PerfCounterPack[] pks = pw.getList();
		DataProxy.sendCounter(pks);
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:25,代码来源:CounterExecutingManager.java

示例4: addMax

import scouter.util.ThreadUtil; //导入方法依赖的package包/类
public synchronized void addMax(int activeService, float heapTotal, float heapUsed, int recentUser, int serviceCount, float apiTps, float sqlTps, float tps) {
	while (true) {
		if (isProcessing) {
			ThreadUtil.sleep(10);
		} else {
			break;
		}
	}
	
	if (heapTotal > 0f && this.heapTotal < heapTotal) {
		this.heapTotal = heapTotal;
	}
	
	// 5분 내 최대 값 갱신
	if (activeService > maxActiveService) {
		maxActiveService = activeService;
	}
	if (heapUsed > maxHeapUsed) {
		maxHeapUsed = heapUsed;
	}
	if (recentUser > maxRecentUser) {
		maxRecentUser = recentUser;
	}
	if (serviceCount > maxServiceCount) {
		maxServiceCount = serviceCount;
	}
	if (apiTps > maxApiTps) {
		maxApiTps = apiTps;
	}
	if (sqlTps > maxSqlTps) {
		maxSqlTps = sqlTps;
	}
	if (tps > maxTps) {
		maxTps = tps;
	}
	
	this.lastAccessTime = System.currentTimeMillis();
}
 
开发者ID:OpenSourceConsulting,项目名称:scouter-plugin-server-reporting,代码行数:39,代码来源:JavaAgentStat.java

示例5: main

import scouter.util.ThreadUtil; //导入方法依赖的package包/类
public static void main(String[] args) {
	final JavaAgentStat jas = new JavaAgentStat(12345);
	
	final long until = System.currentTimeMillis() + (60 * 60 * 1000);

	new Thread() {
		public void run() {
			while (System.currentTimeMillis() < until) {
				jas.addMax(5, 1024f, 80.5f, 10, 9, 8, 7, 6);
				jas.addAvg(5, 80.5f, 10, 9, 8, 7, 6);
				ThreadUtil.sleep(1000);
			}
		};
	}.start();
	
	long time = System.currentTimeMillis();
	long last_sent = time / DateUtil.MILLIS_PER_FIVE_MINUTE;
	
	while (System.currentTimeMillis() < until) {
		time = System.currentTimeMillis();
		long now = time / DateUtil.MILLIS_PER_FIVE_MINUTE;

		if (now != last_sent) {
			last_sent = now;
			
			time = (time - 10000) / DateUtil.MILLIS_PER_FIVE_MINUTE * DateUtil.MILLIS_PER_FIVE_MINUTE;
			
			System.err.println(new Date(time) + ":" + jas.getJavaAgentAndClear());
		}
		
		ThreadUtil.sleep(1000);
	}
}
 
开发者ID:OpenSourceConsulting,项目名称:scouter-plugin-server-reporting,代码行数:34,代码来源:JavaAgentStat.java

示例6: main

import scouter.util.ThreadUtil; //导入方法依赖的package包/类
public static void main(String[] args) {
	final HostAgentStat has = new HostAgentStat(12345);
	
	final long until = System.currentTimeMillis() + (60 * 60 * 1000);

	new Thread() {
		public void run() {
			while (System.currentTimeMillis() < until) {
				has.addMax(90.7f, 16 * 1024 * 1024, 52.5f, 7 * 1024 * 1024, 10, 20, 30, 40);
				has.addAvg(90.7f, 52.5f, 7 * 1024 * 1024);
				ThreadUtil.sleep(1000);
			}
		};
	}.start();
	
	long time = System.currentTimeMillis();
	long last_sent = time / DateUtil.MILLIS_PER_FIVE_MINUTE;
	
	while (System.currentTimeMillis() < until) {
		time = System.currentTimeMillis();
		long now = time / DateUtil.MILLIS_PER_FIVE_MINUTE;

		if (now != last_sent) {
			last_sent = now;
			
			time = (time - 10000) / DateUtil.MILLIS_PER_FIVE_MINUTE * DateUtil.MILLIS_PER_FIVE_MINUTE;
			
			System.err.println(new Date(time) + ":" + has.getHostAgentAndClear());
		}
		
		ThreadUtil.sleep(1000);
	}
}
 
开发者ID:OpenSourceConsulting,项目名称:scouter-plugin-server-reporting,代码行数:34,代码来源:HostAgentStat.java

示例7: run

import scouter.util.ThreadUtil; //导入方法依赖的package包/类
public void run() {
	while (true) {
		ThreadUtil.sleep(5000);
		try {
			File root = new File(Configure.getInstance().plugin_dir);
			if (root != null && root.canRead()) {
				checkModified(root);
				checkNewRule(root);
			}
		} catch (Throwable t) {
			t.printStackTrace();
		}
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:15,代码来源:AlertRuleLoader.java

示例8: run

import scouter.util.ThreadUtil; //导入方法依赖的package包/类
public void run() {
	Logger.println("Version " + Version.getAgentFullVersion());
	long dateUnit = DateUtil.getDateUnit();
	while (running) {
		reload(false);
		// Text Data Reset..
		long nowUnit = DateUtil.getDateUnit();
		if (dateUnit != nowUnit) {
			dateUnit = nowUnit;
			DataProxy.reset();
		}
		ThreadUtil.sleep(3000);
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:15,代码来源:Configure.java

示例9: main

import scouter.util.ThreadUtil; //导入方法依赖的package包/类
public static void main(String[] args) {
	ShellArg param = new ShellArg(args);
	String host = param.get("-h");
	int port = CastUtil.cint(param.get("-p"));
	int length = CastUtil.cint(param.get("-l"));
	if (length == 0) {
		System.out.println("Incorrect args\nex) -h 127.0.0.1 -p 6100 -l 32767");
		return;
	}
	for (int i = 0; i < 100; i++) {
		DataUdpAgent.getInstance().debugWrite(host, port, length);
		ThreadUtil.sleep(2000);
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:15,代码来源:DataUdpAgent.java

示例10: run

import scouter.util.ThreadUtil; //导入方法依赖的package包/类
public void run() {
	while (brun) {
		fetchObjectList();
		for (int i = 0; i < 20 && brun; i++) {
			ThreadUtil.sleep(100);
		}
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:9,代码来源:AgentModelThread.java

示例11: run

import scouter.util.ThreadUtil; //导入方法依赖的package包/类
public void run() {

		while (running) {
			try {
				process();
			} catch (Throwable t) {
				t.printStackTrace();
			}
			ThreadUtil.sleep(1000);

		}

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

示例12: main

import scouter.util.ThreadUtil; //导入方法依赖的package包/类
public static void main(String[] args) {
	Logo.print(true);
	AgentBoot.boot();

	System.out.println("Scouter Host Agent Version " + Version.getServerFullVersion());
	Logger.println("A01", "Scouter Host Agent Version " + Version.getServerFullVersion());
	
	File exit = new File(SysJMX.getProcessPID() + ".scouter");
	try {
		exit.createNewFile();
	} catch (Exception e) {
		String tmp = System.getProperty("user.home", "/tmp");
		exit = new File(tmp, SysJMX.getProcessPID() + ".scouter.run");
		try {
			exit.createNewFile();
		} catch (Exception k) {
			System.exit(1);
		}
	}
	exit.deleteOnExit();
	System.out.println("System JRE version : " + System.getProperty("java.version"));
	while (true) {
		if (exit.exists() == false) {
			System.exit(0);
		}
		ThreadUtil.sleep(1000);
	}

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

示例13: run

import scouter.util.ThreadUtil; //导入方法依赖的package包/类
public void run() {
       while (true) {
           ThreadUtil.sleep(1000);
           if (buffer.size() > 0) {
               try {
                   checkExpired();
               } catch(Exception ex) {
               	ex.printStackTrace();
               }
           }
       }
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:13,代码来源:MultiPacketProcessor.java

示例14: run

import scouter.util.ThreadUtil; //导入方法依赖的package包/类
@Override
public void run() {
	while (brun) {
		fetchObjectList();
		for (int i = 0; i < 20 && brun; i++) {
			ThreadUtil.sleep(100);
		}
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:10,代码来源:AgentModelThread.java

示例15: run

import scouter.util.ThreadUtil; //导入方法依赖的package包/类
@Override
public void run() {
	while (true) {
		syncServerTime();
		ThreadUtil.sleep(2000);
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:8,代码来源:ServerManager.java


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