diff --git a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/websocket/context/CsWsClientManager.java b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/websocket/context/CsWsClientManager.java index 60885107..9409a124 100644 --- a/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/websocket/context/CsWsClientManager.java +++ b/cutejava-springboot3/cutejava-framework/src/main/java/cn/odboy/framework/websocket/context/CsWsClientManager.java @@ -45,14 +45,11 @@ public class CsWsClientManager { CsWsServer wsServer = clientMap.get(sid); if (wsServer != null) { try { - // log.info("关闭session, sid={}", sid); + log.info("关闭session, sid={}", sid); wsServer.getSession().close(); } catch (Exception e) { log.error("Close session failed, sid={}", sid, e); } - // log.info("停止任务, sid={}", sid); - wsServer.stopTask(sid); - // log.info("移除客户端, sid={}", sid); clientMap.remove(sid); } } diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java index 89eb06e7..5a20a935 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/OperationLogAspect.java @@ -62,7 +62,7 @@ public class OperationLogAspect { try { Object result = joinPoint.proceed(); SystemOperationLogTb record = getOperationLogTb(joinPoint, annotation, timeInterval); - ThreadUtil.execAsync(() -> { + Thread.startVirtualThread(() -> { try { systemOperationLogMapper.insert(record); } catch (Exception e) { @@ -73,7 +73,7 @@ public class OperationLogAspect { } catch (Throwable exception) { SystemOperationLogTb record = getOperationLogTb(joinPoint, annotation, timeInterval); record.setExceptionDetail(ExceptionUtil.stacktraceToString(exception)); - ThreadUtil.execAsync(() -> { + Thread.startVirtualThread(() -> { try { systemOperationLogMapper.insert(record); } catch (Exception e) { diff --git a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/core/SystemOperationLogAspect.java b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/core/SystemOperationLogAspect.java index cc906107..e9a03c98 100644 --- a/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/core/SystemOperationLogAspect.java +++ b/cutejava-springboot3/cutejava-module-system/src/main/java/cn/odboy/system/framework/operalog/core/SystemOperationLogAspect.java @@ -62,7 +62,7 @@ public class SystemOperationLogAspect { try { Object result = joinPoint.proceed(); SystemOperationLogTb record = getOperationLogTb(joinPoint, annotation, timeInterval); - ThreadUtil.execAsync(() -> { + Thread.startVirtualThread(() -> { try { systemOperationLogMapper.insert(record); } catch (Exception e) { @@ -74,7 +74,7 @@ public class SystemOperationLogAspect { } catch (Throwable exception) { SystemOperationLogTb record = getOperationLogTb(joinPoint, annotation, timeInterval); record.setExceptionDetail(ExceptionUtil.stacktraceToString(exception)); - ThreadUtil.execAsync(() -> { + Thread.startVirtualThread(() -> { try { systemOperationLogMapper.insert(record); } catch (Exception e) { diff --git a/cutejava-springboot3/cutejava-module-task/src/main/java/cn/odboy/task/controller/TaskTestsController.java b/cutejava-springboot3/cutejava-module-task/src/main/java/cn/odboy/task/controller/TaskTestsController.java index 8a43cfdb..9de78102 100644 --- a/cutejava-springboot3/cutejava-module-task/src/main/java/cn/odboy/task/controller/TaskTestsController.java +++ b/cutejava-springboot3/cutejava-module-task/src/main/java/cn/odboy/task/controller/TaskTestsController.java @@ -50,7 +50,7 @@ public class TaskTestsController { public ResponseEntity testCreateAfterStop() { TaskInstanceInfoTb instanceInfo = taskManage.createJob("cutejava", TaskChangeTypeEnum.AppContainerDeploy, "java", "daily", "cutejava", "功能测试", null); log.info("任务创建成功,实例为:{}", JSON.toJSONString(instanceInfo)); - ThreadUtil.execAsync(() -> { + Thread.startVirtualThread(() -> { ThreadUtil.safeSleep(5000); taskManage.stopJob(instanceInfo.getId()); }); diff --git a/cutejava-springboot3/pom.xml b/cutejava-springboot3/pom.xml index 466d3971..c95dd309 100644 --- a/cutejava-springboot3/pom.xml +++ b/cutejava-springboot3/pom.xml @@ -27,7 +27,7 @@ UTF-8 UTF-8 UTF-8 - 17 + 21 2.0.59 1.2.27 2.11.1 diff --git a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/websocket/context/CsWsClientManager.java b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/websocket/context/CsWsClientManager.java index 207f2340..574dfe78 100644 --- a/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/websocket/context/CsWsClientManager.java +++ b/cutejava/cutejava-framework/src/main/java/cn/odboy/framework/websocket/context/CsWsClientManager.java @@ -45,14 +45,11 @@ public class CsWsClientManager { CsWsServer wsServer = clientMap.get(sid); if (wsServer != null) { try { - // log.info("关闭session, sid={}", sid); + log.info("关闭session, sid={}", sid); wsServer.getSession().close(); } catch (Exception e) { log.error("Close session failed, sid={}", sid, e); } - // log.info("停止任务, sid={}", sid); - wsServer.stopTask(sid); - // log.info("移除客户端, sid={}", sid); clientMap.remove(sid); } }