code: private void refresh(Collection<Bundle> bundles) {
          if (FrameworkState.isStopping()) {
              // do nothing; system is shutting down removal pendings will be removed automatically
              return;
          }
          Bundle system = context.getBundle(Constants.SYSTEM_BUNDLE_LOCATION);
          FrameworkWiring fwkWiring = system.adapt(FrameworkWiring.class);
          final CountDownLatch refreshed = new CountDownLatch(1);
          fwkWiring.refreshBundles(bundles, new FrameworkListener() {
  
              @Override
              public void frameworkEvent(FrameworkEvent event) {
                  refreshed.countDown();
              }
          });
          try {
              // only wait for 30 seconds
              refreshed.await(30, TimeUnit.SECONDS);
          } catch (InterruptedException e) {
              // not really expected; auto-FFDC is ok
              // keep thread interrupted
              Thread.interrupted();
          }
      }
docs: /*
  Does a refreshBundles call and waits for the async operation to complete before returning.