From b47e8eab77f3610fa90e20a0ab812d021580c3e8 Mon Sep 17 00:00:00 2001 From: sun Date: Wed, 20 Sep 2023 17:02:45 +0800 Subject: [PATCH] feat[virtual thread]: support virtual thread in net --- .../zfoo/net/{router/receiver => enhance}/EnhanceUtils.java | 5 ++--- .../net/{router/receiver => enhance}/IPacketReceiver.java | 2 +- .../receiver => enhance}/PacketReceiverDefinition.java | 2 +- net/src/main/java/com/zfoo/net/router/Router.java | 6 +++--- 4 files changed, 7 insertions(+), 8 deletions(-) rename net/src/main/java/com/zfoo/net/{router/receiver => enhance}/EnhanceUtils.java (95%) rename net/src/main/java/com/zfoo/net/{router/receiver => enhance}/IPacketReceiver.java (95%) rename net/src/main/java/com/zfoo/net/{router/receiver => enhance}/PacketReceiverDefinition.java (98%) diff --git a/net/src/main/java/com/zfoo/net/router/receiver/EnhanceUtils.java b/net/src/main/java/com/zfoo/net/enhance/EnhanceUtils.java similarity index 95% rename from net/src/main/java/com/zfoo/net/router/receiver/EnhanceUtils.java rename to net/src/main/java/com/zfoo/net/enhance/EnhanceUtils.java index 1849119f7..80c2404f0 100644 --- a/net/src/main/java/com/zfoo/net/router/receiver/EnhanceUtils.java +++ b/net/src/main/java/com/zfoo/net/enhance/EnhanceUtils.java @@ -11,9 +11,8 @@ * See the License for the specific language governing permissions and limitations under the License. */ -package com.zfoo.net.router.receiver; +package com.zfoo.net.enhance; -import com.zfoo.event.anno.Bus; import com.zfoo.net.anno.Task; import com.zfoo.net.session.Session; import com.zfoo.protocol.util.StringUtils; @@ -76,7 +75,7 @@ public static IPacketReceiver createPacketReceiver(PacketReceiverDefinition defi enhanceClazz.addMethod(invokeMethod); // 定义类实现的接口方法bus - CtMethod busMethod = new CtMethod(classPool.get(Bus.class.getCanonicalName()), "task", null, enhanceClazz); + CtMethod busMethod = new CtMethod(classPool.get(Task.class.getCanonicalName()), "task", null, enhanceClazz); busMethod.setModifiers(Modifier.PUBLIC + Modifier.FINAL); String busMethodBody = StringUtils.format("{ return {}.{}; }", Task.class.getCanonicalName(), definition.getTask()); busMethod.setBody(busMethodBody); diff --git a/net/src/main/java/com/zfoo/net/router/receiver/IPacketReceiver.java b/net/src/main/java/com/zfoo/net/enhance/IPacketReceiver.java similarity index 95% rename from net/src/main/java/com/zfoo/net/router/receiver/IPacketReceiver.java rename to net/src/main/java/com/zfoo/net/enhance/IPacketReceiver.java index 7b2c720d6..6b5552a03 100644 --- a/net/src/main/java/com/zfoo/net/router/receiver/IPacketReceiver.java +++ b/net/src/main/java/com/zfoo/net/enhance/IPacketReceiver.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and limitations under the License. */ -package com.zfoo.net.router.receiver; +package com.zfoo.net.enhance; import com.zfoo.net.anno.Task; import com.zfoo.net.session.Session; diff --git a/net/src/main/java/com/zfoo/net/router/receiver/PacketReceiverDefinition.java b/net/src/main/java/com/zfoo/net/enhance/PacketReceiverDefinition.java similarity index 98% rename from net/src/main/java/com/zfoo/net/router/receiver/PacketReceiverDefinition.java rename to net/src/main/java/com/zfoo/net/enhance/PacketReceiverDefinition.java index 287a55fd1..e34c965b1 100644 --- a/net/src/main/java/com/zfoo/net/router/receiver/PacketReceiverDefinition.java +++ b/net/src/main/java/com/zfoo/net/enhance/PacketReceiverDefinition.java @@ -11,7 +11,7 @@ * See the License for the specific language governing permissions and limitations under the License. */ -package com.zfoo.net.router.receiver; +package com.zfoo.net.enhance; import com.zfoo.net.anno.Task; import com.zfoo.net.session.Session; diff --git a/net/src/main/java/com/zfoo/net/router/Router.java b/net/src/main/java/com/zfoo/net/router/Router.java index 989a9845e..b11099cef 100644 --- a/net/src/main/java/com/zfoo/net/router/Router.java +++ b/net/src/main/java/com/zfoo/net/router/Router.java @@ -33,9 +33,9 @@ import com.zfoo.net.router.exception.ErrorResponseException; import com.zfoo.net.router.exception.NetTimeOutException; import com.zfoo.net.router.exception.UnexpectedProtocolException; -import com.zfoo.net.router.receiver.EnhanceUtils; -import com.zfoo.net.router.receiver.IPacketReceiver; -import com.zfoo.net.router.receiver.PacketReceiverDefinition; +import com.zfoo.net.enhance.EnhanceUtils; +import com.zfoo.net.enhance.IPacketReceiver; +import com.zfoo.net.enhance.PacketReceiverDefinition; import com.zfoo.net.session.Session; import com.zfoo.net.task.PacketReceiverTask; import com.zfoo.net.task.TaskBus;