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


Java ThreadHelper.sleep方法代码示例

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


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

示例1: insertCat

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0, concurrency = 1)
// @Aspect
// pointcut=>class
// round: 1.47 [+- 0.00], round.block: 0.00 [+- 0.00], round.gc: 0.00 [+-
// 0.00], GC.calls: 1, GC.time: 0.06, time.total: 1.47, time.warmup: 0.00,
// time.bench: 1.47

// pointcut=>insterface
// round: 1.37 [+- 0.00], round.block: 0.00 [+- 0.00], round.gc: 0.00 [+-
// 0.00], GC.calls: 1, GC.time: 0.03, time.total: 1.37, time.warmup: 0.00,
// time.bench: 1.37
public void insertCat() {
	CatImpl cat = randomCat();
	// CatAspect處理log
	Serializable pk = catService.insertCat(cat);
	printInsert(pk);
	assertNotNull(pk);
	//
	ThreadHelper.sleep(3 * 1000);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:22,代码来源:CatServiceImplTest.java

示例2: waitConnect

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
/**
 * socket未連上時,最多等待幾毫秒
 * 
 * @param socketChannel
 * @param waitMillis
 * @return
 */
public static boolean waitConnect(SocketChannel socketChannel, long waitMillis) {
	boolean result = false;
	long beg = System.currentTimeMillis();
	long end = 0;
	//
	result = finishConnect(socketChannel);
	//
	while (!result) {
		end = System.currentTimeMillis();
		//
		if ((end - beg) >= waitMillis) {
			break;
		}
		//
		ThreadHelper.sleep(1 * 1000);// 間隔一秒
		result = finishConnect(socketChannel);
		// System.out.println((end - beg));
	}
	return result;
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:28,代码来源:NioHelper.java

示例3: insert

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0, concurrency = 1)
// no aop
// round: 1.45 [+- 0.00], round.block: 0.00 [+- 0.00], round.gc: 0.00 [+-
// 0.00], GC.calls: 0, GC.time: 0.00, time.total: 1.45, time.warmup: 0.00,
// time.bench: 1.45
public void insert() {
	// 隨機
	CatImpl cat = randomCat();
	//
	Serializable pk = catService.insert(cat);
	printInsert(pk);
	assertNotNull(pk);
	//
	// CatImpl foundEntity = catService.find(CatImpl.class, cat.getSeq());
	// printFind(foundEntity);
	// assertCat(cat, foundEntity);

	//
	ThreadHelper.sleep(3 * 1000);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:22,代码来源:CatServiceImplTest.java

示例4: decreaseCoin

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0, concurrency = 1)
// round: 1.46 [+- 0.00], round.block: 0.00 [+- 0.00], round.gc: 0.00 [+-
// 0.00], GC.calls: 0, GC.time: 0.00, time.total: 1.46, time.warmup: 0.00,
// time.bench: 1.46
public void decreaseCoin() {
	Role role = mockRole();// accountId=TEST_ACCOUNT,roleId=TEST_ROLE
	//
	int result = 0;
	result = accountService.decreaseCoin(true, role.getAccountId(), role, 10, CoinType.SASANG_PLAY);

	System.out.println(result);
	assertEquals(-10, result);

	// coin=0
	result = accountService.decreaseCoin(true, role.getAccountId(), role, 0, CoinType.SASANG_PLAY);
	System.out.println(result);
	assertEquals(0, result);
	//
	ThreadHelper.sleep(3 * 1000);
}
 
开发者ID:mixaceh,项目名称:openyu-mix,代码行数:22,代码来源:AccountServiceImplTest.java

示例5: changeGold

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0, concurrency = 1)
// round: 0.46 [+- 0.00], round.block: 0.00 [+- 0.00], round.gc: 0.00 [+-
// 0.00], GC.calls: 0, GC.time: 0.00, time.total: 0.46, time.warmup: 0.00,
// time.bench: 0.46
public void changeGold() {
	Role role = mockRole();
	role.setGold(500L);
	long result = 0L;
	//
	// 會發訊息
	result = roleService.changeGold(true, role, 500L, ActionType.INCREASE, GoldType.SHOP_SELL);
	System.out.println(result);
	assertEquals(1000L, role.getGold());
	//
	result = roleService.changeGold(true, role, -1 * 100L, ActionType.DECREASE, GoldType.SASANG_PLAY);
	System.out.println(result);
	assertEquals(900L, role.getGold());

	//
	result = roleService.changeGold(true, role, 0, ActionType.DECREASE, GoldType.SASANG_PLAY);
	System.out.println(result);
	assertEquals(900L, role.getGold());
	//
	ThreadHelper.sleep(3 * 1000);
}
 
