del[thread]: delete SafeRunnable

This commit is contained in:
godotg committed 2023-09-02 20:29:08 +08:00
1 parent 9f6f154e76
commit 13d284184d
7 files changed
+26 -51

No files matched your search

@@ -15,7 +15,7 @@ package com.zfoo.net.router.answer;
import com.zfoo.net.router.attachment.SignalAttachment;
import com.zfoo.protocol.IPacket;
import com.zfoo.util.SafeRunnable;
import com.zfoo.util.ThreadUtils;
import java.util.ArrayList;
import java.util.List;
@@ -34,7 +34,7 @@ public class AsyncAnswer<T extends IPacket> implements IAsyncAnswer<T> {
private Runnable askCallback;
private SafeRunnable notCompleteCallback;
private Runnable notCompleteCallback;
@Override
@@ -52,8 +52,8 @@ public class AsyncAnswer<T extends IPacket> implements IAsyncAnswer<T> {
}
@Override
public IAsyncAnswer<T> notComplete(SafeRunnable notCompleteCallback) {
this.notCompleteCallback = notCompleteCallback;
public IAsyncAnswer<T> notComplete(Runnable notCompleteCallback) {
this.notCompleteCallback = ThreadUtils.safeRunnable(notCompleteCallback);
return this;
}
@@ -85,7 +85,7 @@ public class AsyncAnswer<T extends IPacket> implements IAsyncAnswer<T> {
this.askCallback = askCallback;
}
public SafeRunnable getNotCompleteCallback() {
public Runnable getNotCompleteCallback() {
return notCompleteCallback;
}
}
@@ -14,7 +14,6 @@
package com.zfoo.net.router.answer;
import com.zfoo.protocol.IPacket;
import com.zfoo.util.SafeRunnable;
import java.util.function.Consumer;
@@ -36,6 +35,6 @@ public interface IAsyncAnswer<T extends IPacket> {
* EN:If the asynchronous request does not return successfully, the method is called
* CN:如果异步请求没有成功返回,那么就会回调该方法
*/
IAsyncAnswer<T> notComplete(SafeRunnable notCompleteCallback);
IAsyncAnswer<T> notComplete(Runnable notCompleteCallback);
}
@@ -24,8 +24,8 @@ import com.zfoo.protocol.collection.concurrent.CopyOnWriteHashMapLongObject;
import com.zfoo.protocol.util.AssertionUtils;
import com.zfoo.protocol.util.StringUtils;
import com.zfoo.scheduler.manager.SchedulerBus;
import com.zfoo.util.SafeRunnable;
import com.zfoo.protocol.util.RandomUtils;
import com.zfoo.util.ThreadUtils;
import io.netty.util.concurrent.FastThreadLocalThread;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -172,7 +172,7 @@ public final class TaskBus {
}
public static void execute(int taskExecutorHash, Runnable runnable) {
executors[calTaskExecutorHash(taskExecutorHash)].execute(SafeRunnable.valueOf(runnable));
executors[calTaskExecutorHash(taskExecutorHash)].execute(ThreadUtils.safeRunnable(runnable));
}
public static void execute(Object argument, Runnable runnable) {