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


Java ThreadHelper.loop方法代码示例

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


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

示例1: main

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
public void main() {
	ClientBootstrap
			.main(new String[] { "org/openyu/socklet/bootstrap/client/applicationContext-client-slave1.xml" });
	//
	if (ClientBootstrap.isStarted()) {
		ThreadHelper.loop(50);
	}
}
 
开发者ID:mixaceh,项目名称:openyu-socklet,代码行数:10,代码来源:ClientSlave1BootstrapTest.java

示例2: main

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
public void main() {
	ClientBootstrap
			.main(new String[] { "org/openyu/socklet/bootstrap/client/applicationContext-client-slave3.xml" });
	//
	if (ClientBootstrap.isStarted()) {
		ThreadHelper.loop(50);
	}
}
 
开发者ID:mixaceh,项目名称:openyu-socklet,代码行数:10,代码来源:ClientSlave3BootstrapTest.java

示例3: main

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
public void main() {
	ClientBootstrap
			.main(new String[] { "org/openyu/socklet/bootstrap/client/applicationContext-client-slave2.xml" });
	//
	if (ClientBootstrap.isStarted()) {
		ThreadHelper.loop(50);
	}
}
 
开发者ID:mixaceh,项目名称:openyu-socklet,代码行数:10,代码来源:ClientSlave2BootstrapTest.java

示例4: main

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
public void main() {
	ClientBootstrap
			.main(new String[] { "org/openyu/socklet/bootstrap/client/appConfig-client2.xml" });
	//
	if (ClientBootstrap.isStarted()) {
		ThreadHelper.loop(50);
	}
}
 
开发者ID:mixaceh,项目名称:openyu-socklet,代码行数:10,代码来源:Client2BootstrapTest.java

示例5: main

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
public void main() {
	ClientBootstrap
			.main(new String[] { "org/openyu/socklet/bootstrap/client/appConfig-client3.xml" });
	//
	if (ClientBootstrap.isStarted()) {
		ThreadHelper.loop(50);
	}
}
 
开发者ID:mixaceh,项目名称:openyu-socklet,代码行数:10,代码来源:Client3BootstrapTest.java

示例6: main

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
public void main() {
	ClientBootstrap
			.main(new String[] { "org/openyu/socklet/bootstrap/client/applicationContext-client1.xml" });
	//
	if (ClientBootstrap.isStarted()) {
		ThreadHelper.loop(50);
	}
}
 
开发者ID:mixaceh,项目名称:openyu-socklet,代码行数:10,代码来源:Client1BootstrapTest.java

示例7: main

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
public void main() {
	ClientBootstrap.main(new String[] { "org/openyu/mix/bootstrap/client/applicationContext-client-slave1.xml" });
	//
	if (ClientBootstrap.isStarted()) {
		ThreadHelper.loop(50);
	}
}
 
开发者ID:mixaceh,项目名称:openyu-mix,代码行数:9,代码来源:ClientSlave1BootstrapTest.java

示例8: main

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
public void main() {
	ClientBootstrap.main(new String[] { "org/openyu/mix/bootstrap/client/applicationContext-client-slave3.xml" });
	//
	if (ClientBootstrap.isStarted()) {
		ThreadHelper.loop(50);
	}
}
 
开发者ID:mixaceh,项目名称:openyu-mix,代码行数:9,代码来源:ClientSlave3BootstrapTest.java

示例9: main

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
public void main() {
	ClientBootstrap.main(new String[] { "org/openyu/mix/bootstrap/client/applicationContext-client-slave2.xml" });
	//
	if (ClientBootstrap.isStarted()) {
		ThreadHelper.loop(50);
	}
}
 
开发者ID:mixaceh,项目名称:openyu-mix,代码行数:9,代码来源:ClientSlave2BootstrapTest.java

示例10: main

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
@Test
public void main() {
	ClientBootstrap.main(new String[] { "org/openyu/mix/bootstrap/client/applicationContext-client-system.xml" });
	//
	if (ClientBootstrap.isStarted()) {
		ThreadHelper.loop(50);
	}
}
 
开发者ID:mixaceh,项目名称:openyu-mix,代码行数:9,代码来源:ClientSystemBootstrapTest.java

示例11: main

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
/**
 * 從main直接啟動,並不是在web下啟動
 * 
 * class path
 * 
 * org/openyu/socklet/bootstrap/server/applicationContext-slave1.xml
 * 
 * ThreadHelper.loop(50);
 * 
 * @param args
 */
