Cancel request and worker on host.

@param targetHosts
the target hosts
10061
@SuppressWarnings("deprecation")
    private void cancelRequestAndWorkerOnHost(List<String> targetHosts) {

        List<String> validTargetHosts = new ArrayList<String>(workers.keySet());
        validTargetHosts.retainAll(targetHosts);
        logger.info("targetHosts for cancel: Total: {}"
                + " Valid in current manager with worker threads: {}",
                targetHosts.size(), validTargetHosts.size());

        for (String targetHost : validTargetHosts) {

            ActorRef worker = workers.get(targetHost);

            if (worker != null && !worker.isTerminated()) {
                worker.tell(OperationWorkerMsgType.CANCEL, getSelf());
                logger.info("Submitted CANCEL request on Host {}", targetHost);
            } else {
                logger.info(
                        "Did NOT Submitted "
                                + "CANCEL request on Host {} as worker on this host is null or already killed",
                        targetHost);
            }

        }

    }
426349
public void cancel() {
    try {
      executorService.shutdown();
      if (!executorService.awaitTermination(30, TimeUnit.MINUTES)) {
        executorService.shutdownNow(); // Cancel currently executing tasks
        if (!executorService.awaitTermination(30, TimeUnit.MINUTES)) {
          LOGGER.error("Pool did not terminate... FATAL ERROR");
          throw new RuntimeException("Parallel SAX pool did not terminate... FATAL ERROR");
        }
      }
      else {
        LOGGER.error("Parallel SAX was interrupted by a request");
      }
    }
    catch (InterruptedException ie) {
      LOGGER.error("Error while waiting interrupting.", ie);
      // (Re-)Cancel if current thread also interrupted
      executorService.shutdownNow();
      // Preserve interrupt status
      Thread.currentThread().interrupt();
    }
  }
73918
function Cancel(target, propertyKey, parameterIndex) {
    if (!target.methods) {
        target.methods = {};
    }
    var a = target.methods[propertyKey];
    if (!a) {
        a = [];
        target.methods[propertyKey] = a;
    }
    a[parameterIndex] = new WebAtoms.Rest.ServiceParameter("cancel", "");
}
1158042
public void stop() {
		hits = 0;
		misses = 0;
		unavailable = 0;
		delayedHits = 0;
		delayedMisses = 0;
		data.clear();
		mirror.clear();
		isStarted = false;
	}
357422
public final void removeServer(String hostList) {
    List<InetSocketAddress> addresses = AddrUtil.getAddresses(hostList);
    if (addresses != null && addresses.size() > 0) {
      for (InetSocketAddress address : addresses) {
        removeAddr(address);
      }

    }

  }
812349
private void stopWorkers() {
        Record sentinel = Record.SENTINEL;
        for (int inx = 0; inx < m_workerList.size(); inx++) {
            try {
                m_workerQueue.put(sentinel);
            } catch (InterruptedException e) {
                // ignore
            }
        }
        
        for (LoadWorker loadWorker : m_workerList) {
            try {
                loadWorker.join();
            } catch (InterruptedException e) {
                // ignore
            }
        }
    }
919588
public void resetOldsBlackListHosts() {
    long currentTimeNanos = System.nanoTime();
    Set<Map.Entry<HostAddress, Long>> entries = blacklist.entrySet();
    for (Map.Entry<HostAddress, Long> blEntry : entries) {
      long entryNanos = blEntry.getValue();
      long durationSeconds = TimeUnit.NANOSECONDS.toSeconds(currentTimeNanos - entryNanos);
      if (durationSeconds >= urlParser.getOptions().loadBalanceBlacklistTimeout) {
        blacklist.remove(blEntry.getKey(), entryNanos);
      }
    }
  }
260172
@Override
	public void terminateMachine( TargetHandlerParameters parameters, String machineId ) throws TargetException {
		try {
			// TODO remove next line when APIs get compatible...
			String postfix = (parameters.getTargetProperties().get(CloudautomationMixins.PROVIDER_ENDPOINT) != null ? "" : "/compute");
			OcciVMUtils.deleteVM( parameters.getTargetProperties().get(SERVER_IP_PORT) + postfix, machineId);
		} catch(TargetException ignore) {
			//ignore
		}
	}
