public static AddonFilter allStarted() { return (addon) -> addon.getStatus().isStarted(); }
public static AddonFilter allNotStarted() { return (addon) -> !addon.getStatus().isStarted(); }
public static void waitUntilStarted(Addon addon) { try { while (!addon.getStatus().isStarted()) { Thread.sleep(10); } } catch (Exception e) { throw new ContainerException("Addon [" + addon + "] was not started.", e); } }
public static void waitUntilStarted(Addon addon, int quantity, TimeUnit unit) throws TimeoutException { long start = System.currentTimeMillis(); long threshold = start + TimeUnit.MILLISECONDS.convert(quantity, unit); while (!addon.getStatus().isStarted()) { if (System.currentTimeMillis() > threshold) { throw new TimeoutException("Timeout expired waiting for [" + addon + "] to start."); } try { Thread.sleep(10); } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new ContainerException("Addon [" + addon + "] was not started.", e); } } }
public static void waitUntilStopped(Addon addon) { if (addon != null) { try { while (addon.getStatus().isStarted()) { Thread.sleep(10); } } catch (Exception e) { throw new ContainerException("Addon [" + addon + "] was not stopped.", e); } } }
public static void waitUntilStopped(Addon addon, int quantity, TimeUnit unit) throws TimeoutException { if (addon != null) { long start = System.currentTimeMillis(); long threshold = start + TimeUnit.MILLISECONDS.convert(quantity, unit); while (addon.getStatus().isStarted()) { if (System.currentTimeMillis() > threshold) { throw new TimeoutException("Timeout expired waiting for [" + addon + "] to stop."); } try { Thread.sleep(10); } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new ContainerException("Addon [" + addon + "] was not stopped.", e); } } } }
/** * Waits until the specified {@link Addon} starts or is missing */ public static void waitUntilStartedOrMissing(Addon addon, int quantity, TimeUnit unit) throws TimeoutException { if (addon != null) { long start = System.currentTimeMillis(); long threshold = start + TimeUnit.MILLISECONDS.convert(quantity, unit); while (!addon.getStatus().isStarted() && !addon.getStatus().isMissing()) { if (System.currentTimeMillis() > threshold) { throw new TimeoutException("Timeout expired waiting for [" + addon + "] to load."); } try { Thread.sleep(10); } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new ContainerException("Addon [" + addon + "] was not loaded.", e); } } } }
future.get(); if (addon.getStatus().isStarted())