Skip to content

Commit

Permalink
[JENKINS-19465] - Fix FindBugs warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-nenashev committed Nov 21, 2017
1 parent cd25d13 commit 7051b60
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/hudson/plugins/sshslaves/SSHLauncher.java
Expand Up @@ -269,10 +269,12 @@ public Object readResolve() {
*/
public final Integer retryWaitTime;

// TODO: It is a bad idea to create a new Executor service for each launcher.
// Maybe a Remoting thread pool should be used, but it requires the logic rework to Futures
/**
* Keeps executor service for the async launch operation.
*/
@javax.annotation.CheckForNull
@CheckForNull
private transient volatile ExecutorService launcherExecutorService;

/**
Expand Down Expand Up @@ -847,7 +849,9 @@ public Boolean call() throws InterruptedException {
try {
long time = System.currentTimeMillis();
List<Future<Boolean>> results;
assert launcherExecutorService != null : "It should be always non-null here, because the task allocates and closes service on its own";
if (launcherExecutorService == null) {
throw new IllegalStateException("Launcher Executor Service should be always non-null here, because the task allocates and closes service on its own");
}
if (this.getLaunchTimeoutMillis() > 0) {
results = launcherExecutorService.invokeAll(callables, this.getLaunchTimeoutMillis(), TimeUnit.MILLISECONDS);
} else {
Expand Down

0 comments on commit 7051b60

Please sign in to comment.