Skip to content

Commit

Permalink
chore[task]: simplified code
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysunxiao committed Aug 11, 2024
1 parent 4527235 commit 7946931
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions net/src/main/java/com/zfoo/net/task/TaskBus.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,9 @@ public static ExecutorService executorOf(int hash) {

// 在task,event,scheduler线程执行的异步请求,请求成功过后依然在相同的线程执行回调任务
public static Executor currentThreadExecutor() {
var threadId = Thread.currentThread().getId();
var executor = ThreadUtils.executorByThreadId(threadId);
if (executor == null) {
return executorOf(RandomUtils.randomInt());
}
return executor;
var currentThreadId = Thread.currentThread().getId();
var executor = ThreadUtils.executorByThreadId(currentThreadId);
return executor == null ? executorOf(RandomUtils.randomInt()) : executor;
}

}

0 comments on commit 7946931

Please sign in to comment.