com.github.dozermapper
diff --git a/hippo4j-message/src/main/java/cn/hippo4j/message/request/base/NotifyRequest.java b/hippo4j-common/src/main/java/cn/hippo4j/common/api/NotifyRequest.java
similarity index 95%
rename from hippo4j-message/src/main/java/cn/hippo4j/message/request/base/NotifyRequest.java
rename to hippo4j-common/src/main/java/cn/hippo4j/common/api/NotifyRequest.java
index 13e0da92..9b2b71ee 100644
--- a/hippo4j-message/src/main/java/cn/hippo4j/message/request/base/NotifyRequest.java
+++ b/hippo4j-common/src/main/java/cn/hippo4j/common/api/NotifyRequest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package cn.hippo4j.message.request.base;
+package cn.hippo4j.common.api;
/**
* Notify request.
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/api/ThreadPoolCheckAlarm.java b/hippo4j-common/src/main/java/cn/hippo4j/common/api/ThreadPoolCheckAlarm.java
new file mode 100644
index 00000000..6d4b0768
--- /dev/null
+++ b/hippo4j-common/src/main/java/cn/hippo4j/common/api/ThreadPoolCheckAlarm.java
@@ -0,0 +1,64 @@
+/*
+ * 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 cn.hippo4j.common.api;
+
+import org.springframework.boot.CommandLineRunner;
+
+import java.util.concurrent.ThreadPoolExecutor;
+
+/**
+ * Thread-pol check alarm.
+ *
+ * Dynamic thread pool check and send logic wait for refactoring,
+ * Try not to rely on this component for custom extensions, because it is undefined.
+ */
+public interface ThreadPoolCheckAlarm extends CommandLineRunner {
+
+ /**
+ * Check pool capacity alarm.
+ *
+ * @param threadPoolId thread-pool id
+ * @param threadPoolExecutor thread-pool executor
+ */
+ void checkPoolCapacityAlarm(String threadPoolId, ThreadPoolExecutor threadPoolExecutor);
+
+ /**
+ * Check pool activity alarm.
+ *
+ * @param threadPoolId thread-pool id
+ * @param threadPoolExecutor thread-pool executor
+ */
+ void checkPoolActivityAlarm(String threadPoolId, ThreadPoolExecutor threadPoolExecutor);
+
+ /**
+ * Async send rejected alarm.
+ *
+ * @param threadPoolId thread-pool id
+ */
+ void asyncSendRejectedAlarm(String threadPoolId);
+
+ /**
+ * Async send execute time-out alarm.
+ *
+ * @param threadPoolId thread-pool id
+ * @param executeTime execute time
+ * @param executeTimeOut execute time-out
+ * @param threadPoolExecutor thread-pool executor
+ */
+ void asyncSendExecuteTimeOutAlarm(String threadPoolId, long executeTime, long executeTimeOut, ThreadPoolExecutor threadPoolExecutor);
+}
diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/api/ThreadPoolConfigChange.java b/hippo4j-common/src/main/java/cn/hippo4j/common/api/ThreadPoolConfigChange.java
new file mode 100644
index 00000000..8086240e
--- /dev/null
+++ b/hippo4j-common/src/main/java/cn/hippo4j/common/api/ThreadPoolConfigChange.java
@@ -0,0 +1,31 @@
+/*
+ * 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 cn.hippo4j.common.api;
+
+/**
+ * Thread-pool config change.
+ */
+public interface ThreadPoolConfigChange {
+
+ /**
+ * Send pool config change.
+ *
+ * @param requestParam request param
+ */
+ void sendPoolConfigChange(T requestParam);
+}
diff --git a/hippo4j-core/pom.xml b/hippo4j-core/pom.xml
index e9e05f10..ae43fb91 100644
--- a/hippo4j-core/pom.xml
+++ b/hippo4j-core/pom.xml
@@ -10,34 +10,15 @@
hippo4j-core
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.projectlombok
- lombok
-
cn.hippo4j
hippo4j-common
${revision}
- cn.hippo4j
- hippo4j-message
-
-
- com.aliyun
- alibaba-dingtalk-service-sdk
-
-
-
- log4j
- log4j
-
-
+ org.springframework.boot
+ spring-boot-starter-test
+ test
diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/plugin/impl/TaskRejectNotifyAlarmPlugin.java b/hippo4j-core/src/main/java/cn/hippo4j/core/plugin/impl/TaskRejectNotifyAlarmPlugin.java
index 6b865642..85229374 100644
--- a/hippo4j-core/src/main/java/cn/hippo4j/core/plugin/impl/TaskRejectNotifyAlarmPlugin.java
+++ b/hippo4j-core/src/main/java/cn/hippo4j/core/plugin/impl/TaskRejectNotifyAlarmPlugin.java
@@ -17,9 +17,9 @@
package cn.hippo4j.core.plugin.impl;
+import cn.hippo4j.common.api.ThreadPoolCheckAlarm;
import cn.hippo4j.common.config.ApplicationContextHolder;
import cn.hippo4j.core.executor.ExtensibleThreadPoolExecutor;
-import cn.hippo4j.core.executor.ThreadPoolNotifyAlarmHandler;
import cn.hippo4j.core.plugin.RejectedAwarePlugin;
import java.util.Optional;
@@ -55,7 +55,7 @@ public class TaskRejectNotifyAlarmPlugin implements RejectedAwarePlugin {
}
String threadPoolId = ((ExtensibleThreadPoolExecutor) executor).getThreadPoolId();
Optional.ofNullable(ApplicationContextHolder.getInstance())
- .map(context -> context.getBean(ThreadPoolNotifyAlarmHandler.class))
+ .map(context -> context.getBean(ThreadPoolCheckAlarm.class))
.ifPresent(handler -> handler.asyncSendRejectedAlarm(threadPoolId));
}
}
diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/plugin/impl/TaskTimeoutNotifyAlarmPlugin.java b/hippo4j-core/src/main/java/cn/hippo4j/core/plugin/impl/TaskTimeoutNotifyAlarmPlugin.java
index d828cc6d..bdc6787e 100644
--- a/hippo4j-core/src/main/java/cn/hippo4j/core/plugin/impl/TaskTimeoutNotifyAlarmPlugin.java
+++ b/hippo4j-core/src/main/java/cn/hippo4j/core/plugin/impl/TaskTimeoutNotifyAlarmPlugin.java
@@ -17,8 +17,8 @@
package cn.hippo4j.core.plugin.impl;
+import cn.hippo4j.common.api.ThreadPoolCheckAlarm;
import cn.hippo4j.common.config.ApplicationContextHolder;
-import cn.hippo4j.core.executor.ThreadPoolNotifyAlarmHandler;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
@@ -73,7 +73,7 @@ public class TaskTimeoutNotifyAlarmPlugin extends AbstractTaskTimerPlugin {
return;
}
Optional.ofNullable(ApplicationContextHolder.getInstance())
- .map(context -> context.getBean(ThreadPoolNotifyAlarmHandler.class))
+ .map(context -> context.getBean(ThreadPoolCheckAlarm.class))
.ifPresent(handler -> handler.asyncSendExecuteTimeOutAlarm(
threadPoolId, taskExecuteTime, executeTimeOut, threadPoolExecutor));
}
diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/proxy/RejectedProxyInvocationHandler.java b/hippo4j-core/src/main/java/cn/hippo4j/core/proxy/RejectedProxyInvocationHandler.java
index 2b029e54..263cbcc3 100644
--- a/hippo4j-core/src/main/java/cn/hippo4j/core/proxy/RejectedProxyInvocationHandler.java
+++ b/hippo4j-core/src/main/java/cn/hippo4j/core/proxy/RejectedProxyInvocationHandler.java
@@ -17,8 +17,8 @@
package cn.hippo4j.core.proxy;
+import cn.hippo4j.common.api.ThreadPoolCheckAlarm;
import cn.hippo4j.common.config.ApplicationContextHolder;
-import cn.hippo4j.core.executor.ThreadPoolNotifyAlarmHandler;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -54,7 +54,7 @@ public class RejectedProxyInvocationHandler implements InvocationHandler {
rejectCount.incrementAndGet();
if (ApplicationContextHolder.getInstance() != null) {
try {
- ThreadPoolNotifyAlarmHandler alarmHandler = ApplicationContextHolder.getBean(ThreadPoolNotifyAlarmHandler.class);
+ ThreadPoolCheckAlarm alarmHandler = ApplicationContextHolder.getBean(ThreadPoolCheckAlarm.class);
alarmHandler.asyncSendRejectedAlarm(threadPoolId);
} catch (Throwable ex) {
log.error("Failed to send rejection policy alert.", ex);
diff --git a/hippo4j-example/hippo4j-example-core/pom.xml b/hippo4j-example/hippo4j-example-core/pom.xml
index 2628dbd6..86d8c24b 100644
--- a/hippo4j-example/hippo4j-example-core/pom.xml
+++ b/hippo4j-example/hippo4j-example-core/pom.xml
@@ -11,6 +11,7 @@
true
+ 2.12.1
@@ -18,36 +19,32 @@
org.springframework.boot
spring-boot-starter
-