public static void main(String args[]) {
	try {
		if (started) {
			throw new IllegalStateException(new StringBuilder().append(AcceptorBootstrap.class.getSimpleName())
					.append(" was already started").toString());
		}
		//
		double usedMemory = 0d;
		long begTime = System.currentTimeMillis();
		// 計算所耗費的記憶體(bytes)
		RuntimeHelper.gc();
		// 原本的記憶體
		long memory = RuntimeHelper.usedMemory();

		// 建構applicationContext
		buildApplicationContext(args);

		// 取得接受器服務
		buildAcceptorService();

		// 啟動
		doStart();
		//
		long endTime = System.currentTimeMillis();
		long durTime = endTime - begTime;
		//
		RuntimeHelper.gc();
		usedMemory = Math.max(usedMemory, (RuntimeHelper.usedMemory() - memory));
		double kb = NumberHelper.round(ByteUnit.BYTE.toKiB(usedMemory), 1);
		double mb = NumberHelper.round(ByteUnit.BYTE.toMiB(usedMemory), 1);
		double sizeOf = NumberHelper.round(ByteUnit.BYTE.toMiB(MemoryHelper.sizeOf(applicationContext)), 1);
		//
		if (started) {
			String MEMORY_PATTERN = "[{0}] ({1}) ({2}) start in {3} ms, {4} bytes, {5} KB, {6} MB, sizeOf: {7} MB memory used";
			StringBuilder msg = new StringBuilder(MessageFormat.format(MEMORY_PATTERN, id, instanceId, outputId,
					durTime, usedMemory, kb, mb, sizeOf));
			LOGGER.info(msg.toString());
			// loop
			ThreadHelper.loop(50);
		} else {
			LOGGER.error("[" + id + "] (" + instanceId + ") (" + outputId + ") started fail");
		}
	} catch (Exception e) {
		started = false;
		LOGGER.error(new StringBuilder("Exception encountered during main()").toString(), e);
		// 結束
		System.exit(0);
	}
}
 
开发者ID:mixaceh,项目名称:openyu-socklet,代码行数:61,代码来源:AcceptorBootstrap.java

示例12: main

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
/**
 * 從main直接啟動,並不是在web下啟動
 * 
 * class path
 * 
 * org/openyu/socklet/serverstrap/applicationContext-slave1.xml
 * 
 * @param args
 */
public static void main(String args[]) {
	if (!started) {
		// 計算所耗費的記憶體(bytes)
		RuntimeHelper.gc();
		long begUsedMemory = RuntimeHelper.usedMemory();
		long begTime = System.nanoTime();
		try {
			// 建構applicationContext
			buildApplicationContext(args);
			// 建構acceptor啟動器
			buildAcceptorStarters();
			// 建構acceptorService
			buildAcceptorServices();
			// 建構sockletService
			buildSockletServices();
			// 啟動
			doStart();
		} catch (Exception ex) {
			started = false;
			ex.printStackTrace();
		}
		//
		long durTime = System.nanoTime() - begTime;
		durTime = TimeUnit.NANOSECONDS.toMillis(durTime);
		//
		RuntimeHelper.gc();
		double durUsedMemory = RuntimeHelper.usedMemory() - begUsedMemory;
		durUsedMemory = ByteUnit.BYTE.toMB(durUsedMemory);

		String msgPattern = "[{0}] ({1}) start in {2} ms, memory used {3} MB";
		StringBuilder msg = new StringBuilder(MessageFormat.format(
				msgPattern, id, instanceId, durTime, durUsedMemory));
		//
		if (started) {
			LOGGER.info(msg.toString());
			//
			ThreadHelper.loop(50);
		} else {
			LOGGER.error("[" + id + "] (" + instanceId + ") started fail");
		}
	}
}
 
开发者ID:mixaceh,项目名称:openyu-socklet,代码行数:52,代码来源:StandaloneBootstrapBak.java

示例13: main

import org.openyu.commons.thread.ThreadHelper; //导入方法依赖的package包/类
/**
 * 從main直接啟動,並不是在web下啟動
 * 
 * class path
 * 
 * org/openyu/socklet/bootstrap/server/applicationContext-slave1.xml
 * 
 * ThreadHelper.loop(50);
 * 
 * @param args
 */
public static void main(String args[]) {
	if (!started) {
		// 計算所耗費的記憶體(bytes)
		RuntimeHelper.gc();
		long begUsedMemory = RuntimeHelper.usedMemory();
		long begTime = System.nanoTime();
		try {
			// 建構applicationContext
			buildApplicationContext(args);
			// 建構acceptor啟動器
			buildAcceptorStarters();
			// 建構acceptorService
			buildAcceptorServices();
			// 啟動
			doStart();
		} catch (Exception ex) {
			started = false;
			ex.printStackTrace();
		}
		//
		long durTime = System.nanoTime() - begTime;
		durTime = TimeUnit.NANOSECONDS.toMillis(durTime);
		//
		RuntimeHelper.gc();
		double durUsedMemory = RuntimeHelper.usedMemory() - begUsedMemory;
		durUsedMemory = ByteUnit.BYTE.toMB(durUsedMemory);
		//
		String msgPattern = "[{0}] ({1}) start in {2} ms, memory used {3} MB";
		StringBuilder msg = new StringBuilder(
				MessageFormat.format(msgPattern, id, instanceId, durTime, durUsedMemory));
		//
		if (started) {
			LOGGER.info(msg.toString());
			//
			ThreadHelper.loop(50);
		} else {
			LOGGER.error("[" + id + "] (" + instanceId + ") started fail");
		}
	}
}
 
开发者ID:mixaceh,项目名称:openyu-socklet,代码行数:52,代码来源:ServerBootstrapBak.java


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