code: public <W extends T> W get(final Class<W> clazz, int timeoutMs) {
      try {
        CommonUtils.waitFor("server " + clazz.getName() + " to be created", () -> {
          try (LockResource r = new LockResource(mLock)) {
            return mRegistry.get(clazz) != null;
          }
        }, WaitForOptions.defaults().setTimeoutMs(timeoutMs));
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new RuntimeException(e);
      } catch (TimeoutException e) {
        throw new RuntimeException(e);
      }
      T server = mRegistry.get(clazz);
      if (!(clazz.isInstance(server))) {
        throw new RuntimeException("Server is not an instance of " + clazz.getName());
      }
      return clazz.cast(server);
    }
docs: Attempts to look up the {@link Server} for the given class. Because {@link Server}s can be
  looked up and added to the registry in parallel, the lookup is retried until the given timeout
  period has elapsed.
  
  @param clazz the class of the {@link Server} to get
  @param timeoutMs timeout for looking up the server
  @param <W> the type of the {@link Server} to get
  @return the {@link Server} instance