restarts all Watchdogs
430120
public synchronized void restart() {

        restartManagementWatchdogs();
        // shutdown all watchdogs
        Set copy = new HashSet(registeredWachdogs.values());
        Iterator iter = copy.iterator();
        while (iter.hasNext()) {
            Watchdog wd = (Watchdog) iter.next();
            if (wd.isUseless()) {
                wd.kill();
                this.deregisterWatchdog(wd);
                if (log.isInfoEnabled()) {
                    log.info("WatchdogRegistry.restart() : Watchdog " + wd.getId() + " closed");
                }
            } else if (!wd.isAlive() && !wd.isKilled()) {
                wd.restart();
                if (log.isInfoEnabled()) {
                    log.info("WatchdogRegistry.restart() : Watchdog " + wd.getId() + " restarted");
                }
            }
        }

    }
608938
def watch_and_run(monitor, times, recursively, directory, *flags)
      result = OpenStruct.new(directory: directory, changes: [])
      i = 0
      result.changes[i] = OpenStruct.new(called: false)
      can_return = false
      callback = Proc.new do |change|
        next if can_return

        result.changes[i].called = true;
        result.changes[i].change = change

        i += 1

        if i < times
          result.changes[i] = OpenStruct.new(called: false)
        else
          can_return = true
        end
      end

      if recursively
        monitor.watch_recursively(directory, *flags, &callback)
      else
        monitor.watch(directory, *flags, &callback)
      end

      thread = Thread.new(monitor) { |m| m.run! }
      sleep(0.2) # give time for the monitor to bootup

      yield # So much boilerplate code to get here :S

      sleep(0.2) # allow the monitor to run the callbacks

      # Nothing can change after the callback if there is only one of them,
      # so never wait for one callback
      if times > 1
        until can_return
          sleep(0.1)
        end
      end

      return result
    ensure
      monitor.stop
      thread.join if thread
    end
85476
function _startWatchdog() {
    if (!watcher) {
      var watcherOptions = { persistent: !!options.persistent };
      watcher = fs.watch(folder, watcherOptions, function (event, filename) {
        if (event === 'change' && filename.charAt(0) != '.') {
          // On every change load the changed file. This will trigger notifications for interested
          // subscribers.
          _loadFile(filename);
        }
      });
    }
  }
932975
public synchronized void stop() {
        // stopps all watchdogs
        Iterator iter = registeredWachdogs.values().iterator();
        while (iter.hasNext()) {
            Watchdog wd = (Watchdog) iter.next();
            wd.stop();
            if (log.isInfoEnabled()) {
                log.info("WatchdogRegistry.stop() : Watchdog " + wd.getId() + " is stopped");
            }
        }


    }
854778
def restart(self):
        
        BackgroundProcess.objects.filter(pk=self.process_id).update(
            last_update=now(),
            message='restarting..')
        timeout = time() + 60  # wait max 60 seconds
        self.kill_processes(signal.SIGTERM)
        while self.PROCESSES and time() < timeout:
            sleep(0.1)
        self.kill_processes(signal.SIGKILL)
        self.manage_processes()
        logger.debug('BD %d: restarted'%self.process_id)
1037096
def reopen_after_fork!
#       logger.debug { "#{self.class}##{__method__}" }
      @mutex = Monitor.new
      @setup_watcher_mutex = Monitor.new

      # XXX: need to test this w/ actor-style callbacks
      
      @state = :running
      @callbacks.values.flatten.each { |cb| cb.reopen_after_fork! if cb.respond_to?(:reopen_after_fork!) }
      @outstanding_watches.values.each { |set| set.clear }
      nil
    end
90162
def restart
      conns = storage.get_all(teams_key)
      storage.pipeline do
        conns.each { |k, _| storage.set(teams_key, k, 'restart') }
      end
    end
1279485
function restartAppFromWatching(err) {
		updateWatcherCount()
		if (err) self.emit('error', err)
		if (dashboard.state !== 'stop') {
			log('Restarting ' + conf.name + ' due to file watch trigger')
			appLink.afterThat('restart')
		} else log('Watcher restart ignored in stop state')
	}
