All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.macrocloud.kernel.toolkit.utils.ThreadUtil Maven / Gradle / Ivy

There is a newer version: 1.1.0-RELEASE
Show newest version
package org.macrocloud.kernel.toolkit.utils;

import java.util.concurrent.TimeUnit;


/**
 * 多线程工具类.
 *
 * @author macro
 */
public class ThreadUtil {

	/**
	 * Thread sleep.
	 *
	 * @param millis 时长
	 */
	public static void sleep(long millis) {
		try {
			Thread.sleep(millis);
		} catch (InterruptedException e) {
			Thread.currentThread().interrupt();
		}
	}

	/**
	 * Thread sleep.
	 *
	 * @param timeUnit TimeUnit
	 * @param timeout  timeout
	 */
	public static void sleep(TimeUnit timeUnit, long timeout) {
		try {
			timeUnit.sleep(timeout);
		} catch (InterruptedException e) {
			Thread.currentThread().interrupt();
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy