style: 全项目统一 Tab 缩进并补全尾随逗号
This commit is contained in:
@@ -28,52 +28,52 @@ import java.util.concurrent.TimeUnit
|
||||
*/
|
||||
object SleepUtils {
|
||||
|
||||
/**
|
||||
* 基于 Thread.sleep 的等待,单位毫秒
|
||||
*
|
||||
* @param millis 等待时间(毫秒)
|
||||
* @throws RuntimeException 当线程被中断时抛出
|
||||
*/
|
||||
@JvmStatic
|
||||
fun sleep(millis: Long) {
|
||||
try {
|
||||
Thread.sleep(millis)
|
||||
} catch (e: InterruptedException) {
|
||||
Thread.currentThread().interrupt()
|
||||
throw RuntimeException("Sleep interrupted", e)
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 基于 Thread.sleep 的等待,单位毫秒
|
||||
*
|
||||
* @param millis 等待时间(毫秒)
|
||||
* @throws RuntimeException 当线程被中断时抛出
|
||||
*/
|
||||
@JvmStatic
|
||||
fun sleep(millis: Long) {
|
||||
try {
|
||||
Thread.sleep(millis)
|
||||
} catch (e: InterruptedException) {
|
||||
Thread.currentThread().interrupt()
|
||||
throw RuntimeException("Sleep interrupted", e)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 基于 Thread.sleep 的等待,单位毫秒
|
||||
*
|
||||
* @param millis 等待时间(毫秒)
|
||||
* @throws RuntimeException 当线程被中断时抛出
|
||||
*/
|
||||
@JvmStatic
|
||||
fun sleep(millis: Int) {
|
||||
try {
|
||||
Thread.sleep(millis.toLong())
|
||||
} catch (e: InterruptedException) {
|
||||
Thread.currentThread().interrupt()
|
||||
throw RuntimeException("Sleep interrupted", e)
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 基于 Thread.sleep 的等待,单位毫秒
|
||||
*
|
||||
* @param millis 等待时间(毫秒)
|
||||
* @throws RuntimeException 当线程被中断时抛出
|
||||
*/
|
||||
@JvmStatic
|
||||
fun sleep(millis: Int) {
|
||||
try {
|
||||
Thread.sleep(millis.toLong())
|
||||
} catch (e: InterruptedException) {
|
||||
Thread.currentThread().interrupt()
|
||||
throw RuntimeException("Sleep interrupted", e)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 基于 TimeUnit 的等待
|
||||
*
|
||||
* @param timeout 等待时间
|
||||
* @param unit 时间单位
|
||||
* @throws RuntimeException 当线程被中断时抛出
|
||||
*/
|
||||
@JvmStatic
|
||||
fun sleep(timeout: Long, unit: TimeUnit) {
|
||||
try {
|
||||
unit.sleep(timeout)
|
||||
} catch (e: InterruptedException) {
|
||||
Thread.currentThread().interrupt()
|
||||
throw RuntimeException("Sleep interrupted", e)
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 基于 TimeUnit 的等待
|
||||
*
|
||||
* @param timeout 等待时间
|
||||
* @param unit 时间单位
|
||||
* @throws RuntimeException 当线程被中断时抛出
|
||||
*/
|
||||
@JvmStatic
|
||||
fun sleep(timeout: Long, unit: TimeUnit) {
|
||||
try {
|
||||
unit.sleep(timeout)
|
||||
} catch (e: InterruptedException) {
|
||||
Thread.currentThread().interrupt()
|
||||
throw RuntimeException("Sleep interrupted", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user