Set _discardMsgsAfterQueueDeletion to true.
760172
public void setDiscardMsgsAfterQueueDeletion() {
        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled()) {
            SibTr.entry(tc, "setDiscardMsgsAfterQueueDeletion");
            SibTr.exit(tc, "setDiscardMsgsAfterQueueDeletion");
        }

        _discardMsgsAfterQueueDeletion = true;
    }
705652
def _clear_queue(to_clear):
    """"""

    while not to_clear.empty():
        try:
            to_clear.get(False)
            to_clear.task_done()
        except queue.Empty:
            continue
500003
function flushQueueIfAvailable()
    {
        if (!isLogAvailable())
            return;

        clearInterval(WebInspector.log.interval);
        delete WebInspector.log.interval;

        flushQueue();
    }
614758
final void clear() {
        reset();
        
        _freeQueue.clear();
        _targetQueue.clear();
        _compactedQueue.clear();
        while(!_updateManager.isServiceQueueEmpty()) {
            CompactionUpdateBatch batch = _updateManager.pollBatch();
            _updateManager.recycleBatch(batch);
        }
    }
1174387
public void removeFromQueue(T t) {
        synchronized (messages) {
            for (Map.Entry<Long, Message> messageEntry : messages.entrySet()) {
                if (messageEntry.getValue().equals(t)) {
                    Message message = messages.remove(messageEntry.getKey());
                    recycle(message);
                    notifyQueueChanged();
                    return;
                }
            }
        }
    }
603229
def do_clearqueue(self, line):
        """"""
        self._split_args(line, 0, 0)
        self._command_processor.get_operation_queue().clear()
        self._print_info_if_verbose("All operations in the write queue were cleared")
484870
public function clear()
    {
        $this->data = [];

        Loop::disable($this->timer);
        $this->queue = new \SplPriorityQueue;
    }
589238
def inplace_delete_message(
        message_queue: List[SendMessageEvent],
        state_change: Union[ReceiveDelivered, ReceiveProcessed],
) -> None:
    
    for message in list(message_queue):
        message_found = (
            message.message_identifier == state_change.message_identifier and
            message.recipient == state_change.sender
        )
        if message_found:
            message_queue.remove(message)
864161
void discardUnusedTail()
    {
        // we guard this with the OpOrdering instead of synchronised due to potential dead-lock with CLSM.advanceAllocatingFrom()
        // this actually isn't strictly necessary, as currently all calls to discardUnusedTail occur within a block
        // already protected by this OpOrdering, but to prevent future potential mistakes, we duplicate the protection here
        // so that the contract between discardUnusedTail() and sync() is more explicit.
        try (OpOrder.Group group = appendOrder.start())
        {
            while (true)
            {
                int prev = allocatePosition.get();
                // we set allocatePosition past buffer.capacity() to make sure we always set discardedTailFrom
                int next = buffer.capacity() + 1;
                if (prev == next)
                    return;
                if (allocatePosition.compareAndSet(prev, next))
                {
                    discardedTailFrom = prev;
                    return;
                }
            }
        }
    }
1171371
def syscall_clearremovequeue(queue, index):
    '''
    
    '''
    def _syscall(scheduler, processor):
        qes, qees = queue[index].clear()
        events = scheduler.queue.unblockqueue(queue[index])
        for e in events:
            scheduler.eventtree.remove(e)
        qes2, qees2 = queue.removeSubQueue(index)
        for e in qes:
            processor(e)
        for e in qes2:
            processor(e)
        for e in qees:
            processor(e)
        for e in qees2:
            processor(e)
    return _syscall
278145
def OnDestroy(self, event):
        """"""
        # deregister observers
        if hasattr(self, 'cardmonitor'):
            self.cardmonitor.deleteObserver(self.cardtreecardobserver)
        if hasattr(self, 'readermonitor'):
            self.readermonitor.deleteObserver(self.readertreereaderobserver)
            self.cardmonitor.deleteObserver(self.readertreecardobserver)
        event.Skip()
757197
def queue_delete(self, queue, if_unused=False, if_empty=False):
        """"""
        return self.channel.queue_delete(queue, if_unused, if_empty)
223314
def delete_messages(self, only_processed=True):
        
        messages = self._processed_messages
        if not only_processed:
            messages += self._messages

        if messages:
            try:
                self.queue.delete_tasks(messages)
            except Exception:
                logging.exception("Error deleting messages")
                raise
246228
def cancel(self, cancel_running=True, mark_completed_as_cancelled=False):
    

    with self._lock:
      for future in self._queue:
        future.cancel(mark_completed_as_cancelled)
      if cancel_running:
        for future in self._running:
          future.cancel(mark_completed_as_cancelled)
      self._queue.clear()
1094736
public void deleteMessageFromQueue(Message sqsMessage, ProgressStatus progressStatus) {
        final Object reportObject = progressReporter.reportStart(progressStatus);
        boolean deleteMessageSuccess = false;
        try {
            sqsClient.deleteMessage(new DeleteMessageRequest(config.getSqsUrl(), sqsMessage.getReceiptHandle()));
            deleteMessageSuccess = true;
        } catch (AmazonServiceException e) {
            LibraryUtils.handleException(exceptionHandler, progressStatus, e, "Failed to delete sqs message.");
        }
        LibraryUtils.endToProcess(progressReporter, deleteMessageSuccess, progressStatus, reportObject);
    }
1351164
def _clear(self):
        """"""
        self._finished = False
        self._measurement = None
        self._message = None
        self._message_body = None
756298
private void purgeQueue(Queue queue, Session session) throws JMSException {
        purgeDestination(queue, session, queue.getQueueName());
    }