Construct a cancellation callback for the given request ID.
326712
def _cancel_callback(self, request_id):
        """"""
        def callback(future):
            if future.cancelled():
                self.notify(CANCEL_METHOD, {'id': request_id})
                future.set_exception(JsonRpcRequestCancelled())
        return callback
933355
def cancel_requests(self):
        """"""
        self._timer.stop()
        self._job = None
        self._args = None
        self._kwargs = None
1147571
function (id) {
            if ( id ) {
                if ( this._delays[id] ) {
                    clearTimeout(this._delays[id]);
                    delete this._delays[id];
                }
            } else {
                for ( id in this._delays ) {
                    clearTimeout(this._delays[id]);
                    delete this._delays[id];
                }
            }
            return this;
        }
335334
def cancel_order(self, order_id):
        
        params = {}
        path = f'/v1/order/orders/{order_id}/submitcancel'

        def _wrapper(_func):
            @wraps(_func)
            def handle():
                _func(api_key_post(params, path))

            return handle

        return _wrapper
1006249
public JsonResponse cancelSend(String sendId) throws IOException {
        Map<String, Object> data = new HashMap<String, Object>();
        data.put(Send.PARAM_SEND_ID, sendId);
        return apiDelete(ApiAction.send, data);
    }
255439
protected static function deleteCancelOperationByIdAsyncWithHttpInfo($cancel_operation_id) 
    {
        $returnType = '';  
        $request = self::deleteCancelOperationByIdRequest($cancel_operation_id); 

        return self::getHttpClient()
            ->sendAsync($request, self::createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    return [null, $response->getStatusCode(), $response->getHeaders()];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        $response->getBody()
                    );
                }
            );
    }
325436
int cancel(int downloadId) {
		synchronized (mCurrentRequests) {
			for (DownloadRequest request : mCurrentRequests) {
				if (request.getDownloadId() == downloadId) {
					request.cancel();
					return 1;
				}
			}
		}

		return 0;
	}
925465
function timeout(req, delay) {
  setTimeout(_timeout, delay);

  function _timeout() {
    let callback = callbacks[req.id];

    if (!callback) return;

    let err = new Error("request timeout");

    err.name = "Timeout";

    callback(rpc.error(req, err).error);

    delete callbacks[req.id];
  }
}
793331
def cancel(task_id, secret_key=None, url=None):
  """"""
  if not secret_key:
    secret_key = default_key()
  if not url:
    url = default_url()

  url = '%s/cancel' % url
  values = {
    'id': task_id,
  }
  return _send_with_auth(values, secret_key, url)
763324
def _request_callback(self, request_id):
        """"""
        def callback(future):
            # Remove the future from the client requests map
            self._client_request_futures.pop(request_id, None)

            if future.cancelled():
                future.set_exception(JsonRpcRequestCancelled())

            message = {
                'jsonrpc': JSONRPC_VERSION,
                'id': request_id,
            }

            try:
                message['result'] = future.result()
            except JsonRpcException as e:
                log.exception("Failed to handle request %s", request_id)
                message['error'] = e.to_dict()
            except Exception:  # pylint: disable=broad-except
                log.exception("Failed to handle request %s", request_id)
                message['error'] = JsonRpcInternalError.of(sys.exc_info()).to_dict()

            self._consumer(message)

        return callback
1347176
def cancel(self):
        
        LOG.debug('cancelling %s', self)
        self._cancelled = True
        self.clear_callbacks()  # not strictly necessary, but may release references
        while True:
            try:
                self._waitables.get_nowait().put_nowait(self.sentinel)
            except queue.Empty:
                break
1004846
def cancel_queue(self):
        
        q = list(self.queue)
        self.queue = []
        log.debug("Canceling requests: {}".format(q))
        for req in q:
            req.response = APIServerNotRunningErrorResponse()
        for req in q:
            req.signal()
628129
def cancelOrder(self, orderId):
        
        self.ibConn.cancelOrder(orderId)

        # update order id for next time
        self.requestOrderIds()
        return orderId
229647
def cancel(id)
      have_key?
      address = @url_private
      body = {
        "method"        => "cancel_order",
        "currency_pair" => "btc_jpy",
        "order_id" => id,
      }
      h = post_ssl(address, body)
      {
        "success" => h["success"]==1,
      }
    end
981339
public void abortScheduling(String requestId, boolean force) {
      if (trace) {
         log.tracef("Request[%s] abort scheduling", requestId);
      }
      ScheduledRequest scheduledRequest = scheduledRequests.get(requestId);
      if (scheduledRequest != null && (scheduledRequest.request.isDone() || force)) {
         scheduledRequest.scheduledFuture.cancel(false);
         scheduledRequests.remove(requestId);
      }
   }
636430
public static function cancel($id, $params = null, $options = null)
    {
        $url = static::classUrl().'/'.$id;
        if (empty($params)) {
            $params = ['status' => 'canceled'];
        } else {
            $params = array_merge($params, ['status' => 'canceled']);
        }
        return static::_directRequest('put', $url, $params, $options);
    }
230074
public static ApruveResponse<SubscriptionCancelResponse> cancel(
			String subscriptionId) {
		return ApruveClient.getInstance().post(getCancelPath(subscriptionId),
				"", SubscriptionCancelResponse.class);
	}