Merge "Assign unused Future return value to a variable"

* submodules:
* Update plugins/reviewnotes from branch 'master'
  - Assign unused Future return value to a variable
    
    Error Prone plans to make this pattern into a compile error; this avoids
    future breakage.
    
    Change-Id: I6a023f22f472941854a6729f6450b9b70a020069
This commit is contained in:
Dave Borowitz
2017-02-08 13:58:39 +00:00
committed by Gerrit Code Review
20 changed files with 161 additions and 104 deletions

View File

@@ -49,6 +49,7 @@ import java.util.concurrent.Callable;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
@@ -169,22 +170,28 @@ public class GerritServer {
} else {
site = initSite(cfg);
daemonService = Executors.newSingleThreadExecutor();
daemonService.submit(
new Callable<Void>() {
@Override
public Void call() throws Exception {
int rc =
daemon.main(
new String[] {
"-d", site.getPath(), "--headless", "--console-log", "--show-stack-trace",
});
if (rc != 0) {
System.err.println("Failed to start Gerrit daemon");
serverStarted.reset();
}
return null;
}
});
@SuppressWarnings("unused")
Future<?> possiblyIgnoredError =
daemonService.submit(
new Callable<Void>() {
@Override
public Void call() throws Exception {
int rc =
daemon.main(
new String[] {
"-d",
site.getPath(),
"--headless",
"--console-log",
"--show-stack-trace",
});
if (rc != 0) {
System.err.println("Failed to start Gerrit daemon");
serverStarted.reset();
}
return null;
}
});
serverStarted.await();
System.out.println("Gerrit Server Started");
}