@@ -12,6 +12,10 @@ matrix: | |||||
allow_failures: | allow_failures: | ||||
- env: BUILD_JDK=ORACLE_JDK_11 | - env: BUILD_JDK=ORACLE_JDK_11 | ||||
# https://docs.travis-ci.com/user/languages/java/#maven-dependency-management | |||||
install: | |||||
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V -DminimumPriority=1 | |||||
after_success: | after_success: | ||||
- bash <(curl -s https://codecov.io/bash) | - bash <(curl -s https://codecov.io/bash) | ||||
@@ -186,6 +186,46 @@ | |||||
<build> | <build> | ||||
<plugins> | <plugins> | ||||
<plugin> | |||||
<groupId>org.apache.maven.plugins</groupId> | |||||
<artifactId>maven-pmd-plugin</artifactId> | |||||
<version>3.8</version> | |||||
<configuration> | |||||
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding> | |||||
<targetJdk>1.8</targetJdk> | |||||
<excludes> | |||||
<exclude>**/*_jmhTest.java</exclude> | |||||
</excludes> | |||||
<printFailingErrors>true</printFailingErrors> | |||||
<rulesets> | |||||
<ruleset>rulesets/java/ali-comment.xml</ruleset> | |||||
<ruleset>rulesets/java/ali-concurrent.xml</ruleset> | |||||
<ruleset>rulesets/java/ali-constant.xml</ruleset> | |||||
<ruleset>rulesets/java/ali-exception.xml</ruleset> | |||||
<ruleset>rulesets/java/ali-flowcontrol.xml</ruleset> | |||||
<ruleset>rulesets/java/ali-naming.xml</ruleset> | |||||
<ruleset>rulesets/java/ali-oop.xml</ruleset> | |||||
<ruleset>rulesets/java/ali-orm.xml</ruleset> | |||||
<ruleset>rulesets/java/ali-other.xml</ruleset> | |||||
<ruleset>rulesets/java/ali-set.xml</ruleset> | |||||
</rulesets> | |||||
</configuration> | |||||
<executions> | |||||
<execution> | |||||
<phase>verify</phase> | |||||
<goals> | |||||
<goal>check</goal> | |||||
</goals> | |||||
</execution> | |||||
</executions> | |||||
<dependencies> | |||||
<dependency> | |||||
<groupId>com.alibaba.p3c</groupId> | |||||
<artifactId>p3c-pmd</artifactId> | |||||
<version>1.3.6</version> | |||||
</dependency> | |||||
</dependencies> | |||||
</plugin> | |||||
<plugin> | <plugin> | ||||
<groupId>org.apache.maven.plugins</groupId> | <groupId>org.apache.maven.plugins</groupId> | ||||
<artifactId>maven-compiler-plugin</artifactId> | <artifactId>maven-compiler-plugin</artifactId> | ||||
@@ -60,6 +60,7 @@ import io.netty.util.concurrent.GenericFutureListener; | |||||
*/ | */ | ||||
public class NettyTransportClient implements ClusterTransportClient { | public class NettyTransportClient implements ClusterTransportClient { | ||||
@SuppressWarnings("PMD.ThreadPoolCreationRule") | |||||
private static final ScheduledExecutorService SCHEDULER = Executors.newScheduledThreadPool(1, | private static final ScheduledExecutorService SCHEDULER = Executors.newScheduledThreadPool(1, | ||||
new NamedThreadFactory("sentinel-cluster-transport-client-scheduler")); | new NamedThreadFactory("sentinel-cluster-transport-client-scheduler")); | ||||
@@ -38,6 +38,7 @@ import io.netty.channel.Channel; | |||||
*/ | */ | ||||
public class ConnectionPool { | public class ConnectionPool { | ||||
@SuppressWarnings("PMD.ThreadPoolCreationRule") | |||||
private static final ScheduledExecutorService TIMER = Executors.newScheduledThreadPool(2); | private static final ScheduledExecutorService TIMER = Executors.newScheduledThreadPool(2); | ||||
/** | /** | ||||
@@ -57,6 +57,7 @@ public class DegradeRule extends AbstractRule { | |||||
private static final int RT_MAX_EXCEED_N = 5; | private static final int RT_MAX_EXCEED_N = 5; | ||||
@SuppressWarnings("PMD.ThreadPoolCreationRule") | |||||
private static ScheduledExecutorService pool = Executors.newScheduledThreadPool( | private static ScheduledExecutorService pool = Executors.newScheduledThreadPool( | ||||
Runtime.getRuntime().availableProcessors(), new NamedThreadFactory("sentinel-degrade-reset-task", true)); | Runtime.getRuntime().availableProcessors(), new NamedThreadFactory("sentinel-degrade-reset-task", true)); | ||||
@@ -51,6 +51,7 @@ public class FlowRuleManager { | |||||
private static final FlowPropertyListener LISTENER = new FlowPropertyListener(); | private static final FlowPropertyListener LISTENER = new FlowPropertyListener(); | ||||
private static SentinelProperty<List<FlowRule>> currentProperty = new DynamicSentinelProperty<List<FlowRule>>(); | private static SentinelProperty<List<FlowRule>> currentProperty = new DynamicSentinelProperty<List<FlowRule>>(); | ||||
@SuppressWarnings("PMD.ThreadPoolCreationRule") | |||||
private static final ScheduledExecutorService SCHEDULER = Executors.newScheduledThreadPool(1, | private static final ScheduledExecutorService SCHEDULER = Executors.newScheduledThreadPool(1, | ||||
new NamedThreadFactory("sentinel-metrics-record-task", true)); | new NamedThreadFactory("sentinel-metrics-record-task", true)); | ||||
@@ -88,6 +88,7 @@ public class SystemRuleManager { | |||||
private final static SystemPropertyListener listener = new SystemPropertyListener(); | private final static SystemPropertyListener listener = new SystemPropertyListener(); | ||||
private static SentinelProperty<List<SystemRule>> currentProperty = new DynamicSentinelProperty<List<SystemRule>>(); | private static SentinelProperty<List<SystemRule>> currentProperty = new DynamicSentinelProperty<List<SystemRule>>(); | ||||
@SuppressWarnings("PMD.ThreadPoolCreationRule") | |||||
private final static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1, | private final static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1, | ||||
new NamedThreadFactory("sentinel-system-status-record-task", true)); | new NamedThreadFactory("sentinel-system-status-record-task", true)); | ||||
@@ -84,6 +84,8 @@ public class MetricFetcher { | |||||
private AppManagement appManagement; | private AppManagement appManagement; | ||||
private CloseableHttpAsyncClient httpclient; | private CloseableHttpAsyncClient httpclient; | ||||
@SuppressWarnings("PMD.ThreadPoolCreationRule") | |||||
private ScheduledExecutorService fetchScheduleService = Executors.newScheduledThreadPool(1, | private ScheduledExecutorService fetchScheduleService = Executors.newScheduledThreadPool(1, | ||||
new NamedThreadFactory("sentinel-dashboard-metrics-fetch-task")); | new NamedThreadFactory("sentinel-dashboard-metrics-fetch-task")); | ||||
private ExecutorService fetchService; | private ExecutorService fetchService; | ||||
@@ -48,6 +48,7 @@ public class FooConsumerBootstrap { | |||||
private static final String RES_KEY = "com.alibaba.csp.sentinel.demo.dubbo.FooService:sayHello(java.lang.String)"; | private static final String RES_KEY = "com.alibaba.csp.sentinel.demo.dubbo.FooService:sayHello(java.lang.String)"; | ||||
private static final String INTERFACE_RES_KEY = "com.alibaba.csp.sentinel.demo.dubbo.FooService"; | private static final String INTERFACE_RES_KEY = "com.alibaba.csp.sentinel.demo.dubbo.FooService"; | ||||
@SuppressWarnings("PMD.ThreadPoolCreationRule") | |||||
private static final ExecutorService pool = Executors.newFixedThreadPool(10, | private static final ExecutorService pool = Executors.newFixedThreadPool(10, | ||||
new NamedThreadFactory("dubbo-consumer-pool")); | new NamedThreadFactory("dubbo-consumer-pool")); | ||||
@@ -44,6 +44,7 @@ public class PullConsumerDemo { | |||||
private static final Map<MessageQueue, Long> OFFSET_TABLE = new HashMap<MessageQueue, Long>(); | private static final Map<MessageQueue, Long> OFFSET_TABLE = new HashMap<MessageQueue, Long>(); | ||||
@SuppressWarnings("PMD.ThreadPoolCreationRule") | |||||
private static final ExecutorService pool = Executors.newFixedThreadPool(32); | private static final ExecutorService pool = Executors.newFixedThreadPool(32); | ||||
private static final AtomicLong SUCCESS_COUNT = new AtomicLong(0); | private static final AtomicLong SUCCESS_COUNT = new AtomicLong(0); | ||||
@@ -31,6 +31,7 @@ import reactor.core.scheduler.Schedulers; | |||||
@Service | @Service | ||||
public class FooService { | public class FooService { | ||||
@SuppressWarnings("PMD.ThreadPoolCreationRule") | |||||
private final ExecutorService pool = Executors.newFixedThreadPool(8); | private final ExecutorService pool = Executors.newFixedThreadPool(8); | ||||
private final Scheduler scheduler = Schedulers.fromExecutor(pool); | private final Scheduler scheduler = Schedulers.fromExecutor(pool); | ||||
@@ -48,6 +48,7 @@ public abstract class AutoRefreshDataSource<S, T> extends AbstractDataSource<S, | |||||
startTimerService(); | startTimerService(); | ||||
} | } | ||||
@SuppressWarnings("PMD.ThreadPoolCreationRule") | |||||
private void startTimerService() { | private void startTimerService() { | ||||
service = Executors.newScheduledThreadPool(1, | service = Executors.newScheduledThreadPool(1, | ||||
new NamedThreadFactory("sentinel-datasource-auto-refresh-task", true)); | new NamedThreadFactory("sentinel-datasource-auto-refresh-task", true)); | ||||
@@ -35,6 +35,7 @@ import com.alibaba.csp.sentinel.transport.config.TransportConfig; | |||||
*/ | */ | ||||
public class HeartbeatSenderInitFunc implements InitFunc { | public class HeartbeatSenderInitFunc implements InitFunc { | ||||
@SuppressWarnings("PMD.ThreadPoolCreationRule") | |||||
private static ScheduledExecutorService pool = Executors.newScheduledThreadPool(2, | private static ScheduledExecutorService pool = Executors.newScheduledThreadPool(2, | ||||
new NamedThreadFactory("sentinel-heartbeat-send-task", true)); | new NamedThreadFactory("sentinel-heartbeat-send-task", true)); | ||||
@@ -35,6 +35,7 @@ public class NettyHttpCommandCenter implements CommandCenter { | |||||
private final HttpServer server = new HttpServer(); | private final HttpServer server = new HttpServer(); | ||||
@SuppressWarnings("PMD.ThreadPoolCreationRule") | |||||
private final ExecutorService pool = Executors.newSingleThreadExecutor( | private final ExecutorService pool = Executors.newSingleThreadExecutor( | ||||
new NamedThreadFactory("sentinel-netty-command-center-executor")); | new NamedThreadFactory("sentinel-netty-command-center-executor")); | ||||
@@ -55,6 +55,7 @@ public class SimpleHttpCommandCenter implements CommandCenter { | |||||
@SuppressWarnings("rawtypes") | @SuppressWarnings("rawtypes") | ||||
private static final Map<String, CommandHandler> handlerMap = new ConcurrentHashMap<String, CommandHandler>(); | private static final Map<String, CommandHandler> handlerMap = new ConcurrentHashMap<String, CommandHandler>(); | ||||
@SuppressWarnings("PMD.ThreadPoolCreationRule") | |||||
private ExecutorService executor = Executors.newSingleThreadExecutor( | private ExecutorService executor = Executors.newSingleThreadExecutor( | ||||
new NamedThreadFactory("sentinel-command-center-executor")); | new NamedThreadFactory("sentinel-command-center-executor")); | ||||
private ExecutorService bizExecutor; | private ExecutorService bizExecutor; | ||||