Removes an handler factory

        :param svc_ref: ServiceReference of the handler factory to remove
540234
def __remove_handler_factory(self, svc_ref):
        # type: (ServiceReference) -> None
        
        with self.__handlers_lock:
            # Get the handler ID
            handler_id = svc_ref.get_property(handlers_const.PROP_HANDLER_ID)

            # Check if this is the handler we use
            if svc_ref not in self._handlers_refs:
                return

            # Clean up
            self.__context.unget_service(svc_ref)
            self._handlers_refs.remove(svc_ref)
            del self._handlers[handler_id]

            # List the components using this handler
            to_stop = set()  # type: Set[StoredInstance]
            for factory_name in self.__factories:
                _, factory_context = self.__get_factory_with_context(
                    factory_name
                )
                if handler_id in factory_context.get_handlers_ids():
                    to_stop.update(self.__get_stored_instances(factory_name))

            with self.__instances_lock:
                for stored_instance in to_stop:
                    # Extract information
                    context = stored_instance.context
                    name = context.name
                    instance = stored_instance.instance

                    # Clean up the stored instance (iPOPO side)
                    del self.__instances[name]
                    stored_instance.kill()

                    # Add the component to the waiting queue
                    self.__waiting_handlers[name] = (context, instance)

            # Try to find a new handler factory
            new_ref = self.__context.get_service_reference(
                handlers_const.SERVICE_IPOPO_HANDLER_FACTORY,
                "({0}={1})".format(handlers_const.PROP_HANDLER_ID, handler_id),
            )
            if new_ref is not None:
                self.__add_handler_factory(new_ref)
996377
def on_service_departure(self, svc_ref):
        
        with self._lock:
            if svc_ref is self.reference:
                # Forget about the service
                self._value.unset_service()

                # Clear the reference
                self.reference = None

                # Look for a replacement
                self._pending_ref = self._context.get_service_reference(
                    self.requirement.specification, self.requirement.filter
                )

                if self._pending_ref is None:
                    # No replacement found yet, wait a little
                    self.__still_valid = True
                    self.__timer_args = (self._value, svc_ref)
                    self.__timer = threading.Timer(
                        self.__timeout, self.__unbind_call, (False,)
                    )
                    self.__timer.start()

                else:
                    # Notify iPOPO immediately
                    self._ipopo_instance.unbind(self, self._value, svc_ref)
                return True

            return None
816476
public void unregisterComponentBindingsProvider(ServiceReference reference) {
		log.info("unregisterComponentBindingsProvider");
		String[] resourceTypes = OsgiUtil.toStringArray(reference
				.getProperty(ComponentBindingsProvider.RESOURCE_TYPE_PROP),
				new String[0]);
		for (String resourceType : resourceTypes) {
			if (!this.containsKey(resourceType)) {
				continue;
			}
			get(resourceType).remove(reference);
		}
	}
