Terminate a BMR cluster and release all the virtual machine instances.

@param request The request containing the ID of the cluster to be terminated.
491832
public void terminateCluster(TerminateClusterRequest request) {
        checkNotNull(request, "request should not be null.");
        checkStringNotEmpty(request.getClusterId(), "The parameter clusterId should not be null or empty string.");

        InternalRequest internalRequest = this.createRequest(
                request, HttpMethodName.DELETE, CLUSTER, request.getClusterId());

        this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
    }
93875
public CompletableFuture<CloseSessionResponse> closeSession(CloseSessionRequest request) {
    CompletableFuture<CloseSessionResponse> future = new CompletableFuture<>();
    if (context.isCurrentContext()) {
      sendRequest(request, protocol::closeSession, future);
    } else {
      context.execute(() -> sendRequest(request, protocol::closeSession, future));
    }
    return future;
  }
143420
public static void removeToken(final HttpServletRequest request, final String key) {
		request.getSession(true).removeAttribute(key);
	}
1027194
public static void bind(HttpServletRequest request) {
        if (request != null && threadLocal.get() != null) {
            throw new IllegalStateException("HttpServletRequestHolder.bind() called for a "
                    + "thread that already has a request associated with it. It's likely that the request "
                    + "was not correctly removed from the thread before it is put back into the thread pool.");
        }
        threadLocal.set(request);
    }
726967
<T> void finish(Request<T> request) {
        // Remove from the set of requests currently being processed.
        synchronized (mCurrentRequests) {
            mCurrentRequests.remove(request);
        }
        synchronized (mFinishedListeners) {
          for (RequestFinishedListener<T> listener : mFinishedListeners) {
            listener.onRequestFinished(request);
          }
        }

        if (request.shouldCache()) {
            synchronized (mWaitingRequests) {
                String cacheKey = request.getCacheKey();
                Queue<Request<?>> waitingRequests = mWaitingRequests.remove(cacheKey);
                if (waitingRequests != null) {
                    if (VolleyLog.DEBUG) {
                        VolleyLog.v("Releasing %d waiting requests for cacheKey=%s.",
                                waitingRequests.size(), cacheKey);
                    }
                    // Process all queued up requests. They won't be considered as in flight, but
                    // that's not a problem as the cache has been primed by 'request'.
                    mCacheQueue.addAll(waitingRequests);
                }
            }
        }
    }
585942
public void deleteTemplate(DeleteTemplateRequest request) {
        checkNotNull(request, "object request should not be null.");
        assertStringNotNullOrEmpty(request.getTemplateId(), "object templateId should not be null or empty.");

        InternalRequest internalRequest =
                this.createRequest("template", request, HttpMethodName.DELETE, request.getTemplateId());
        this.invokeHttpClient(internalRequest, SmsResponse.class);
    }
1073791
public synchronized void shutdown() {
    getLogger().debug(getName() + " received shutdown request");

    // mark this as no longer running
    active = false;

    if (rThread != null) {
      rThread.interrupt();
      rThread = null;
    }
    if (advertiseViaMulticastDNS) {
        zeroConf.unadvertise();
    }

    doShutdown();
  }
687788
def process_request(self, request, client_address):
        

        self.finish_request(request, client_address)
        self.shutdown_request(request)
298333
public void stop() {
    if (stopRequested)
      return;
    stopRequested = true;
    LOG.info("Stopping http server");
    try {
      if (httpServer != null) httpServer.stop();
    } catch (Exception e) {
      LOG.error(StringUtils.stringifyException(e));
    }

    LOG.info("Stopping namesystem");
    if(namesystem != null) namesystem.close();

    LOG.info("Stopping emptier");
    if(emptier != null) emptier.interrupt();

    LOG.info("Stopping rpc servers");
    if(server != null) server.stop();
    if (dnProtocolServer != null) dnProtocolServer.stop();

    LOG.info("Stopping metrics");
    if (myMetrics != null) {
      myMetrics.shutdown();
    }

    LOG.info("Stopping namesystem mbeans");
    if (namesystem != null) {
      namesystem.shutdown();
    }
  }
