From 28c4a8a49cb2bcf8050ff61981e565f90d31940f Mon Sep 17 00:00:00 2001
From: byteblogs168 <598092184@qq.com>
Date: Wed, 31 Jan 2024 23:41:58 +0800
Subject: [PATCH] =?UTF-8?q?feat:=203.1.0=201.=E5=BA=9F=E9=99=A4SecurityMan?=
=?UTF-8?q?agerCaller?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../easy/retry/common/log/lang/LogCaller.java | 2 +-
.../log/lang/SecurityManagerCaller.java | 1 +
.../common/log/lang/StackWalkerCaller.java | 34 +++++++++++++++++++
.../BroadcastClientCallbackHandler.java | 10 ++++++
pom.xml | 2 +-
5 files changed, 47 insertions(+), 2 deletions(-)
create mode 100644 easy-retry-common/easy-retry-common-log/src/main/java/com/aizuda/easy/retry/common/log/lang/StackWalkerCaller.java
diff --git a/easy-retry-common/easy-retry-common-log/src/main/java/com/aizuda/easy/retry/common/log/lang/LogCaller.java b/easy-retry-common/easy-retry-common-log/src/main/java/com/aizuda/easy/retry/common/log/lang/LogCaller.java
index 1c87b4772..4f6abb1c3 100644
--- a/easy-retry-common/easy-retry-common-log/src/main/java/com/aizuda/easy/retry/common/log/lang/LogCaller.java
+++ b/easy-retry-common/easy-retry-common-log/src/main/java/com/aizuda/easy/retry/common/log/lang/LogCaller.java
@@ -83,7 +83,7 @@ public class LogCaller {
private static Caller tryCreateCaller() {
Caller caller;
try {
- caller = new SecurityManagerCaller();
+ caller = new StackWalkerCaller();
if (null != caller.getCaller() && null != caller.getCallerCaller()) {
return caller;
}
diff --git a/easy-retry-common/easy-retry-common-log/src/main/java/com/aizuda/easy/retry/common/log/lang/SecurityManagerCaller.java b/easy-retry-common/easy-retry-common-log/src/main/java/com/aizuda/easy/retry/common/log/lang/SecurityManagerCaller.java
index be35e38ba..129d0473d 100644
--- a/easy-retry-common/easy-retry-common-log/src/main/java/com/aizuda/easy/retry/common/log/lang/SecurityManagerCaller.java
+++ b/easy-retry-common/easy-retry-common-log/src/main/java/com/aizuda/easy/retry/common/log/lang/SecurityManagerCaller.java
@@ -9,6 +9,7 @@ import java.io.Serializable;
*
* @author wodeyangzipingpingwuqi
*/
+@Deprecated
public class SecurityManagerCaller extends SecurityManager implements Caller, Serializable {
private static final long serialVersionUID = 1L;
diff --git a/easy-retry-common/easy-retry-common-log/src/main/java/com/aizuda/easy/retry/common/log/lang/StackWalkerCaller.java b/easy-retry-common/easy-retry-common-log/src/main/java/com/aizuda/easy/retry/common/log/lang/StackWalkerCaller.java
new file mode 100644
index 000000000..00c90e90d
--- /dev/null
+++ b/easy-retry-common/easy-retry-common-log/src/main/java/com/aizuda/easy/retry/common/log/lang/StackWalkerCaller.java
@@ -0,0 +1,34 @@
+package com.aizuda.easy.retry.common.log.lang;
+
+import java.io.Serializable;
+
+/**
+ * @author xiaowoniu
+ * @date 2024-01-31 23:32:15
+ * @since 2.6.0
+ */
+public class StackWalkerCaller implements Caller, Serializable {
+
+ @Override
+ public Class> getCaller() {
+ return null;
+ }
+
+ @Override
+ public Class> getCallerCaller() {
+
+ StackWalker instance = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
+ Class> callerClass = instance.getCallerClass();
+ return callerClass;
+ }
+
+ @Override
+ public Class> getCaller(int depth) {
+ return null;
+ }
+
+ @Override
+ public boolean isCalledBy(Class> clazz) {
+ return false;
+ }
+}
diff --git a/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/callback/BroadcastClientCallbackHandler.java b/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/callback/BroadcastClientCallbackHandler.java
index b9a3dbbea..0830225ff 100644
--- a/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/callback/BroadcastClientCallbackHandler.java
+++ b/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/callback/BroadcastClientCallbackHandler.java
@@ -3,6 +3,8 @@ package com.aizuda.easy.retry.server.job.task.support.callback;
import akka.actor.ActorRef;
import com.aizuda.easy.retry.common.core.enums.JobTaskStatusEnum;
import com.aizuda.easy.retry.common.log.EasyRetryLog;
+import com.aizuda.easy.retry.common.log.lang.StackTraceCaller;
+import com.aizuda.easy.retry.common.log.lang.StackWalkerCaller;
import com.aizuda.easy.retry.server.common.akka.ActorGenerator;
import com.aizuda.easy.retry.server.common.util.ClientInfoUtils;
import com.aizuda.easy.retry.server.job.task.dto.LogMetaDTO;
@@ -28,6 +30,14 @@ import org.springframework.stereotype.Component;
@Component
@Slf4j
public class BroadcastClientCallbackHandler extends AbstractClientCallbackHandler {
+ public static void main(String[] args) {
+ StackTraceCaller securityManagerCaller = new StackTraceCaller();
+ StackWalkerCaller stackWalkerCaller = new StackWalkerCaller();
+ Class> callerCaller = stackWalkerCaller.getCallerCaller();
+ EasyRetryLog.LOCAL.info("aaa");
+ System.out.println(callerCaller);
+ System.out.println(securityManagerCaller.getCallerCaller());
+ }
@Autowired
private JobTaskMapper jobTaskMapper;
diff --git a/pom.xml b/pom.xml
index 2488ad2b1..428a199ef 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
3.1.0-SNAPSHOT
1.0.0
4.1.94.Final
- 5.8.19
+ 5.8.25
3.5.5
2.0.0
2.0.0