From 334a066e531cac204d14c9357b4c63200a0e5c68 Mon Sep 17 00:00:00 2001 From: "chen.ma" Date: Wed, 12 Jan 2022 23:02:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BA=BF=E7=A8=8B=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E7=B1=BB=E7=9D=A1=E7=9C=A0=E6=96=B9=E6=B3=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../starter/toolkit/thread/ThreadUtil.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/toolkit/thread/ThreadUtil.java b/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/toolkit/thread/ThreadUtil.java index f6e888e0..aa2124e4 100644 --- a/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/toolkit/thread/ThreadUtil.java +++ b/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/starter/toolkit/thread/ThreadUtil.java @@ -22,4 +22,22 @@ public class ThreadUtil { return t; } + /** + * 挂起当前线程. + * + * @param millis 毫秒 + * @return + */ + public static boolean sleep(long millis) { + if (millis > 0) { + try { + Thread.sleep(millis); + } catch (InterruptedException e) { + return false; + } + } + + return true; + } + }