Remove a management request handler factory from this context.

@param instance the request handler factory
@return {@code true} if the instance was removed, {@code false} otherwise
333563
public boolean removeHandlerFactory(ManagementRequestHandlerFactory instance) {
        for(;;) {
            final ManagementRequestHandlerFactory[] snapshot = updater.get(this);
            final int length = snapshot.length;
            int index = -1;
            for(int i = 0; i < length; i++) {
                if(snapshot[i] == instance) {
                    index = i;
                    break;
                }
            }
            if(index == -1) {
                return false;
            }
            final ManagementRequestHandlerFactory[] newVal = new ManagementRequestHandlerFactory[length - 1];
            System.arraycopy(snapshot, 0, newVal, 0, index);
            System.arraycopy(snapshot, index + 1, newVal, index, length - index - 1);
            if (updater.compareAndSet(this, snapshot, newVal)) {
                return true;
            }
        }
    }
857514
public void unregisterTaskManager(InstanceID instanceId, boolean terminated){
		Instance instance = registeredHostsById.get(instanceId);

		if (instance != null){
			registeredHostsById.remove(instance.getId());
			registeredHostsByResource.remove(instance.getTaskManagerID());

			if (terminated) {
				deadHosts.add(instance.getTaskManagerID());
			}

			instance.markDead();

			totalNumberOfAliveTaskSlots -= instance.getTotalNumberOfSlots();

			notifyDeadInstance(instance);

			LOG.info(
				"Unregistered task manager " + instance.getTaskManagerLocation().addressString() +
				". Number of registered task managers " + getNumberOfRegisteredTaskManagers() +
				". Number of available slots " + getTotalNumberOfSlots() + ".");
		} else {
			LOG.warn("Tried to unregister instance {} but it is not registered.", instanceId);
		}
	}
1088810
public void removeInstance( String applicationName, String instancePath ) {
		this.logger.finer( String.format( "Removing instance \"%s\" from application \"%s\"...",
				instancePath, applicationName ) );

		WebResource path = this.resource
				.path( UrlConstants.APP )
				.path( applicationName )
				.path( "instances" )
				.queryParam( "instance-path", instancePath );

		this.wsClient.createBuilder( path ).delete();
		this.logger.finer( String.format( "Instance \"%s\" has been removed from application \"%s\"",
				instancePath, applicationName ) );
	}
677528
def remove_instance(self, instance):
        
        # External instances need to be close before (process + queues)
        if instance.is_external:
            logger.info("Request external process to stop for %s", instance.name)
            instance.stop_process()
            logger.info("External process stopped.")

        instance.clear_queues(self.daemon.sync_manager)

        # Then do not listen anymore about it
        self.instances.remove(instance)
382027
def DeleteInstance(r, instance, dry_run=False):
    

    return r.request("delete", "/2/instances/%s" % instance,
                     query={"dry-run": dry_run})
529880
@Override
	public void terminateMachine( TargetHandlerParameters parameters, String machineId ) throws TargetException {

		this.logger.fine( "Terminating an in-memory agent." );
		Map<String,String> targetProperties = preventNull( parameters.getTargetProperties());

		// If we executed real recipes, undeploy everything first.
		// That's because we do not really terminate the agent's machine, we just kill the agent.
		// So, it is important to stop and undeploy properly.
		if( ! simulatePlugins( targetProperties )) {
			this.logger.fine( "Stopping instances correctly (real recipes are used)." );
			Map.Entry<String,String> ctx = parseMachineId( machineId );
			ManagedApplication ma = this.manager.applicationMngr().findManagedApplicationByName( ctx.getValue());

			// We do not want to undeploy the scoped instances, but its children.
			try {
				Instance scopedInstance = InstanceHelpers.findInstanceByPath( ma.getApplication(), ctx.getKey());
				for( Instance childrenInstance : scopedInstance.getChildren())
					this.manager.instancesMngr().changeInstanceState( ma, childrenInstance, InstanceStatus.NOT_DEPLOYED );

			} catch( IOException e ) {
				throw new TargetException( e );
			}
		}

		// Destroy the IPojo
		Factory factory = findIPojoFactory( parameters );
		deleteIPojo( factory, machineId );
	}
