while --timeout attachment available Thread sleep 1000 if attachment a

1
2
3
4
5
6
while (--timeout > 0 && !attachment.available()) {
Thread.sleep(1000);
}
if (!attachment.available()) {
throw new RuntimeException("Uploading track timeout");
}