code: private synchronized RemoteBundleContext getRemoteBundleContext() {
          if (remoteBundleContext == null) {
  
              // !! Absolutely necesary for RMI class loading to work
              // TODO maybe use ContextClassLoaderUtils.doWithClassLoader
              Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
              LOG.info("Waiting for remote bundle context.. on " + registry + " name: " + name
                  + " timout: " + rmiLookupTimeout);
              // TODO create registry here
              Throwable reason = null;
              long startedTrying = System.currentTimeMillis();
  
              do {
                  try {
                      remoteBundleContext = (RemoteBundleContext) getRegistry(registry).lookup(name);
                  }
                  catch (RemoteException e) {
                      reason = e;
                  }
                  catch (NotBoundException e) {
                      reason = e;
                  }
              }
              while (remoteBundleContext == null
                  && (rmiLookupTimeout.isNoTimeout() || System.currentTimeMillis() < startedTrying
                      + rmiLookupTimeout.getValue()));
              if (remoteBundleContext == null) {
                  throw new RuntimeException("Cannot get the remote bundle context", reason);
              }
              LOG.debug("Remote bundle context found after "
                  + (System.currentTimeMillis() - startedTrying) + " millis");
          }
          return remoteBundleContext;
  
      }
docs: Looks up the {@link RemoteBundleContext} via RMI. The lookup will timeout in the specified
  number of millis.
  
  @return remote bundle context