Skip to content

Commit

Permalink
[fixed JENKINS-34794] Jenkins sometimes doesn't start because of tran…
Browse files Browse the repository at this point in the history
…sient NPE (#5)

[fixed JENKINS-34794] Jenkins sometimes doesn't start because of transient NPE
  • Loading branch information
fbelzunc authored and evernat committed May 19, 2016
1 parent 979c74a commit 9630aaa
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -50,7 +50,10 @@ public NodesListener() {
public void onOnline(Computer c, TaskListener listener)
throws IOException, InterruptedException {
try {
getNodesCollector().scheduleCollectNow();
NodesCollector nodesCollector = getNodesCollector();
if (nodesCollector != null) {
nodesCollector.scheduleCollectNow();
}
} catch (final IllegalStateException e) {
// if timer already canceled, do nothing
// [JENKINS-17757] IllegalStateException: Timer already cancelled from NodesCollector.scheduleCollectNow
Expand All @@ -74,7 +77,12 @@ private NodesCollector getNodesCollector() {
final Jenkins jenkins = Jenkins.getInstance();
if (jenkins != null) {
final PluginImpl pluginImpl = jenkins.getPlugin(PluginImpl.class);
nodesCollector = pluginImpl.getFilter().getNodesCollector();
if (pluginImpl != null) {
HudsonMonitoringFilter hMonitoringFilter = pluginImpl.getFilter();
if (hMonitoringFilter != null) {
nodesCollector = hMonitoringFilter.getNodesCollector();
}
}
}
}
return nodesCollector;
Expand Down

0 comments on commit 9630aaa

Please sign in to comment.