mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-09 07:08:00 +08:00
fix code
This commit is contained in:
parent
917d3cb28d
commit
4292d3fd55
@ -146,7 +146,7 @@ public class ThreadUtil {
|
|||||||
* @return CompletionService
|
* @return CompletionService
|
||||||
*/
|
*/
|
||||||
public static <T> CompletionService<T> newCompletionService() {
|
public static <T> CompletionService<T> newCompletionService() {
|
||||||
return new ExecutorCompletionService<T>(GlobalThreadPool.getExecutor());
|
return new ExecutorCompletionService<>(GlobalThreadPool.getExecutor());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -158,7 +158,7 @@ public class ThreadUtil {
|
|||||||
* @return CompletionService
|
* @return CompletionService
|
||||||
*/
|
*/
|
||||||
public static <T> CompletionService<T> newCompletionService(ExecutorService executor) {
|
public static <T> CompletionService<T> newCompletionService(ExecutorService executor) {
|
||||||
return new ExecutorCompletionService<T>(executor);
|
return new ExecutorCompletionService<>(executor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -311,7 +311,7 @@ public class ThreadUtil {
|
|||||||
* @param thread 线程
|
* @param thread 线程
|
||||||
* @param isJoin 是否等待结束
|
* @param isJoin 是否等待结束
|
||||||
*/
|
*/
|
||||||
public static void interupt(Thread thread, boolean isJoin) {
|
public static void interrupt(Thread thread, boolean isJoin) {
|
||||||
if (null != thread && false == thread.isInterrupted()) {
|
if (null != thread && false == thread.isInterrupted()) {
|
||||||
thread.interrupt();
|
thread.interrupt();
|
||||||
if (isJoin) {
|
if (isJoin) {
|
||||||
@ -326,6 +326,10 @@ public class ThreadUtil {
|
|||||||
* @param thread 线程
|
* @param thread 线程
|
||||||
*/
|
*/
|
||||||
public static void waitForDie(Thread thread) {
|
public static void waitForDie(Thread thread) {
|
||||||
|
if(null == thread){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boolean dead = false;
|
boolean dead = false;
|
||||||
do {
|
do {
|
||||||
try {
|
try {
|
||||||
@ -334,7 +338,7 @@ public class ThreadUtil {
|
|||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
} while (!dead);
|
} while (false == dead);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user