Deregister factory if the specified factory is the registered factory.

@param factory the factory to deregister.
@return true if able to deregister, false otherwise.
775489
public static boolean deregister( @Nonnull final Factory factory )
  {
    if ( g_factory != factory )
    {
      return false;
    }
    else
    {
      g_factory = null;
      return true;
    }
  }
183312
def _register_bundle_factories(self, bundle):
        # type: (Bundle) -> None
        
        # Load the bundle factories
        factories = _load_bundle_factories(bundle)

        for context, factory_class in factories:
            try:
                # Register each found factory
                self._register_factory(context.name, factory_class, False)
            except ValueError as ex:
                # Already known factory
                _logger.error(
                    "Cannot register factory '%s' of bundle %d (%s): %s",
                    context.name,
                    bundle.get_bundle_id(),
                    bundle.get_symbolic_name(),
                    ex,
                )
                _logger.error(
                    "class: %s -- module: %s",
                    factory_class,
                    factory_class.__module__,
                )
            else:
                # Instantiate components
                for name, properties in context.get_instances().items():
                    self.instantiate(context.name, name, properties)
150754
public <A extends Annotation> void register(final Class<A> anno, final ConversionProcessorFactory<A> factory) {
        factoryMap.put(anno, factory);
    }
542641
public function setFactoryMode($factory = true) {
		$this->factoryMode = (bool) $factory;
		
		if ($this->factoryMode) {
			$this->reset();
		}
		
		return $this;
	}
357626
public boolean isDetectorEnabled(DetectorFactory factory) {
        String detectorName = factory.getShortName();
        Boolean enabled = detectorEnablementMap.get(detectorName);
        if (enabled == null) {
            // No explicit preference has been specified for this detector,
            // so use the default enablement specified by the
            // DetectorFactory.
            enabled = factory.isDefaultEnabled();
            detectorEnablementMap.put(detectorName, enabled);
        }
        return enabled;
    }
163737
public static boolean executeDeleteOperation(final ConnectionFactory connectionFactory, final LdapEntry entry) {
        try (val connection = createConnection(connectionFactory)) {
            val delete = new DeleteOperation(connection);
            val request = new DeleteRequest(entry.getDn());
            request.setReferralHandler(new DeleteReferralHandler());
            val res = delete.execute(request);
            return res.getResultCode() == ResultCode.SUCCESS;
        } catch (final LdapException e) {
            LOGGER.error(e.getMessage(), e);
        }
        return false;
    }
1075013
@Override
    public void deregisterControlAdapterMBean()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "deregisterControlAdapterAsMBean");
        subscriptionControlAdaptor.dereferenceControllable();
        subscriptionControlAdaptor = null;
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "deregisterControlAdapterAsMBean");
    }
915488
@Internal
	public static <OUT> TypeInfoFactory<OUT> getTypeInfoFactory(Type t) {
		final Class<?> factoryClass;
		if (registeredTypeInfoFactories.containsKey(t)) {
			factoryClass = registeredTypeInfoFactories.get(t);
		}
		else {
			if (!isClassType(t) || !typeToClass(t).isAnnotationPresent(TypeInfo.class)) {
				return null;
			}
			final TypeInfo typeInfoAnnotation = typeToClass(t).getAnnotation(TypeInfo.class);
			factoryClass = typeInfoAnnotation.value();
			// check for valid factory class
			if (!TypeInfoFactory.class.isAssignableFrom(factoryClass)) {
				throw new InvalidTypesException("TypeInfo annotation does not specify a valid TypeInfoFactory.");
			}
		}

		// instantiate
		return (TypeInfoFactory<OUT>) InstantiationUtil.instantiate(factoryClass);
	}
