< prev index next >
src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/RetryExecutor.java
Print this page
@@ -51,10 +51,14 @@
void abort() {
aborted = true;
}
+ void stop() {
+ stop = true;
+ }
+
static RetryExecutor retryOnKnownErrorMessage(String v) {
RetryExecutor result = new RetryExecutor();
return result.setExecutorInitializer(exec -> {
exec.setOutputConsumer(output -> {
if (!output.anyMatch(v::equals)) {
@@ -72,12 +76,17 @@
executeLoop(() -> Executor.of(pb));
}
private void executeLoop(Supplier<Executor> execSupplier) throws IOException {
aborted = false;
+ stop = false;
for (;;) {
try {
+ if (stop) {
+ break;
+ }
+
Executor exec = execSupplier.get();
if (executorInitializer != null) {
executorInitializer.accept(exec);
}
exec.executeExpectSuccess();
@@ -97,8 +106,9 @@
}
}
private Consumer<Executor> executorInitializer;
private boolean aborted;
+ private boolean stop;
private int attempts;
private int timeoutMillis;
}
< prev index next >