Skip to content
Permalink
Browse files
[fixed JENKINS-34794] Jenkins sometimes doesn't start because of tran…
…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 9630aaacd285e91b0de87b590dd76ac6d751c54f
Showing with 10 additions and 2 deletions.
  1. +10 −2 src/main/java/org/jvnet/hudson/plugins/monitoring/NodesListener.java
@@ -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
@@ -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;

0 comments on commit 9630aaa

Please sign in to comment.