Merge branch 'develop' of https://github.com/opengoofy/hippo4j into develop

pull/759/head
Lijx 3 years ago
commit 1e775632ad

@ -28,7 +28,7 @@ Hippo-4J 通过对 JDK 线程池增强,以及扩展三方框架底层线程池
提供以下功能支持:
- 全局管控 - 管理应用线程池实例
- 全局管控 - 管理应用线程池实例
- 动态变更 - 应用运行时动态变更线程池参数,包括不限于:核心、最大线程数、阻塞队列容量、拒绝策略等。
- 通知报警 - 内置四种报警通知策略,线程池活跃度、容量水位、拒绝策略以及任务执行时间超长。
@ -36,7 +36,7 @@ Hippo-4J 通过对 JDK 线程池增强,以及扩展三方框架底层线程池
- 功能扩展 - 支持线程池任务传递上下文;项目关闭时,支持等待线程池在指定时间内完成任务。
- 多种模式 - 内置两种使用模式:[依赖配置中心](https://hippo4j.cn/docs/user_docs/getting_started/config/hippo4j-config-start) 和 [无中间件依赖](https://hippo4j.cn/docs/user_docs/getting_started/server/hippo4j-server-start)。
- 容器管理 - Tomcat、Jetty、Undertow 容器线程池运行时查看和线程数变更。
- 中间件适配 - Dubbo、Hystrix、RocketMQ、RabbitMQ 等消费线程池运行时数据查看和线程数变更。
- 中间件适配 - Dubbo、Hystrix、Polaris、RabbitMQ、RocketMQ 等消费线程池运行时数据查看和线程数变更。
## 快速开始

@ -0,0 +1,130 @@
<?xml version="1.0"?>
<!--
~ 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.
-->
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="NewlineAtEndOfFile"/>
<module name="RegexpSingleline">
<property name="format" value="printStackTrace"/>
<property name="message" value="Prohibit invoking printStackTrace in source code !"/>
</module>
<module name="TreeWalker">
<module name="AvoidStarImport">
<property name="excludes" value="java.io,java.net,java.lang.Math"/>
<property name="allowClassImports" value="false"/>
<property name="allowStaticMemberImports" value="true"/>
</module>
<module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<module name="JavadocType">
<property name="allowUnknownTags" value="true"/>
<property name="allowMissingParamTags" value="true"/>
<message key="javadoc.missing" value="Class Comments: Missing Javadoc Comments"/>
</module>
<!-- Do not scan method annotations for now -->
<!--<module name="JavadocMethod">
<property name="tokens" value="METHOD_DEF"/>
<property name="allowMissingPropertyJavadoc" value="true"/>
<message key="javadoc.missing" value="Method Comments: Missing Javadoc Comments"/>
</module>-->
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$" />
</module>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="ParameterName "/>
<module name="ConstantName"/>
<module name="ArrayTypeStyle"/>
<module name="UpperEll"/>
<module name="LineLength">
<property name="max" value="200"/>
</module>
<module name="MethodLength">
<property name="tokens" value="METHOD_DEF"/>
<property name="max" value="150"/>
</module>
<module name="ParameterNumber">
<property name="max" value="5"/>
<property name="ignoreOverriddenMethods" value="true"/>
<property name="tokens" value="METHOD_DEF"/>
</module>
<module name="MethodParamPad"/>
<module name="TypecastParenPad"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock"/>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber">
<property name="ignoreNumbers" value="0, 1, 2"/>
<property name="ignoreAnnotation" value="true"/>
<property name="ignoreHashCodeMethod" value="true"/>
<property name="ignoreFieldDeclaration" value="true"/>
</module>
<module name="MissingSwitchDefault"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="FinalClass"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier">
<property name="packageAllowed" value="true"/>
<property name="protectedAllowed" value="true"/>
</module>
<module name="StringLiteralEquality"/>
<module name="NestedForDepth">
<property name="max" value="3"/>
</module>
<module name="NestedIfDepth">
<property name="max" value="4"/>
</module>
<module name="UncommentedMain">
<property name="excludedClasses" value=".*Application$"/>
</module>
<module name="Regexp">
<property name="format" value="System\.out\.println"/>
<property name="illegalPattern" value="true"/>
</module>
<module name="ReturnCount">
<property name="max" value="4"/>
</module>
<module name="NestedTryDepth ">
<property name="max" value="4"/>
</module>
<module name="SuperFinalize"/>
<module name="SuperClone"/>
</module>
</module>

@ -0,0 +1,28 @@
<?xml version="1.0"?>
<!--
~ 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.
-->
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress checks="MagicNumber" files="ResizableCapacityLinkedBlockingQueue.java"/>
<suppress checks="InnerAssignment" files="ResizableCapacityLinkedBlockingQueue.java"/>
<suppress checks="StaticVariableName" files="ApplicationContextHolder.java"/>
<suppress checks="StaticVariableName" files="JacksonHandler.java"/>
<suppress checks="MagicNumber" files="ByteConvertUtil.java"/>
</suppressions>

@ -85,7 +85,7 @@ public class JWTAuthorizationFilter extends BasicAuthenticationFilter {
String resultStatus = "-1";
if (ex instanceof ServiceException) {
ServiceException serviceException = (ServiceException) ex;
resultStatus = serviceException.errorCode.getCode();
resultStatus = serviceException.getErrorCode().getCode();
}
response.getWriter().write(JSONUtil.toJSONString(Results.failure(resultStatus, ex.getMessage())));
response.getWriter().flush();

@ -65,8 +65,8 @@ import java.util.concurrent.locks.ReentrantLock;
**/
public class ResizableCapacityLinkedBlockingQueue<E> extends AbstractQueue<E>
implements
BlockingQueue<E>,
java.io.Serializable {
BlockingQueue<E>,
java.io.Serializable {
private static final long serialVersionUID = -6903933977591709194L;
@ -233,7 +233,7 @@ public class ResizableCapacityLinkedBlockingQueue<E> extends AbstractQueue<E>
*/
public ResizableCapacityLinkedBlockingQueue(Collection<? extends E> c) {
this(Integer.MAX_VALUE);
for (Iterator<? extends E> it = c.iterator(); it.hasNext(); ) {
for (Iterator<? extends E> it = c.iterator(); it.hasNext();) {
add(it.next());
}
}
@ -357,7 +357,7 @@ public class ResizableCapacityLinkedBlockingQueue<E> extends AbstractQueue<E>
final AtomicInteger count = this.count;
putLock.lockInterruptibly();
try {
for (; ; ) {
for (;;) {
if (count.get() < capacity) {
insert(o);
c = count.getAndIncrement();
@ -463,7 +463,7 @@ public class ResizableCapacityLinkedBlockingQueue<E> extends AbstractQueue<E>
final ReentrantLock takeLock = this.takeLock;
takeLock.lockInterruptibly();
try {
for (; ; ) {
for (;;) {
if (count.get() > 0) {
x = extract();
c = count.getAndDecrement();
@ -832,7 +832,7 @@ public class ResizableCapacityLinkedBlockingQueue<E> extends AbstractQueue<E>
last = head = new Node<E>(null);
// Read in all elements and place in queue
for (; ; ) {
for (;;) {
@SuppressWarnings("unchecked")
E item = (E) s.readObject();
if (item == null) {

@ -91,7 +91,7 @@ public class DynamicThreadPoolServiceLoader {
try {
return clazz.getDeclaredConstructor().newInstance();
} catch (InstantiationException | IllegalAccessException | InvocationTargetException
| NoSuchMethodException e) {
| NoSuchMethodException e) {
throw new ServiceLoaderInstantiationException(clazz, e);
}
}

@ -25,9 +25,9 @@ import java.text.DecimalFormat;
public class ByteConvertUtil {
public static final int KB_SIZE = 2 << 9;
public static final int MB_SIZE = 2 << 19;
public static final int GB_SIZE = 2 << 29;
public static String getPrintSize(long size) {

@ -7,6 +7,7 @@
<version>${revision}</version>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<url>https://github.com/opengoofy/hippo4j</url>
<description>Dynamic observable thread pool framework</description>
<modules>
@ -60,6 +61,7 @@
<java.version>1.8</java.version>
<skip.maven.gpg.plugin>true</skip.maven.gpg.plugin>
<skip.spotless.apply>false</skip.spotless.apply>
<skip.checkstyle.check>true</skip.checkstyle.check>
<maven.javadoc.failOnError>false</maven.javadoc.failOnError>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -70,6 +72,7 @@
<maven.jar.plugin.version>3.0.2</maven.jar.plugin.version>
<license-maven-plugin.version>3.0</license-maven-plugin.version>
<spotless-maven-plugin.version>2.22.1</spotless-maven-plugin.version>
<maven-checkstyle-plugin.version>3.1.0</maven-checkstyle-plugin.version>
</properties>
<dependencyManagement>
@ -81,104 +84,87 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>${okhttp3.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool-all.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>cn.hippo4j</groupId>
<artifactId>hippo4j-message</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.hippo4j</groupId>
<artifactId>hippo4j-core</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.hippo4j</groupId>
<artifactId>hippo4j-adapter-base</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<dependency>
<groupId>com.github.dozermapper</groupId>
<artifactId>dozer-core</artifactId>
<version>${dozer.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
<version>${dingtalk-sdk.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
<version>${transmittable-thread-local.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hibernate-validator.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-api.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-json</artifactId>
<version>${spring-boot.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
@ -297,21 +283,6 @@
<file>${maven.multiModuleProjectDirectory}/dev-support/license-header</file>
</licenseHeader>
</java>
<pom>
<sortPom>
<encoding>UTF-8</encoding>
<nrOfIndentSpace>4</nrOfIndentSpace>
<keepBlankLines>true</keepBlankLines>
<indentBlankLines>false</indentBlankLines>
<indentSchemaLocation>true</indentSchemaLocation>
<spaceBeforeCloseEmptyElement>true</spaceBeforeCloseEmptyElement>
<sortModules>false</sortModules>
<sortExecutions>false</sortExecutions>
<predefinedSortOrder>custom_1</predefinedSortOrder>
<expandEmptyElements>false</expandEmptyElements>
<sortProperties>false</sortProperties>
</sortPom>
</pom>
</configuration>
<executions>
<execution>
@ -322,11 +293,33 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
<configuration>
<configLocation>${maven.multiModuleProjectDirectory}/dev-support/hippo4j_checkstyle.xml</configLocation>
<suppressionsLocation>${maven.multiModuleProjectDirectory}/dev-support/hippo4j_checkstyle_suppression.xml</suppressionsLocation>
<!-- Do not scan the test directory for now -->
<includeTestSourceDirectory>false</includeTestSourceDirectory>
<consoleOutput>true</consoleOutput>
<encoding>UTF-8</encoding>
<skip>${skip.checkstyle.check}</skip>
<violationSeverity>error</violationSeverity>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>checkstyle</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<url>https://github.com/opengoofy/hippo4j</url>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>

Loading…
Cancel
Save