266089
protected synchronized void unsetHandler(ServiceReference<Handler> handlerRef) {

        jaxwsInFlowClientSideGlobalHandlers.removeReference(handlerRef);
        jaxwsOutFlowClientSideGlobalHandlers.removeReference(handlerRef);
        jaxwsInFlowServerSideGlobalHandlers.removeReference(handlerRef);
        jaxwsOutFlowServerSideGlobalHandlers.removeReference(handlerRef);

        jaxrsInFlowClientSideGlobalHandlers.removeReference(handlerRef);
        jaxrsOutFlowClientSideGlobalHandlers.removeReference(handlerRef);
        jaxrsInFlowServerSideGlobalHandlers.removeReference(handlerRef);
        jaxrsOutFlowServerSideGlobalHandlers.removeReference(handlerRef);

        String importPackage = handlerRef.getBundle().getHeaders("").get("Import-package");
        String dynamicImportPackage = handlerRef.getBundle().getHeaders("").get("DynamicImport-Package");

        if ((importPackage != null && importPackage.contains("javax.xml.ws.handler.soap")) ||
            (dynamicImportPackage != null && dynamicImportPackage.contains("javax.xml.ws.handler.soap")))
        {
            saajCount.getAndDecrement();
        }

        clearAllList();

        //jaxws
        Iterator<Handler> registeredHandlers = jaxwsInFlowServerSideGlobalHandlers.getServices();
        while (registeredHandlers.hasNext()) {
            jaxwsInFlowServerSideGlobalHandlers1.add(registeredHandlers.next());
        }

        registeredHandlers = jaxwsOutFlowServerSideGlobalHandlers.getServices();
        while (registeredHandlers.hasNext()) {
            jaxwsOutFlowServerSideGlobalHandlers1.add(0, registeredHandlers.next());
        }

        registeredHandlers = jaxwsInFlowClientSideGlobalHandlers.getServices();
        while (registeredHandlers.hasNext()) {
            jaxwsInFlowClientSideGlobalHandlers1.add(registeredHandlers.next());
        }

        registeredHandlers = jaxwsOutFlowClientSideGlobalHandlers.getServices();
        while (registeredHandlers.hasNext()) {
            jaxwsOutFlowClientSideGlobalHandlers1.add(0, registeredHandlers.next());
        }
        //jaxrs
        registeredHandlers = jaxrsOutFlowServerSideGlobalHandlers.getServices();
        while (registeredHandlers.hasNext()) {
            jaxrsOutFlowServerSideGlobalHandlers1.add(0, registeredHandlers.next());
        }

        registeredHandlers = jaxrsInFlowServerSideGlobalHandlers.getServices();
        while (registeredHandlers.hasNext()) {
            jaxrsInFlowServerSideGlobalHandlers1.add(registeredHandlers.next());
        }

        registeredHandlers = jaxrsOutFlowClientSideGlobalHandlers.getServices();
        while (registeredHandlers.hasNext()) {
            jaxrsOutFlowClientSideGlobalHandlers1.add(0, registeredHandlers.next());
        }

        registeredHandlers = jaxrsInFlowClientSideGlobalHandlers.getServices();
        while (registeredHandlers.hasNext()) {
            jaxrsInFlowClientSideGlobalHandlers1.add(registeredHandlers.next());
        }

    }
817
protected void unsetConnectionManager(ServiceReference<ConnectionManagerService> ref) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(this, tc, "unsetConnectionManager", ref);
    }
954001
def __add_handler_factory(self, svc_ref):
        # type: (ServiceReference) -> None
        
        with self.__handlers_lock:
            # Get the handler ID
            handler_id = svc_ref.get_property(handlers_const.PROP_HANDLER_ID)
            if handler_id in self._handlers:
                # Duplicated ID
                _logger.warning("Already registered handler ID: %s", handler_id)
            else:
                # Store the service
                self._handlers_refs.add(svc_ref)
                self._handlers[handler_id] = self.__context.get_service(svc_ref)

                # Try to instantiate waiting components
                succeeded = set()
                for (
                    name,
                    (context, instance),
                ) in self.__waiting_handlers.items():
                    if self.__try_instantiate(context, instance):
                        succeeded.add(name)

                # Remove instantiated component from the waiting list
                for name in succeeded:
                    del self.__waiting_handlers[name]
1064521
def clear(self):
        
        with self.__svc_lock:
            self.__svc_registry.clear()
            self.__svc_factories.clear()
            self.__svc_specs.clear()
            self.__bundle_svc.clear()
            self.__bundle_imports.clear()
            self.__factory_usage.clear()
            self.__pending_services.clear()
1291902
public void referencedElementRemoved(ModelElementInstance referenceTargetElement, Object referenceIdentifier) {
    for (ModelElementInstance referenceSourceElement : findReferenceSourceElements(referenceTargetElement)) {
      if (referenceIdentifier.equals(getReferenceIdentifier(referenceSourceElement))) {
        removeReference(referenceSourceElement, referenceTargetElement);
      }
    }
  }
999257
protected void unsetSerializationService(ServiceReference<SerializationService> ref) {
        if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "unsetSerializationService", "unsetting " + ref);
        }
        serializationServiceRef.unsetReference(ref);
    }