开发者ID:mixaceh,项目名称:openyu-mix,代码行数:27,代码来源:RoleServiceImplTest.java

示例6: shutdown

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0, concurrency = 1)
public void shutdown() throws Exception {
	testRunner.start();
	ThreadHelper.sleep(3000L);
	//
	testRunner.shutdown();
	ThreadHelper.sleep(3000L);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:10,代码来源:BaseRunnableSupporterTest.java

示例7: restart

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0, concurrency = 1)
public void restart() throws Exception {
	testRunner.start();
	ThreadHelper.sleep(3000L);
	//
	testRunner.shutdown();
	ThreadHelper.sleep(3000L);
	//
	testRunner.start();
	ThreadHelper.sleep(3000L);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:13,代码来源:BaseRunnableSupporterTest.java

示例8: doRun

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Override
protected void doRun() throws Exception {
	while (true) {
		try {
			if (isShutdown()) {
				break;
			}
			//
			System.out.println("T[" + Thread.currentThread().getId() + "] ");
			ThreadHelper.sleep(1000L);
		} catch (Exception ex) {
			// ex.printStackTrace();
		}
	}
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:16,代码来源:BaseRunnableSupporterTest.java

示例9: mockOpenCache

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0, concurrency = 1)
public void mockOpenCache() {
	Parser result = null;
	result = softReferenceCacheFactoryImpl.openCache();
	// System.out.println(result);
	softReferenceCacheFactoryImpl.closeCache();
	//
	System.out.println("[" + Thread.currentThread().getName() + "] " + result);
	ThreadHelper.sleep(1 * 1000);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:12,代码来源:SoftReferenceCacheFactoryImplTest.java

示例10: shutdownWithException

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0, concurrency = 1)
public void shutdownWithException() throws Exception {
	queue.start();
	ThreadHelper.sleep(3000L);
	// 多次,會中斷
	queue.shutdown();
	ThreadHelper.sleep(3000L);
	//
	queue.shutdown();
	ThreadHelper.sleep(3000L);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:13,代码来源:LoopQueueSupporterTest.java

示例11: offer

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0, concurrency = 1)
public void offer() throws Exception {
	queue.start();
	//
	queue.offer("aaa");
	queue.offer("bbb");
	queue.offer("ccc");
	ThreadHelper.sleep(3000L);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:11,代码来源:LoopQueueSupporterTest.java

示例12: shutdown

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0, concurrency = 1)
public void shutdown() throws Exception {
	queue.start();
	ThreadHelper.sleep(3000L);
	//
	queue.shutdown();
	ThreadHelper.sleep(3000L);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:10,代码来源:TriggerQueueSupporterTest.java

示例13: start

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0, concurrency = 1)
public void start() throws Exception {
	ExecutorService executorService = Executors.newFixedThreadPool(2);
	//
	TestRunner runner = new TestRunner(executorService);
	runner.start();
	//
	runner = new TestRunner(executorService);
	runner.start();
	ThreadHelper.sleep(10 * 1000L);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:13,代码来源:BaseRunnableSupporterTest.java

示例14: shutdownWithException

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0, concurrency = 1)
public void shutdownWithException() throws Exception {
	testRunner.start();
	ThreadHelper.sleep(3000L);
	// 多次,會中斷
	testRunner.shutdown();
	ThreadHelper.sleep(3000L);
	//
	testRunner.shutdown();
	ThreadHelper.sleep(3000L);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:13,代码来源:BaseRunnableSupporterTest.java

示例15: scheduler

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0, concurrency = 1)
public void scheduler() {
	System.out.println(scheduler);
	assertNotNull(scheduler);
	//
	ThreadHelper.sleep(30 * 1000);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:9,代码来源:BaseJobSupporterDsTest.java


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