Stop the referenced timer.

 @param [Symbol] task The name of the task to stop.
 @return [Float, NilClass] The amount of time the task had been running or nil if no matching task was found.
180630
def stop(task = :default)
      return nil unless tasks.keys.include?(task) && active?(task)
      time_taken = Time.now.to_f - tasks[task][:current].to_f
      tasks[task][:history] << { start: tasks[task][:current], stop: Time.now.to_f, time: time_taken }
      tasks[task][:current] = nil
      if retention && tasks[task][:history].size > retention then tasks[task][:history].shift end
      time_taken
    end
177373
def stop(self, subname='total'):
        '''
        '''
        assert self._stop is None, (
            'Unable to stop, the timer is already stopped')
        self._stop = time.time()
        return self.send(subname, self._stop - self._start)
589915
def runTask(self, task, timeout=None):
        
        # Initialize the task.
        task.initialize(self)

        # Start the task.
        task.start()

        # Lets other threads run
        time.sleep(0)

        # Wait for it to finish.
        res = task.wait(timeout=timeout)

        # Now we're done
        return res
141769
def stop_running_tasks(self):
		
		for task in self.__running_registry:
			task.stop()
		self.__running_registry.clear()
1201982
async def run_task(self) -> None:
        ''''''

        self.last_run = 0.0
        self.target = self.time() + self.DELAY

        while self.running:
            try:
                now = self.time()

                if now < self.target:
                    sleep = self.target - now
                    await self.sleep(sleep)

                elif self.last_run < self.target:
                    Log.debug('executing timer task %s', self.name)
                    self.last_run = self.time()
                    await self.run()
                    total = self.time() - self.last_run
                    Log.debug('finished timer task %s in %.1f seconds',
                              self.name, total)

                else:
                    sleep = min(5.0, self.DELAY)
                    await self.sleep(sleep)

            except CancelledError:
                Log.debug('cancelled timer task %s', self.name)
                raise

            except Exception:
                Log.exception('exception in timer task %s', self.name)
1093152
def _send_tasks_and_stop_queuing(**kwargs):
    """"""
    log.info('Stopping queueing tasks and sending already queued ones.')
    _stop_queuing_tasks()
    task_queue = _get_task_queue()
    while task_queue:
        task, args, kwargs, extrakw = task_queue.pop(0)
        task.original_apply_async(args=args, kwargs=kwargs, **extrakw)
662863
def stop
      @stopping = Time.now
      update_pid
      if self.running?
        Procodile.log(@process.log_color, description, "Sending #{@process.term_signal} to #{@pid}")
        ::Process.kill(@process.term_signal, pid)
      else
        Procodile.log(@process.log_color, description, "Process already stopped")
      end
    end
659715
async def stop(self) -> None:
        """"""
        if not self._is_running:
            raise SublemonRuntimeError(
                'Attempted to stop an already-stopped `Sublemon` instance')

        await self.block()
        self._poll_task.cancel()
        self._is_running = False
        with suppress(asyncio.CancelledError):
            await self._poll_task
1203269
public static synchronized void cancel(TimerTask task) {
        if (task == null) {
            return;
        }
        task.cancel();
        usageCount.decrementAndGet();
        if (usageCount.get() == 0) {
            timer.cancel();
            timer = null;
        }
    }
1076208
def terminate(self):
        
        logger.info('Sending SIGTERM to task {0}'.format(self.name))
        if hasattr(self, 'remote_client') and self.remote_client is not None:
            self.terminate_sent = True
            self.remote_client.close()
            return
        if not self.process:
            raise DagobahError('task does not have a running process')
        self.terminate_sent = True
        self.process.terminate()
1287537
def stop_all_periodic_tasks(self, remove_tasks=True):
        
        for task in self._periodic_tasks:
            task.stop(remove_task=remove_tasks)
152750
public synchronized void stop() {
        Thread tmp=runner;
        runner=null;
        if(tmp != null) {
            tmp.interrupt();
            try {tmp.join(500);} catch(InterruptedException e) {}
        }

        // we may need to do multiple iterations as the iterator works on a copy and tasks might have been added just
        // after the iterator() call returned
        while(!queue.isEmpty())
            for(Task entry: queue) {
                entry.cancel(true);
                queue.remove(entry);
            }
        queue.clear();

        if(pool instanceof ThreadPoolExecutor && shut_down_pool) {
            ThreadPoolExecutor p=(ThreadPoolExecutor)pool;
            List<Runnable> remaining_tasks=p.shutdownNow();
            remaining_tasks.stream().filter(task -> task instanceof Future).forEach(task -> ((Future)task).cancel(true));
            p.getQueue().clear();
            try {
                p.awaitTermination(Global.THREADPOOL_SHUTDOWN_WAIT_TIME, TimeUnit.MILLISECONDS);
            }
            catch(InterruptedException e) {
            }
        }

        // clears the threads list (https://issues.jboss.org/browse/JGRP-1971)
        if(timer_thread_factory instanceof LazyThreadFactory)
            ((LazyThreadFactory)timer_thread_factory).destroy();
    }
146176
def RemoveTask(self, task):
    
    with self._lock:
      if task.identifier not in self._tasks_abandoned:
        raise KeyError('Task {0:s} was not abandoned.'.format(task.identifier))

      if not task.has_retry:
        raise KeyError(
            'Will not remove a task {0:s} without retry task.'.format(
                task.identifier))

      del self._tasks_abandoned[task.identifier]

      logger.debug('Removed task {0:s}.'.format(task.identifier))
1018162
def __cancel_timer(self):
        
        if self.__timer is not None:
            self.__timer.cancel()
            self.__unbind_call(True)

        self.__timer_args = None
        self.__timer = None
532872
async def stop(self, _task=None):
        

        self._logger.info("Stopping adapter wrapper")

        if self._task.stopped:
            return

        for task in self._task.subtasks:
            await task.stop()

        self._logger.debug("Stopping underlying adapter %s", self._adapter.__class__.__name__)
        await self._execute(self._adapter.stop_sync)
315813
public synchronized void stop() {
        if (scheduledFuture != null) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(this, tc, "Scan task cancelled");
            }
            scheduledFuture.cancel(false);
            scheduledFuture = null;
        }
    }
308936
def stop(self):
        
        if self._start_instant is None:
            raise IntervalException("Attempt to stop an interval that has not started.")
        if self._stop_instant is None:
            self._stop_instant = instant()
            self._duration = int((self._stop_instant - self._start_instant) * 1000)
            return self._duration
        return False