diff --git a/changelog.html b/changelog.html
index 5ac34cc3f1..9cef01f641 100644
--- a/changelog.html
+++ b/changelog.html
@@ -80,6 +80,8 @@ Upcoming changes
Strongly encrypt proxy credentials
(issue 4002)
+
+ Added an extension point to allow prodding the NodeProvisioner into taking action faster than it might usually.
diff --git a/core/src/main/java/hudson/slaves/NodeProvisioner.java b/core/src/main/java/hudson/slaves/NodeProvisioner.java
index 26f111be19..c72091a973 100644
--- a/core/src/main/java/hudson/slaves/NodeProvisioner.java
+++ b/core/src/main/java/hudson/slaves/NodeProvisioner.java
@@ -23,6 +23,7 @@
*/
package hudson.slaves;
+import hudson.model.Computer;
import hudson.model.LoadStatistics;
import hudson.model.Node;
import hudson.model.Hudson;
@@ -41,6 +42,7 @@ import java.util.List;
import java.util.Collection;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
import java.util.logging.Level;
import java.io.IOException;
@@ -87,6 +89,8 @@ public class NodeProvisioner {
private List pendingLaunches = new ArrayList();
+ private transient volatile long lastSuggestedReview;
+
/**
* Exponential moving average of the "planned capacity" over time, which is the number of
* additional executors being brought up.
@@ -113,11 +117,29 @@ public class NodeProvisioner {
return new ArrayList(pendingLaunches);
}
+ /**
+ * Give the {@link NodeProvisioner} a hint that now would be a good time to think about provisioning some nodes.
+ * The hint will be ignored if subjected to excessive pestering by callers.
+ *
+ * @since 1.415
+ */
+ public void suggestReviewNow() {
+ if (System.currentTimeMillis() > lastSuggestedReview + TimeUnit.SECONDS.toMillis(1)) {
+ lastSuggestedReview = System.currentTimeMillis();
+ Computer.threadPoolForRemoting.submit(new Runnable() {
+ public void run() {
+ update();
+ }
+ });
+ }
+ }
+
/**
* Periodically invoked to keep track of the load.
* Launches additional nodes if necessary.
*/
private synchronized void update() {
+ lastSuggestedReview = System.currentTimeMillis();
Hudson hudson = Hudson.getInstance();
// clean up the cancelled launch activity, then count the # of executors that we are about to bring up.