118143
def terminate(name, call=None):
    '''
    
    '''
    if call != 'action':
        raise SaltCloudSystemExit(
            'The terminate action must be called with '
            '-a or --action.'
        )

    vm_properties = [
        "name",
        "summary.runtime.powerState"
    ]

    vm_list = salt.utils.vmware.get_mors_with_properties(_get_si(), vim.VirtualMachine, vm_properties)

    for vm in vm_list:
        if vm["name"] == name:
            if vm["summary.runtime.powerState"] == "poweredOff":
                ret = 'already powered off'
                log.info('VM %s %s', name, ret)
                return ret
            try:
                log.info('Terminating VM %s', name)
                vm["object"].Terminate()
            except Exception as exc:
                log.error(
                    'Error while terminating VM %s: %s',
                    name, exc,
                    # Show the traceback if the debug logging level is enabled
                    exc_info_on_loglevel=logging.DEBUG
                )
                return 'failed to terminate'

    return 'terminated'
275736
private void destroyRequestQueue(Queue<AsyncResourceRequest<V>> requestQueue) {
        if(requestQueue != null) {
            AsyncResourceRequest<V> resourceRequest = requestQueue.poll();
            while(resourceRequest != null) {
                destroyRequest(resourceRequest);
                resourceRequest = requestQueue.poll();
            }
        }
    }
975255
void afterTerminate(HttpRequest<?> request) {
        Optional<Tracer.SpanInScope> scope = request.removeAttribute(
                TraceRequestAttributes.CURRENT_SCOPE,
                Tracer.SpanInScope.class
        );
        scope.ifPresent(Tracer.SpanInScope::close);
    }
949013
public void releaseEip(ReleaseEipRequest request) {
        checkStringNotEmpty(request.getEip(), "eip should not be empty");
        if (Strings.isNullOrEmpty(request.getClientToken())) {
            request.setClientToken(generateDefaultClientToken());
        }
        InternalRequest internalRequest = this.createRequest(request, HttpMethodName.DELETE, request.getEip());
        internalRequest.addParameter(CLIENT_TOKEN_IDENTIFY, request.getClientToken());
        invokeHttpClient(internalRequest, AbstractBceResponse.class);
    }
3811
async def terminate_vm(self, vm_id):
        '''
         
        '''
        try:
            await self.nova.servers.force_delete(vm_id)
        except JSONDecodeError as exc:
            logging.info("nova sent 'content-type: application/json' but no content appeared, whatever")
            pass
        except Exception:
            raise
954324
synchronized void stop(){
        if(status.equals("stopped"))
            return;
        long t = System.currentTimeMillis();
        run = false;

        try {
            serverSocket.close();
        } catch (IOException e) {
            throw S1SystemError.wrap(e);
        }

        executor.shutdown();
        while (!executor.isTerminated()) {
        }

        status = "stopped";
        LOG.info("Node "+nodeId+" file server stopped ("+(System.currentTimeMillis()-t)+" ms.)");
    }
167880
@Override
  public void terminate() {
    // disable ability to request for restart
    restartRequested.set(false);
    restartDisabled.set(true);

    if (nodeLifecycle.tryToMoveTo(NodeLifecycle.State.STOPPING)) {
      LOG.info("Stopping SonarQube");
    }
    stopAll();
    if (stopperThread != null) {
      stopperThread.interrupt();
    }
    if (restarterThread != null) {
      restarterThread.interrupt();
    }
    keepAlive.countDown();
  }
308015
public int delete(Request request)
    {
        DeleteResponse response = executeRequest(request,objectMapper.getTypeFactory().constructType(
                DeleteResponse.class));
        return response.getCount();
    }