32369
public void restart(Long id) {

        Watchdog wd = (Watchdog) this.registeredWachdogs.get(id);
        if (wd == null) {
            throw new IllegalStateException("Watchdog " + id + " ist not registered");
        }
        wd.restart();
    }
361645
def restart(self, *args, **kw):
        """"""
        self.stop()
        self.start(*args, **kw)
489816
private void restart(long globalModVersionOfFailover) {
		try {
			if (transitionState(JobStatus.CREATED, JobStatus.RUNNING)) {
				// if we have checkpointed state, reload it into the executions
				if (executionGraph.getCheckpointCoordinator() != null) {
					// we restart the checkpoint scheduler for
					// i) enable new checkpoint could be triggered without waiting for last checkpoint expired.
					// ii) ensure the EXACTLY_ONCE semantics if needed.
					executionGraph.getCheckpointCoordinator().abortPendingCheckpoints(
						new CheckpointException(CheckpointFailureReason.JOB_FAILOVER_REGION));

					executionGraph.getCheckpointCoordinator().restoreLatestCheckpointedState(
						tasks, false, true);
				}

				HashSet<AllocationID> previousAllocationsInRegion = new HashSet<>(connectedExecutionVertexes.size());
				for (ExecutionVertex connectedExecutionVertex : connectedExecutionVertexes) {
					AllocationID latestPriorAllocation = connectedExecutionVertex.getLatestPriorAllocation();
					if (latestPriorAllocation != null) {
						previousAllocationsInRegion.add(latestPriorAllocation);
					}
				}

				//TODO, use restart strategy to schedule them.
				//restart all connected ExecutionVertexes
				for (ExecutionVertex ev : connectedExecutionVertexes) {
					try {
						ev.scheduleForExecution(
							executionGraph.getSlotProvider(),
							executionGraph.isQueuedSchedulingAllowed(),
							LocationPreferenceConstraint.ANY,
							previousAllocationsInRegion); // some inputs not belonging to the failover region might have failed concurrently
					}
					catch (Throwable e) {
						failover(globalModVersionOfFailover);
					}
				}
			}
			else {
				LOG.info("FailoverRegion {} switched from CREATED to RUNNING fail, will fail this region again.", id);
				failover(globalModVersionOfFailover);
			}
		} catch (Exception e) {
			LOG.info("FailoverRegion {} restart failed, failover again.", id, e);
			failover(globalModVersionOfFailover);
		}
	}
1290771
async def _watchdog(self, timeout):
        """"""
        await asyncio.sleep(timeout, loop=self.loop)
        _LOGGER.debug("Watchdog triggered!")
        await self.cancel_watchdog()
        await self._watchdog_cb()
1104807
def _reload(self):
        
        self._run_hooks('reload')

        # Reset forktimes to respawn services quickly
        self._forktimes = []
        signal.signal(signal.SIGHUP, signal.SIG_IGN)
        os.killpg(0, signal.SIGHUP)
        signal.signal(signal.SIGHUP, self._signal_catcher)
166105
def restart(state, host, ctid, force=False):
    '''
    
    '''

    yield stop(state, host, ctid)
    yield start(state, host, ctid, force=force)
1275754
def restart(self):
        

        rc_new = copy.deepcopy(self)
        return K8sReplicationController.rolling_update(
            config=self.config,
            name=self.name,
            rc_new=rc_new)
1258169
def restart(self, wait=True, timeout=None, wait_polling_interval=None):
        
        self.stop(timeout=timeout)
        self.start(wait, timeout=timeout, wait_polling_interval=wait_polling_interval)
366079
def rebuild_all_apps(force=True, restart=False):
    '''
        
    '''
    cozy_apps = monitor.status(only_cozy=True)
    for app in cozy_apps.keys():
        rebuild_app(app, force=force, restart=restart)