This commit is contained in:
yanhom 2024-10-15 23:46:07 +08:00
parent 9ca45922d0
commit 8e2429a88e
4 changed files with 40 additions and 3 deletions

View File

@ -145,6 +145,7 @@ public class ThreadPoolConfiguration {
return ThreadPoolBuilder.newBuilder()
.threadPoolName("scheduledDtpExecutor")
.corePoolSize(2)
.dynamic(true)
.threadFactory("test-scheduled")
.rejectedExecutionHandler(CALLER_RUNS_POLICY.getName())
.buildScheduled();

View File

@ -67,7 +67,7 @@ public class AgentAware extends TaskStatAware {
if (o instanceof DtpRunnable) {
return (DtpRunnable) o;
}
if (CollUtil.contains(visitedClass, o.getClass())) {
if (Objects.isNull(o) || CollUtil.contains(visitedClass, o.getClass())) {
return null;
} else {
visitedClass.add(o.getClass());
@ -115,8 +115,8 @@ public class AgentAware extends TaskStatAware {
log.error("getDtpRunnable Error", e);
}
if (dtpRunnable == null) {
if (log.isWarnEnabled()) {
log.warn("DynamicTp aware [{}], can not find DtpRunnable.", getName());
if (log.isDebugEnabled()) {
log.debug("DynamicTp aware [{}], can not find DtpRunnable.", getName());
}
return r;
}

View File

@ -1,3 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.dynamictp.agent;
public class MyAgentContainNestWrapper implements Runnable {
@ -15,3 +32,4 @@ public class MyAgentContainNestWrapper implements Runnable {
System.out.println("after");
}
}

View File

@ -1,3 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.dynamictp.agent;
import org.dromara.dynamictp.core.support.task.runnable.DtpRunnable;
@ -22,3 +39,4 @@ public class MyAgentNestWrapper implements Runnable {
}
}
}