980290
private void cancelScan() {
        if (cleanTask != null) {
            cleanTask.cancel(true);
            cleanTask = null;
        }
        client.close();
    }
279085
synchronized void removeServerProcess() {
        this.requiredState = InternalState.STOPPED;
        internalSetState(new ProcessRemoveTask(), InternalState.STOPPED, InternalState.PROCESS_REMOVING);
    }
1022041
protected void cancelWorker(
            HttpServletRequest request, IPortletExecutionWorker<?> portletExecutionWorker) {
        final IPortletWindowId portletWindowId = portletExecutionWorker.getPortletWindowId();
        final IPortletWindow portletWindow =
                this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
        this.logger.warn(
                "{} has not completed, adding to hung-worker cleanup queue: {}",
                portletExecutionWorker,
                portletWindow);

        portletExecutionWorker.cancel();

        this.portletExecutionEventFactory.publishPortletHungEvent(
                request, this, portletExecutionWorker);
        hungWorkers.offer(portletExecutionWorker);
    }
534029
public void removeTarget(T target) {
    for (MethodlessRouter<T> r : routers.values()) r.removeTarget(target);
    anyMethodRouter.removeTarget(target);
  }
365734
public void leavePage(final String target) {

        if (!m_controller.hasPageChanged() || m_controller.isEditingDisabled()) {
            m_controller.leaveUnsaved(target);
            return;
        }
        CmsAcceptDeclineCancelDialog leavingDialog = getLeaveDialog();
        leavingDialog.setHandler(new I_CmsAcceptDeclineCancelHandler() {

            /**
             * @see org.opencms.gwt.client.ui.I_CmsAcceptDeclineCancelHandler#onAccept()
             */
            public void onAccept() {

                m_controller.saveAndLeave(target);
            }

            /**
             * @see org.opencms.gwt.client.ui.I_CmsCloseDialogHandler#onClose()
             */
            public void onClose() {

                deactivateCurrentButton();
                activateSelection();
            }

            /**
             * @see org.opencms.gwt.client.ui.I_CmsAcceptDeclineCancelHandler#onDecline()
             */
            public void onDecline() {

                m_controller.leaveUnsaved(target);
            }
        });
        leavingDialog.center();
    }
775255
public void destroy()
    {
        __servers.remove(this);
        if (isStarted())
            throw new IllegalStateException("Started");
        if (_listeners!=null)
            _listeners.clear();
        _listeners=null;
        if (_virtualHostMap!=null)
            _virtualHostMap.clear();
        _virtualHostMap=null;
        _notFoundContext=null;

        super.destroy();
    }
1211461
public void sendStopNodeNotice(int targetHostId) {
        // First add a notice to local
        addStopNodeNotice(targetHostId);

        // Then contact other peers
        List<FutureTask<Void>> tasks = new ArrayList<FutureTask<Void>>();
        for (int hostId : m_foreignHosts.keySet()) {
            if (hostId == m_localHostId) {
                continue; /* skip target host */
            }
            Iterator<ForeignHost> it = m_foreignHosts.get(hostId).iterator();
            if (it.hasNext()) {
                ForeignHost fh = it.next();
                if (fh.isUp()) {
                    FutureTask<Void> task = fh.sendStopNodeNotice(targetHostId);
                    if (task != null) {
                        tasks.add(task);
                    }
                }
            }
        }
        for (FutureTask<Void> task : tasks) {
            try {
                task.get();
            } catch (InterruptedException | ExecutionException e) {
                hostLog.info("Failed to send StopNode notice to other nodes.");
            }
        }
    }
933355
def cancel_requests(self):
        """"""
        self._timer.stop()
        self._job = None
        self._args = None
        self._kwargs = None
1275971
private boolean stopRejoiningHost() {

        // The host failure notification could come before mesh determination, wait for the determination
        try {
            m_meshDeterminationLatch.await();
        } catch (InterruptedException e) {
        }

        if (m_rejoining) {
            VoltDB.crashLocalVoltDB("Another node failed before this node could finish rejoining. " +
                    "As a result, the rejoin operation has been canceled. Please try again.");
            return true;
        }
        return false;
    }