Created
June 5, 2016 23:04
-
-
Save korzha/0313dc05be37d77a40901f7172590390 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ArrayList<Throwable> throwables = new ArrayList<>(); | |
onClose.forEach((runnable) -> { | |
try { | |
runnable.run(); | |
} catch (Throwable e) { | |
throwables.add(e); | |
} | |
}); | |
if (!throwables.isEmpty()) { | |
Throwable e = throwables.get(0); | |
for (int i = 1; i < throwables.size(); i++) { | |
Throwable suppressed = throwables.get(i); | |
if (suppressed != e) { | |
e.addSuppressed(suppressed); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment