private void waitForModified()

in src/main/java/org/apache/sling/launchpad/testservices/servlets/AnonymousAccessConfigServlet.java [96:110]


    private void waitForModified(final int existingModifiedCounter, final long timeoutMsec) {
        final int targetCounter = existingModifiedCounter + 1;
        final long end = System.currentTimeMillis() + timeoutMsec;
        while (modifiedCounter < targetCounter && System.currentTimeMillis() < end) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException ignored) {
            }
        }

        if (modifiedCounter < targetCounter) {
            throw new IllegalStateException(
                    "Event counter did not reach " + targetCounter + ", waited " + timeoutMsec + " msec");
        }
    }