Permalink
Browse files

Merge pull request #1230 from daniel-beck/JENKINS-22934

[FIXED JENKINS-22934] Show poll thread count option when necessary.
  • Loading branch information...
oleg-nenashev committed Jun 1, 2014
2 parents 1b81efb + e4902e7 commit 91ef9113262359ab45ed710d6ecad0f73df7b434
@@ -46,6 +46,8 @@
import hudson.util.SequentialExecutionQueue;
import org.apache.commons.io.FileUtils;
import org.apache.commons.jelly.XMLOutput;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.DataBoundConstructor;

@@ -261,6 +263,15 @@ public void setPollingThreadCount(int n) {
resizeThreadPool();
}

@Restricted(NoExternalUse.class)
public boolean isPollingThreadCountOptionVisible() {
// unless you have a fair number of projects, this option is likely pointless.
// so let's hide this option for new users to avoid confusing them
// unless it was already changed
return Jenkins.getInstance().getAllItems(AbstractProject.class).size() > 10
|| getPollingThreadCount() != 0;
}

/**
* Update the {@link ExecutorService} instance.
*/
@@ -24,11 +24,7 @@ THE SOFTWARE.

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<j:if test="${app.items.size()>10}">
<!--
unless you have a fair number of projects, this option is likely pointless.
so let's hide this option for new users to avoid confusing them.
-->
<j:if test="${descriptor.pollingThreadCountOptionVisible}">
<f:section title="${%SCM Polling}">
<f:entry title="${%Max # of concurrent polling}" field="pollingThreadCount">
<f:number value="${descriptor.pollingThreadCount==0 ? '' : descriptor.pollingThreadCount}"

0 comments on commit 91ef911

Please sign in to comment.