while (true) {
Object[] services = tracker.getServices();
if (services == null || services.length < expectedCardinality) {
final int actualCount = (services == null) ? 0 : services.length;
if (stopwatch.elapsedMillis() > timeoutInMilliseconds) {
fail(String.format("Expected to find %d %s services. Found only %d in %d milliseconds",
expectedCardinality, klass.getSimpleName(), actualCount, timeoutInMilliseconds));
}
LOG.info(String.format("Found %d services implementing %s. Trying again in 1s.",