486137
protected DialectFactory createDialectFactory() {
        DialectFactoryImpl factory = new DialectFactoryImpl();
        factory.injectServices(new ServiceRegistryImplementor() {

            @Override
            public <R extends Service> R getService(Class<R> serviceRole) {
                if (serviceRole == DialectResolver.class) {
                    return (R) new StandardDialectResolver();
                } else if (serviceRole == StrategySelector.class) {
                    return (R) new StrategySelectorImpl(new ClassLoaderServiceImpl(Thread.currentThread().getContextClassLoader()));
                }
                return null;
            }

            @Override
            public <R extends Service> ServiceBinding<R> locateServiceBinding(Class<R> serviceRole) {
                return null;
            }

            @Override
            public void destroy() {

            }

            @Override
            public void registerChild(ServiceRegistryImplementor child) {
            }

            @Override
            public void deRegisterChild(ServiceRegistryImplementor child) {
            }

            @Override
            public ServiceRegistry getParentServiceRegistry() {
                return null;
            }
        });
        return factory;
    }
1235961
protected function factory(Factory $factory)
	{
		$factory->setLogger($this->getLogger());

		return $factory->setFactoryManager($this);
	}
579579
public <T> void define(Class<T> classDefinition, ObjectFactory<T> factory) {
        injectorConfiguration = injectorConfiguration.withFactory(classDefinition, factory);
    }
1155585
@Override
    public void deregisterFactory(String name) {
        final boolean bTrace = TraceComponent.isAnyTracingEnabled();
        if (bTrace && tc.isDebugEnabled()) {
            Tr.debug(tc, "Removing factory registration: " + name);
        }
        Class<?> factory = null;
        synchronized (this.factories) {
            factory = this.factories.remove(name);
        }

        if (null != factory) {
            final String factoryName = factory.getName();
            final List<String> chains = new ArrayList<String>();

            synchronized (this) {
                for (ChainData chainData : this.chainDataMap.values()) {
                    // Look at each channel associated with this chain.
                    for (ChannelData channel : chainData.getChannelList()) {
                        if (channel.getFactoryType().getName().equals(factoryName)) {
                            chains.add(chainData.getName());
                            break; // out of channel loop
                        }
                    }
                }
            }

            // create a post-action for cleaning up the chains whose factory has been removed.
            Runnable cleanup = new Runnable() {
                @Override
                public void run() {
                    for (String chainName : chains) {
                        cleanupChain(chainName);
                    }
                }
            };

            // Stop the chain.. the cleanup will happen once the quiesce is complete.
            ChannelUtils.stopChains(chains, -1L, cleanup);
        }
    }
222662
public AStarPathFactory<GP, ST, PT> setPathFactory(AStarPathFactory<GP, ST, PT> factory) {
		final AStarPathFactory<GP, ST, PT> old = this.pathFactory;
		this.pathFactory = factory;
		return old;
	}
761098
public void register(Object locator, IComponentFactory factory) {
		if (locator == null)
			throw new NullPointerException("Locator cannot be null");
		if (factory == null)
			throw new NullPointerException("Factory cannot be null");

		_registrations.add(new Registration(locator, factory));
	}
779010
private function register(EntityFactoryInterface $factory): self
    {
        $this->mapping = $this->mapping->put(
            get_class($factory),
            $factory
        );

        return $this;
    }
1373486
@Bind(aggregate = true)
    public void bindFactory(Factory factory) {

        // Only support primitive component
        if (!(factory instanceof ComponentFactory)) {
            return;
        }

        String cn = factory.getClassName();
        if (cn == null) {
            return;
        }

        // Has the factory the annotation
        try {
            Class clazz = ((ComponentFactory) factory).loadClass(cn);
            InstantiatedBy annotation = (InstantiatedBy) clazz.getAnnotation(InstantiatedBy.class);

            if (annotation != null) {
                // Match !
                LOGGER.info("Factory annotated with `@InstantiatedBy` found : {}, configuration : {}",
                        factory.getName(),
                        annotation.value());

                addInstanceDeclaration(factory, annotation.value());
            }
        } catch (ClassNotFoundException e) {
            LOGGER.error("Cannot load the component class {}", cn, e);
        }
    }
1291080
private static boolean areDuplicateMethodDescriptors(
      FactoryMethodDescriptor factory,
      ImplementationMethodDescriptor implementation) {

    if (!factory.name().equals(implementation.name())) {
      return false;
    }

    // Descriptors are identical if they have the same passed types in the same order.
    return MoreTypes.equivalence().pairwise().equivalent(
        Iterables.transform(factory.passedParameters(), Parameter.TYPE),
        Iterables.transform(implementation.passedParameters(), Parameter.TYPE));
  }