Skip to content
Permalink
Browse files
Merge pull request #61 from fbelzunc/JENKINS-38784-v2
[FIXED JENKINS-38784] Build the threadPoolExecutor in the right place
  • Loading branch information
fbelzunc committed Mar 3, 2017
2 parents 079bd37 + 1f53b9d commit 95effde74165eab169a7c4e240b9399ede908085
Showing 2 changed files with 31 additions and 29 deletions.
@@ -208,25 +208,6 @@ public class ActiveDirectorySecurityRealm extends AbstractPasswordBasedSecurityR

public transient String testSite;

/**
* The core pool size for the {@link ExecutorService}
*/
private static final int corePoolSize = Integer.parseInt(System.getProperty("hudson.plugins.active_directory.threadPoolExecutor.corePoolSize", "4"));

/**
* The max pool size for the {@link ExecutorService}
*/
private static final int maxPoolSize = Integer.parseInt(System.getProperty("hudson.plugins.active_directory.threadPoolExecutor.maxPoolSize", "8"));

/**
* The keep alive time for the {@link ExecutorService}
*/
private static final long keepAliveTime = Long.parseLong(System.getProperty("hudson.plugins.active_directory.threadPoolExecutor.keepAliveTime", "10000"));

/**
* The queue size for the {@link ExecutorService}
*/
private static final int queueSize = Integer.parseInt(System.getProperty("hudson.plugins.active_directory.threadPoolExecutor.queueSize", "25"));

public ActiveDirectorySecurityRealm(String domain, String site, String bindName, String bindPassword, String server) {
this(domain, site, bindName, bindPassword, server, GroupLookupStrategy.AUTO, false);
@@ -261,15 +242,6 @@ public ActiveDirectorySecurityRealm(String domain, List<ActiveDirectoryDomain> d
this.groupLookupStrategy = groupLookupStrategy;
this.removeIrrelevantGroups = removeIrrelevantGroups;
this.cache = cache;
this.threadPoolExecutor = new ThreadPoolExecutor(
corePoolSize,
maxPoolSize,
keepAliveTime,
TimeUnit.MILLISECONDS,
new ArrayBlockingQueue<Runnable>(queueSize),
new NamingThreadFactory(new DaemonThreadFactory(), "ActiveDirectory.updateUserCache"),
new ThreadPoolExecutor.DiscardPolicy()
);
}

@DataBoundSetter
@@ -30,6 +30,8 @@
import hudson.security.GroupDetails;
import hudson.security.SecurityRealm;
import hudson.security.UserMayOrMayNotExistException;
import hudson.util.DaemonThreadFactory;
import hudson.util.NamingThreadFactory;
import hudson.util.Secret;

import javax.naming.NameNotFoundException;
@@ -135,6 +137,26 @@ public class ActiveDirectoryUnixAuthenticationProvider extends AbstractActiveDir
*/
private final static String LDAP_READ_TIMEOUT = "com.sun.jndi.ldap.read.timeout";

/**
* The core pool size for the {@link ExecutorService}
*/
private static final int corePoolSize = Integer.parseInt(System.getProperty("hudson.plugins.active_directory.threadPoolExecutor.corePoolSize", "4"));

/**
* The max pool size for the {@link ExecutorService}
*/
private static final int maxPoolSize = Integer.parseInt(System.getProperty("hudson.plugins.active_directory.threadPoolExecutor.maxPoolSize", "8"));

/**
* The keep alive time for the {@link ExecutorService}
*/
private static final long keepAliveTime = Long.parseLong(System.getProperty("hudson.plugins.active_directory.threadPoolExecutor.keepAliveTime", "10000"));

/**
* The queue size for the {@link ExecutorService}
*/
private static final int queueSize = Integer.parseInt(System.getProperty("hudson.plugins.active_directory.threadPoolExecutor.queueSize", "25"));

public ActiveDirectoryUnixAuthenticationProvider(ActiveDirectorySecurityRealm realm) {
this.site = realm.site;
this.domains = realm.domains;
@@ -154,7 +176,15 @@ public ActiveDirectoryUnixAuthenticationProvider(ActiveDirectorySecurityRealm re
this.userCache = cache.getUserCache();
this.groupCache = cache.getGroupCache();

this.threadPoolExecutor = realm.threadPoolExecutor;
this.threadPoolExecutor = new ThreadPoolExecutor(
corePoolSize,
maxPoolSize,
keepAliveTime,
TimeUnit.MILLISECONDS,
new ArrayBlockingQueue<Runnable>(queueSize),
new NamingThreadFactory(new DaemonThreadFactory(), "ActiveDirectory.updateUserCache"),
new ThreadPoolExecutor.DiscardPolicy()
);

Map<String, String> extraEnvVarsMap = ActiveDirectorySecurityRealm.EnvironmentProperty.toMap(realm.environmentProperties);
// TODO In JDK 8u65 I am facing JDK-8139721, JDK-8139942 which makes the plugin to break. Uncomment line once it is fixed.

0 comments on commit 95effde

Please sign in to comment.