Skip to content

Commit

Permalink
FRWK-673 Fixed chaning the thead pool sizing for Java9+
Browse files Browse the repository at this point in the history
  • Loading branch information
KoxAlen committed Feb 8, 2021
1 parent 3cb2158 commit e1dc839
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 5 deletions.
32 changes: 30 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ buildscript {
}

plugins {
id 'nebula.netflixoss' version '3.4.0'
// id 'nebula.netflixoss' version '3.4.0'
id 'nebula.maven-publish' version '4.9.1'
id 'nebula.release' version '4.1.0'
id 'nebula.dependency-lock' version '4.3.0'
id 'nebula.info' version '3.2.1'
id 'idea'
id 'eclipse'
id 'me.champeau.gradle.jmh' version '0.3.1'
id 'net.saliman.cobertura' version '2.2.8'
}
Expand All @@ -17,6 +23,8 @@ ext {
githubProjectName = rootProject.name
}

group = "com.netflix"

allprojects {
repositories {
jcenter()
Expand All @@ -26,8 +34,14 @@ allprojects {
}

subprojects {
apply plugin: 'nebula.netflixoss'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'nebula.maven-publish'
apply plugin: 'nebula.release'
apply plugin: 'nebula.source-jar'
apply plugin: 'nebula.dependency-lock'
apply plugin: 'nebula.info'
apply plugin: 'nebula.provided-base'
apply plugin: 'nebula.compile-api'

Expand All @@ -53,4 +67,18 @@ subprojects {
scopes.COMPILE.plus += [configurations.provided]
}
}

publishing {
repositories {
maven {
def releasesRepoUrl = "https://nexusng.tuenti.io/repository/maven-release-private/"
def snapshotsRepoUrl = "https://nexusng.tuenti.io/repository/maven-snapshot-private/"
url = version.toString().contains("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = System.getenv "NEXUS_USER"
password = System.getenv "NEXUS_PASS"
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,21 @@ private void touchConfig() {
}

// In JDK 6, setCorePoolSize and setMaximumPoolSize will execute a lock operation. Avoid them if the pool size is not changed.
if (threadPool.getCorePoolSize() != dynamicCoreSize || (allowSizesToDiverge && threadPool.getMaximumPoolSize() != dynamicMaximumSize)) {
int currentMaxPoolSize = threadPool.getMaximumPoolSize();
if (threadPool.getCorePoolSize() != dynamicCoreSize || (allowSizesToDiverge && currentMaxPoolSize != dynamicMaximumSize)) {
if (maxTooLow) {
logger.error("Hystrix ThreadPool configuration for : " + metrics.getThreadPoolKey().name() + " is trying to set coreSize = " +
dynamicCoreSize + " and maximumSize = " + configuredMaximumSize + ". Maximum size will be set to " +
dynamicMaximumSize + ", the coreSize value, since it must be equal to or greater than the coreSize value");
}
threadPool.setCorePoolSize(dynamicCoreSize);
threadPool.setMaximumPoolSize(dynamicMaximumSize);
// In Java9+ the condition corePoolSize <= maximumPoolSize should be always true
if (dynamicCoreSize > currentMaxPoolSize) {
threadPool.setMaximumPoolSize(dynamicMaximumSize);
threadPool.setCorePoolSize(dynamicCoreSize);
} else {
threadPool.setCorePoolSize(dynamicCoreSize);
threadPool.setMaximumPoolSize(dynamicMaximumSize);
}
}

threadPool.setKeepAliveTime(properties.keepAliveTimeMinutes().get(), TimeUnit.MINUTES);
Expand Down

0 comments on commit e1dc839

Please sign in to comment.