/** * Block synchronously waiting for a job to end, success or not. * * @param jobkey Job to wait for. * @param pollingIntervalMillis Polling interval sleep time. */ public static void waitUntilJobEnded(Key jobkey, int pollingIntervalMillis) { while (true) { if (Job.isEnded(jobkey)) { return; } try { Thread.sleep(pollingIntervalMillis); } catch (Exception ignore) { } } }