fix causing cpu 100% when set ScheduledThreadPoolExecutor corePoolSize=0

pull/101/head
lepdou 3 years ago
parent ce20863792
commit 471afa8fee

@ -1,19 +1,5 @@
# Change Log # Change Log
--- ---
- [the server address only support one ip](https://github.com/Tencent/spring-cloud-tencent/pull/36) - [Bugfix: fix causing cpu 100% when set ScheduledThreadPoolExecutor corePoolSize=0](https://github.com/Tencent/spring-cloud-tencent/pull/101)
- [feature: get service list by given namespace](https://github.com/Tencent/spring-cloud-tencent/pull/38)
- [feat:Support multi-discovery server.](https://github.com/Tencent/spring-cloud-tencent/pull/42)
- [fix:fix [Deserialization of Untrusted Data in logback]](https://github.com/Tencent/spring-cloud-tencent/pull/44/files)
- [feat:support customize registered ip address.](https://github.com/Tencent/spring-cloud-tencent/pull/47)
- [fix:fix import default log implement error](https://github.com/Tencent/spring-cloud-tencent/pull/53)
- [send heartbeat if healthcheck url not configured](https://github.com/Tencent/spring-cloud-tencent/pull/54)
- [feat:optimize project structure and checkstyle](https://github.com/Tencent/spring-cloud-tencent/pull/56)
- [feat:divide storage and transfer of metadata.](https://github.com/Tencent/spring-cloud-tencent/pull/63)
- [feat:support polaris config center.](https://github.com/Tencent/spring-cloud-tencent/pull/69)
- [feat:optimize metadata module.](https://github.com/Tencent/spring-cloud-tencent/pull/70)
- [feat: optimize pom dependency and demo](https://github.com/Tencent/spring-cloud-tencent/pull/71)
- [feat:upgrade polaris version to 1.3.0.](https://github.com/Tencent/spring-cloud-tencent/pull/72)
- [feat:rollback init polaris-context to application phase](https://github.com/Tencent/spring-cloud-tencent/pull/73)
- [fix:fix junit not working bug.](https://github.com/Tencent/spring-cloud-tencent/pull/96)

@ -0,0 +1,19 @@
# Change Log
---
- [the server address only support one ip](https://github.com/Tencent/spring-cloud-tencent/pull/36)
- [feature: get service list by given namespace](https://github.com/Tencent/spring-cloud-tencent/pull/38)
- [feat:Support multi-discovery server.](https://github.com/Tencent/spring-cloud-tencent/pull/42)
- [fix:fix [Deserialization of Untrusted Data in logback]](https://github.com/Tencent/spring-cloud-tencent/pull/44/files)
- [feat:support customize registered ip address.](https://github.com/Tencent/spring-cloud-tencent/pull/47)
- [fix:fix import default log implement error](https://github.com/Tencent/spring-cloud-tencent/pull/53)
- [send heartbeat if healthcheck url not configured](https://github.com/Tencent/spring-cloud-tencent/pull/54)
- [feat:optimize project structure and checkstyle](https://github.com/Tencent/spring-cloud-tencent/pull/56)
- [feat:divide storage and transfer of metadata.](https://github.com/Tencent/spring-cloud-tencent/pull/63)
- [feat:support polaris config center.](https://github.com/Tencent/spring-cloud-tencent/pull/69)
- [feat:optimize metadata module.](https://github.com/Tencent/spring-cloud-tencent/pull/70)
- [feat: optimize pom dependency and demo](https://github.com/Tencent/spring-cloud-tencent/pull/71)
- [feat:upgrade polaris version to 1.3.0.](https://github.com/Tencent/spring-cloud-tencent/pull/72)
- [feat:rollback init polaris-context to application phase](https://github.com/Tencent/spring-cloud-tencent/pull/73)
- [fix:fix junit not working bug.](https://github.com/Tencent/spring-cloud-tencent/pull/96)

@ -77,7 +77,7 @@
<properties> <properties>
<!-- Project revision --> <!-- Project revision -->
<revision>1.2.0-2020.0.5</revision> <revision>1.3.0-2020.0.5-SNAPSHOT</revision>
<!-- Spring Cloud --> <!-- Spring Cloud -->
<spring.cloud.version>2020.0.5</spring.cloud.version> <spring.cloud.version>2020.0.5</spring.cloud.version>

@ -18,8 +18,8 @@
package com.tencent.cloud.polaris.registry; package com.tencent.cloud.polaris.registry;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import com.tencent.cloud.common.metadata.config.MetadataLocalProperties; import com.tencent.cloud.common.metadata.config.MetadataLocalProperties;
@ -68,13 +68,11 @@ public class PolarisServiceRegistry implements ServiceRegistry<Registration> {
this.polarisDiscoveryProperties = polarisDiscoveryProperties; this.polarisDiscoveryProperties = polarisDiscoveryProperties;
this.polarisDiscoveryHandler = polarisDiscoveryHandler; this.polarisDiscoveryHandler = polarisDiscoveryHandler;
this.metadataLocalProperties = metadataLocalProperties; this.metadataLocalProperties = metadataLocalProperties;
if (polarisDiscoveryProperties.isHeartbeatEnabled()) { if (polarisDiscoveryProperties.isHeartbeatEnabled()) {
ScheduledThreadPoolExecutor heartbeatExecutor = new ScheduledThreadPoolExecutor(0, this.heartbeatExecutor = Executors
new NamedThreadFactory("spring-cloud-heartbeat")); .newSingleThreadScheduledExecutor(new NamedThreadFactory("spring-cloud-heartbeat"));
heartbeatExecutor.setMaximumPoolSize(1); } else {
this.heartbeatExecutor = heartbeatExecutor;
}
else {
this.heartbeatExecutor = null; this.heartbeatExecutor = null;
} }
} }

@ -62,7 +62,7 @@
</developers> </developers>
<properties> <properties>
<revision>1.2.0-2020.0.5</revision> <revision>1.3.0-2020.0.5-SNAPSHOT</revision>
<polaris.version>1.3.1</polaris.version> <polaris.version>1.3.1</polaris.version>
<powermock.version>2.0.0</powermock.version> <powermock.version>2.0.0</powermock.version>

Loading…
Cancel
Save