Cancels a callback, indicating that the client that wrote it is no longer interested in the
answer.

<p>Note that this does not cancel the request server-side (but might in the future if Cassandra
supports it).
437607
public void cancel(ResponseCallback responseCallback) {
    // To avoid creating an extra message, we adopt the convention that writing the callback
    // directly means cancellation
    writeCoalescer.writeAndFlush(channel, responseCallback).addListener(UncaughtExceptions::log);
  }
918069
def cancel(self):
        
        self.sender.send_BasicCancel(self.tag)
        try:
            yield from self.synchroniser.wait(spec.BasicCancelOK)
        except AMQPError:
            pass
        else:
            # No need to call ready if channel closed.
            self.reader.ready()
        self.cancelled = True
        self.cancelled_future.set_result(self)
        if hasattr(self.callback, 'on_cancel'):
            self.callback.on_cancel()
1086743
@Override
  public void stop() {
    cancellable.cancel();

    try {
      selector.close();
    } catch (Exception e) {
      logger().log("Failed to close selctor for " + name + " while stopping because: " + e.getMessage(), e);
    }
  }
1144743
def client_end(request, socket, context):
    
    # Send the unsubscribe event prior to actually unsubscribing, so
    # that the finish event can still match channels if applicable.
    for channel in socket.channels:
        events.on_unsubscribe.send(request, socket, context, channel)
    events.on_finish.send(request, socket, context)
    # Actually unsubscribe to cleanup channel data.
    for channel in socket.channels[:]:
        socket.unsubscribe(channel)
    # Remove the client.
    del CLIENTS[socket.session.session_id]
1155297
private void cancelAcquire(Node node) {
        // Ignore if node doesn't exist
        if (node == null)
            return;

        node.thread = null;

        // Skip cancelled predecessors
        Node pred = node.prev;
        while (pred.waitStatus > 0)
            node.prev = pred = pred.prev;

        // predNext is the apparent node to unsplice. CASes below will
        // fail if not, in which case, we lost race vs another cancel
        // or signal, so no further action is necessary.
        Node predNext = pred.next;

        // Can use unconditional write instead of CAS here.
        // After this atomic step, other Nodes can skip past us.
        // Before, we are free of interference from other threads.
        node.waitStatus = Node.CANCELLED;

        // If we are the tail, remove ourselves.
        if (node == tail && compareAndSetTail(node, pred)) {
            pred.compareAndSetNext(predNext, null);
        } else {
            // If successor needs signal, try to set pred's next-link
            // so it will get one. Otherwise wake it up to propagate.
            int ws;
            if (pred != head &&
                ((ws = pred.waitStatus) == Node.SIGNAL ||
                 (ws <= 0 && pred.compareAndSetWaitStatus(ws, Node.SIGNAL))) &&
                pred.thread != null) {
                Node next = node.next;
                if (next != null && next.waitStatus <= 0)
                    pred.compareAndSetNext(predNext, next);
            } else {
                unparkSuccessor(node);
            }

            node.next = node; // help GC
        }
    }
952122
public function stop()
    {
        if (!empty($this->channel)) {
            echo 'Stopping consumer by removing callbacks.' . PHP_EOL;
            $this->channel->callbacks = null;
            return true;
        } else {
            return false;
        }
    }
1090499
public void stop(final GeometryArrayCallback callback) {
		if (callback == null) {
			delegate.stop(null);
		} else {
			delegate.stop(new GeometryArrayFunction() {

				public void execute(Geometry[] geometries) {
					callback.execute(new GeometryArrayHolder(geometries));
				}
			});
		}
	}
348542
def _close_callback(self):
        
        while True:
            try:
                callback = self.__callback_queue.popleft()
                callback(ConnectionError("closed connection"))
            except IndexError:
                break
        if self.subscribed:
            # pubsub clients
            self._reply_list.append(ConnectionError("closed connection"))
            self._condition.notify_all()
1092863
private void cancelPendingSlotRequest(PendingSlotRequest pendingSlotRequest) {
		CompletableFuture<Acknowledge> request = pendingSlotRequest.getRequestFuture();

		returnPendingTaskManagerSlotIfAssigned(pendingSlotRequest);

		if (null != request) {
			request.cancel(false);
		}
	}
782675
def remove_callback(self, callback) -> None:
        """"""
        if callback in self._callbacks:
            self._callbacks.remove(callback)
353912
function(message) {
      if (message.namespace === data.namespace &&
          message.data.requestId === data.data.requestId) {
        if (timer) {
          clearTimeout(timer);
        }
        self.removeListener('message', answer);
        self.removeListener('disconnect', cancel);
        cb(null, message);
      }
    }
1293434
public static function cancel( ScopedCallback &$sc = null ) {
		if ( $sc ) {
			$sc->callback = null;
		}
		$sc = null;
	}
529374
def cancel(self, function):
        """"""
        if function in self._callback.keys():
            callback_id = self._callback[function][0]
            self.tk.after_cancel(callback_id)
            self._callback.pop(function)
        else:
            utils.error_format("Could not cancel function - it doesnt exist, it may have already run")
1236693
public void requestCancellation() {
        Collection<CompletableFuture<?>> toInvoke;
        synchronized (this.futures) {
            this.cancellationRequested = true;
            toInvoke = new ArrayList<>(this.futures);
        }

        toInvoke.forEach(f -> f.cancel(true));
        synchronized (this.futures) {
            this.futures.clear();
        }
    }
189996
public void cancel(long id) {

		// Lookup the background call for the given id.
		Caller cancel = backgroundCalls.get(id);
		if(cancel == null) {
			return;
		}

		// Cancel the thread
		cancel.cancel();

		try {
			// Wait for the thread
			cancel.join();
		} catch (InterruptedException ex) {
			// Ignore this
		}

	}
29186
private final void cancelCancellable() {
        if (timeoutMessageCancellable != null
                && !timeoutMessageCancellable.isCancelled()) {
            timeoutMessageCancellable.cancel();
        }
        if (pollMessageCancellable != null
                && !pollMessageCancellable.isCancelled()) {
            pollMessageCancellable.cancel();
        }
    }
224599
def reject(self):
        
        self._result = 0
        if not self.signalsBlocked():
            self.rejected.emit()
        
        if self.autoCloseOnReject():
            self.close()