Merge branch 'test' of http://172.16.46.63:30001/gitlab/jygk/dsc into test-dsc

* 'test' of http://172.16.46.63:30001/gitlab/jygk/dsc:
  feat(gateway): 添加API客户端凭证加密功能支持
  优化
  1. 移除多余 java 文件
  feat:登陆用户的部门数据权限接口增加角色参数
This commit is contained in:
ranke
2026-01-15 14:56:51 +08:00

View File

@@ -9,7 +9,7 @@ import java.util.concurrent.*;
* 多次提交,一次等待
*/
public class AsyncLatchUtils {
private static final ThreadLocal<List<TaskInfo>> THREADLOCAL = ThreadLocal.withInitial(LinkedList::new);
private static final ThreadLocal<List<TaskInfo>> THREAD_LOCAL = ThreadLocal.withInitial(LinkedList::new);
/**
* 提交一个异步任务
@@ -17,7 +17,7 @@ public class AsyncLatchUtils {
* @param runnable 需要异步执行的具体业务逻辑
*/
public static void submitTask(Executor executor, Runnable runnable) {
THREADLOCAL.get().add(new TaskInfo(executor, runnable));
THREAD_LOCAL.get().add(new TaskInfo(executor, runnable));
}
/**
@@ -25,8 +25,8 @@ public class AsyncLatchUtils {
* @return
*/
private static List<TaskInfo> popTask() {
List<TaskInfo> taskInfos = THREADLOCAL.get();
THREADLOCAL.remove();
List<TaskInfo> taskInfos = THREAD_LOCAL.get();
THREAD_LOCAL.remove();
return taskInfos;
}
@@ -39,7 +39,7 @@ public class AsyncLatchUtils {
*/
public static boolean waitFor(long timeout, TimeUnit timeUnit) {
List<TaskInfo> taskInfos = popTask();
if (taskInfos.isEmpty()) {
if (taskInfos.isEmpty()) {
return true;
}
CountDownLatch latch = new CountDownLatch(taskInfos.size());
@@ -57,8 +57,11 @@ public class AsyncLatchUtils {
boolean await = false;
try {
await = latch.await(timeout, timeUnit);
} catch (Exception ignored) {}
return await;
} catch (Exception ignored) {
// 恢复中断状态
Thread.currentThread().interrupt();
}
return await;
}
private static final class TaskInfo {