/** * Waits for the license manager to update the license state. The manager * may update the state in an asynchronous fashion. This method waits until * the state's {@link com.springsource.vfabric.licensing.state.LicenseState#getTimestamp()} * is after the given time. * * @param timestampAfter The resulting state will have a timestamp > timestampAfter * @param timeout How long should we wait before returning? * * @return null if an updated license state could not be obtained */ LicenseState awaitStateUpdate(Date timestampAfter, Time timeout) { Time now = timeSvc.nowNanoTime(); Time end = now.plus(timeout); while (now.isBefore(end)) { LicenseState state = licenseManager.getComponentLicenseState(); if (state != null && state.getTimestamp().after(timestampAfter)) { return state; } timeSvc.sleep(Time.inSeconds(1)); now = timeSvc.nowNanoTime(); } return null; }