39620
public boolean remove(final ServerPresentationModel pm) {
        boolean deleted = super.remove(pm);
        if (!deleted) {
            throw new IllegalStateException("Model " + pm + " not found on the server!");
        }
        deleteCommand(getCurrentResponse(), pm.getId());
        return deleted;
    }
1149258
@Override
    public void destroy(T instance, CreationalContext<T> creationalContext) {
        super.destroy(instance, creationalContext);
        try {
            getProducer().preDestroy(instance);
            // WELD-1010 hack?
            if (creationalContext instanceof CreationalContextImpl) {
                ((CreationalContextImpl<T>) creationalContext).release(this, instance);
            } else {
                creationalContext.release();
            }
        } catch (Exception e) {
            BeanLogger.LOG.errorDestroying(instance, this);
            BeanLogger.LOG.catchingDebug(e);
        }
    }
557227
@Override
    public void removeInstance(long key, T instance) {
    	if (first.value == key && instance == first.element) {
    		removeMin();
    		return;
    	}
    	if (last.value == key && instance == last.element) {
    		removeMax();
    		return;
    	}

    	// if both children of root are black, set root to red
    	if ((root.left == null || !root.left.red) && (root.right == null || !root.right.red))
            root.red = true;

        root = removeInstance(root, key, instance);
        if (root != null) root.red = false;
    }
43667
protected T removeClient(Server server) {
        T client = rxClientCache.remove(server);
        if (client != null) {
            client.shutdown();
        }
        return client;
    }
186075
protected static <E extends LogRecordHandler> boolean removeHandler(Class<E> toRemove) {
    boolean rtn = false;
    Iterator<LogRecordHandler> iter = handlers.iterator();
    while(iter.hasNext()){
      if(iter.next().getClass().equals(toRemove)){
        rtn = true;
        iter.remove();
      }
    }
    return rtn;
  }
1094653
function(instance) {
      if (!instance.id) {
        throw new Error("delete(): `id` must be defined");
      }

      return api
        .one(config.entity, instance.id)
        .delete();
    }
493957
@Override
    protected void deregister(ServiceInstance instance) {

        if (instance.getInstanceId().isPresent()) {
            DeregisterInstanceRequest deregisterInstanceRequest = new DeregisterInstanceRequest().withServiceId(route53AutoRegistrationConfiguration.getAwsServiceId())
                    .withInstanceId(instance.getInstanceId().get());
            getDiscoveryClient().deregisterInstance(deregisterInstanceRequest);
        }
    }
909528
def delete_instance(self, instance, using_transactions=True, dry_run=False):
        
        self.before_delete_instance(instance, dry_run)
        if not using_transactions and dry_run:
            # we don't have transactions and we want to do a dry_run
            pass
        else:
            instance.delete()
        self.after_delete_instance(instance, dry_run)
758793
public void removeFactory(ConfigurationsProvider factory) {
		if (logger.isLoggable(Level.FINER)) {
			logger.finer("Removing factory: " + factory);
		}
		// this is to avoid adding items to the cache that were removed while
		// iterating
		synchronized (map) {
			providers.remove(factory);
			map.clear();
		}
	}
1105511
public <T> void removeListener(final Listener<T> listener, final Object instance) {
		final ListenerInstancePair<T> pair = new ListenerInstancePair<T>(listener, instance);
		this.listeners.remove(pair);
		for (final List<ListenerInstancePair<?>> entry : this.cachedListeners.values()) {
			entry.remove(pair);
		}
	}
866671
void updateInstance(T instance) {
        T oldInstance = this.instance.getAndSet(Preconditions.checkNotNull(instance, "instance"));
        if (oldInstance != null && oldInstance != instance) {
            oldInstance.close();
        }
    }