void (@NotNull Future<?> future, @NotNull @NlsSafe String taskName) { try { future.get(1, TimeUnit.SECONDS); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof ProcessCanceledException || cause instanceof CancellationException) { // ignore: expected cancellation } else { LOG.error(e); } } catch (CancellationException ignored) { } catch (InterruptedException | TimeoutException e) { LOG.debug("Couldn't await background process on disposal: " + taskName); } }