void updateBestService() {

    // check the last-known best service is still the best
    final Iterator<Import<S>> i = services.iterator();
    final Import<S> bestImport = i.hasNext() ? i.next() : null;

    if (null != currentImport && currentImport.equals(bestImport)) {
      return; // still the same...
    }

    // best service has changed
    if (null != currentExport) {
      currentExport.unput();
    }

    // report service (if any)
    currentImport = bestImport;
    currentExport = null == bestImport ? null : watcher.add(bestImport);
  }
Exemple #2
0
 @Override
 public void stop(BundleContext context) throws Exception {
   handle.unput();
   WFAdaptorPlugin.injector = null;
 }