Schema_146: Fix FutureReturnValueIgnored warning flagged by error prone
Error prone complaining about non used Future return value:
Schema_146.java:111: warning: [FutureReturnValueIgnored] Return \
value of methods returning Future must be checked. Ignoring returned \
Futures suppresses exceptions thrown from the code that completes \
the Future.
pool.submit(() -> processBatch(db, batch, ui));
^
(see https://errorprone.info/bugpattern/FutureReturnValueIgnored)
Change-Id: Idcfe6d2eb0637eb01aa8224fefa8d24fbdae31e2
This commit is contained in:
committed by
David Pursehouse
parent
ec43a2f070
commit
221c164d2a
@@ -42,6 +42,7 @@ import java.util.Map.Entry;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
@@ -105,7 +106,12 @@ public class Schema_146 extends SchemaVersion {
|
|||||||
Sets.newHashSet(Iterables.partition(accounts, 500));
|
Sets.newHashSet(Iterables.partition(accounts, 500));
|
||||||
ExecutorService pool = createExecutor(ui);
|
ExecutorService pool = createExecutor(ui);
|
||||||
try {
|
try {
|
||||||
batches.stream().forEach(batch -> pool.submit(() -> processBatch(db, batch, ui)));
|
batches.stream()
|
||||||
|
.forEach(
|
||||||
|
batch -> {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
Future<?> unused = pool.submit(() -> processBatch(db, batch, ui));
|
||||||
|
});
|
||||||
pool.shutdown();
|
pool.shutdown();
|
||||||
pool.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
|
pool.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user