Просмотр исходного кода

执行器动态代理对象,拦截非业务方法的执行

xuxueli 8 лет назад
Родитель
Сommit
87442a5c59

+ 1 - 0
doc/XXL-JOB官方文档.md Просмотреть файл

@@ -1024,6 +1024,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
1024 1024
 - 3、修复任务监控线程被耗时任务阻塞的问题;
1025 1025
 - 4、修复任务监控线程无法监控任务触发和执行状态均未0的问题;
1026 1026
 - 5、调度中心项目日志配置改为xml文件格式;
1027
+- 6、执行器动态代理对象,拦截非业务方法的执行;
1027 1028
 
1028 1029
 ### TODO LIST
1029 1030
 - 1、任务权限管理:执行器为粒度分配权限,核心操作校验权限;

+ 7 - 1
xxl-job-core/src/main/java/com/xxl/job/core/rpc/netcom/NetComClientProxy.java Просмотреть файл

@@ -36,6 +36,12 @@ public class NetComClientProxy implements FactoryBean<Object> {
36 36
 				new InvocationHandler() {
37 37
 					@Override
38 38
 					public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
39
+
40
+						// filter method like "Object.toString()"
41
+						if (Object.class.getName().equals(method.getDeclaringClass().getName())) {
42
+							logger.error(">>>>>>>>>>> xxl-rpc proxy class-method not support [{}.{}]", method.getDeclaringClass().getName(), method.getName());
43
+							throw new RuntimeException("xxl-rpc proxy class-method not support");
44
+						}
39 45
 						
40 46
 						// request
41 47
 						RpcRequest request = new RpcRequest();
@@ -46,7 +52,7 @@ public class NetComClientProxy implements FactoryBean<Object> {
46 52
 	                    request.setMethodName(method.getName());
47 53
 	                    request.setParameterTypes(method.getParameterTypes());
48 54
 	                    request.setParameters(args);
49
-	                    
55
+
50 56
 	                    // send
51 57
 	                    RpcResponse response = client.send(request);
52 58