871358
def on_service_modify(self, svc_ref, old_properties):
        
        with self._lock:
            if self.reference is None:
                # A previously registered service now matches our filter
                self.on_service_arrival(svc_ref)
            elif svc_ref is self.reference:
                # Notify the property modification
                self._ipopo_instance.update(
                    self, self._value, svc_ref, old_properties
                )
956802
public boolean removeReference(K key, ServiceReference<V> reference) {
        if (key == null)
            return false;

        ConcurrentServiceReferenceSet<V> csrs = elementMap.get(key);
        if (csrs == null) {
            return false;
        }
        return csrs.removeReference(reference);
    }
1212436
private static Ref removeCompanionOpt(List<Ref> refs, Ref cmp) {
        Iterator<Ref> iter;
        Ref ref;

        iter = refs.iterator();
        while (iter.hasNext()) {
            ref = iter.next();
            if (ref.module.equals(cmp.module) && Util.eq(ref.variant, cmp.variant)) {
                iter.remove();
                return ref;
            }
        }
        return null;
    }
632993
def unget_used_services(self, bundle):
        
        # Pop used references
        try:
            imported_refs = list(self.__bundle_imports.pop(bundle))
        except KeyError:
            # Nothing to do
            return

        for svc_ref in imported_refs:
            # Remove usage marker
            svc_ref.unused_by(bundle)

            if svc_ref.is_prototype():
                # Get factory information and clean up the service from the
                # factory counter
                factory_counter = self.__factory_usage.pop(bundle)
                factory, svc_reg = self.__svc_factories[svc_ref]
                factory_counter.cleanup_service(factory, svc_reg)
            elif svc_ref.is_factory():
                # Factory service, release it the standard way
                self.__unget_service_from_factory(bundle, svc_ref)

        # Clean up local structures
        try:
            del self.__factory_usage[bundle]
        except KeyError:
            pass

        try:
            self.__bundle_imports.pop(bundle).clear()
        except KeyError:
            pass
530205
def drop_callback_reference(self, subscription):
        
        if subscription not in self.__subscriptions:
            raise workflows.Error(
                "Attempting to drop callback reference for unknown subscription"
            )
        if not self.__subscriptions[subscription]["unsubscribed"]:
            raise workflows.Error(
                "Attempting to drop callback reference for live subscription"
            )
        del self.__subscriptions[subscription]
1350418
protected void unsetResourceConfigFactory(ServiceReference<ResourceConfigFactory> ref) {
        if (TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, "unsetResourceConfigFactory", "unsetting " + ref);
        }
        resourceConfigFactoryRef.unsetReference(ref);
    }
816105
private boolean cleanUp(Reference<?> reference) {
    Method finalizeReferentMethod = getFinalizeReferentMethod();
    if (finalizeReferentMethod == null) {
      return false;
    }
    do {
      /*
       * This is for the benefit of phantom references. Weak and soft
       * references will have already been cleared by this point.
       */
      reference.clear();

      if (reference == frqReference) {
        /*
         * The client no longer has a reference to the
         * FinalizableReferenceQueue. We can stop.
         */
        return false;
      }

      try {
        finalizeReferentMethod.invoke(reference);
      } catch (Throwable t) {
        logger.log(Level.SEVERE, "Error cleaning up after reference.", t);
      }

      /*
       * Loop as long as we have references available so as not to waste
       * CPU looking up the Method over and over again.
       */
    } while ((reference = queue.poll()) != null);
    return true;
  }
1206547
def on_service_modify(self, svc_ref, old_properties):
        
        with self._lock:
            if self.reference is None:
                # A previously registered service now matches our filter
                return self.on_service_arrival(svc_ref)
            else:
                # Check if the ranking changed the service to inject
                best_ref = self._context.get_service_reference(
                    self.requirement.specification, self.requirement.filter
                )
                if best_ref is self.reference:
                    # Still the best service: notify the property modification
                    if svc_ref is self.reference:
                        # Call update only if necessary
                        self._ipopo_instance.update(
                            self, self._value, svc_ref, old_properties
                        )
                else:
                    # A new service is now the best: start a departure loop
                    self.on_service_departure(self.reference)

            return None