Skip to content

Commit

Permalink
Crash at most once.
Browse files Browse the repository at this point in the history
  • Loading branch information
shartte committed Jul 5, 2024
1 parent 6c16970 commit d0186e8
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
Expand Down Expand Up @@ -299,7 +300,11 @@ public String getGLVersion() {
return this.glVersion;
}

private final ReentrantLock crashLock = new ReentrantLock();

private void crashElegantly(String errorDetails) {
crashLock.lock(); // Crash at most once!

String qrText;
try (var is = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/glfailure.txt")))) {
qrText = is.lines().collect(Collectors.joining("\n"));
Expand Down

0 comments on commit d0186e8

Please sign in to comment.