// Restart terminates a running node and boots up a new one in its place. If the
// node isn't running, an error is returned.
761801
func (n *Node) Restart() error {
	if err := n.Stop(); err != nil {
		return err
	}
	if err := n.Start(); err != nil {
		return err
	}
	return nil
}
1232019
func (s *sentinel) Restart() error {
	logger.Infof("sentinel %q restarts", s)
	// Start backendLoop again.
	s.loop.Restart()
	// Now restart children.
	return s.ObservablesDo(func(o Observable) error {
		return o.Restart()
	})
}
655219
func (c *Server) Restart() error {
	c.Lock()
	defer c.Unlock()
	if err := c.hostsDeny(); err != nil {
		return err
	}
	if err := c.hostsAllow(); err != nil {
		return err
	}
	if err := c.writeExports(); err != nil {
		return err
	}
	if err := restart(); err != nil {
		return err
	}
	c.cleanupBindMounts()
	return nil
}
337625
func (l *loop) Restart() error {
	l.mux.Lock()
	defer l.mux.Unlock()
	if l.status != Stopped {
		return errors.New(ErrRestartNonStopped, errorMessages, l)
	}
	l.err = nil
	l.recoverings = nil
	l.status = Running
	l.stopC = make(chan struct{})
	l.doneC = make(chan struct{})
	// Restart the goroutine.
	l.logf(false, "loop %q restarts", l)
	go l.run()
	<-l.startedC
	return nil
}
1303467
func (n node) Begin(writable bool) (Node, error) {
	var err error

	n.tx, err = n.s.Bolt.Begin(writable)
	if err != nil {
		return nil, err
	}

	return &n, nil
}
1126569
func RestartProcess() error {
	path, err := selfPath()
	if err != nil {
		return err
	}
	return syscall.Exec(path, os.Args, os.Environ())
}
898843
func (c *Chain) Start() {
	c.logger.Infof("Starting Raft node")

	if err := c.configureComm(); err != nil {
		c.logger.Errorf("Failed to start chain, aborting: +%v", err)
		close(c.doneC)
		return
	}

	isJoin := c.support.Height() > 1
	isMigration := false
	if isJoin {
		isMigration = c.detectMigration()
	}
	c.Node.start(c.fresh, isJoin, isMigration)

	close(c.startC)
	close(c.errorC)

	go c.gc()
	go c.serveRequest()

	es := c.newEvictionSuspector()

	interval := DefaultLeaderlessCheckInterval
	if c.opts.LeaderCheckInterval != 0 {
		interval = c.opts.LeaderCheckInterval
	}

	c.periodicChecker = &PeriodicCheck{
		Logger:        c.logger,
		Report:        es.confirmSuspicion,
		CheckInterval: interval,
		Condition:     c.suspectEviction,
	}
	c.periodicChecker.Run()
}
1108868
func (n *Node) Stop() error {
	n.lock.Lock()
	defer n.lock.Unlock()

	// Short circuit if the node's not running
	if n.server == nil {
		return ErrNodeStopped
	}

	// Terminate the API, services and the p2p server.
	n.stopWS()
	n.stopHTTP()
	n.stopIPC()
	n.rpcAPIs = nil
	failure := &StopError{
		Services: make(map[reflect.Type]error),
	}
	for kind, service := range n.services {
		if err := service.Stop(); err != nil {
			failure.Services[kind] = err
		}
	}
	n.server.Stop()
	n.services = nil
	n.server = nil

	// Release instance directory lock.
	if n.instanceDirLock != nil {
		if err := n.instanceDirLock.Release(); err != nil {
			n.log.Error("Can't release datadir lock", "err", err)
		}
		n.instanceDirLock = nil
	}

	// unblock n.Wait
	close(n.stop)

	// Remove the keystore if it was created ephemerally.
	var keystoreErr error
	if n.ephemeralKeystore != "" {
		keystoreErr = os.RemoveAll(n.ephemeralKeystore)
	}

	if len(failure.Services) > 0 {
		return failure
	}
	if keystoreErr != nil {
		return keystoreErr
	}
	return nil
}
837892
func (n *Node) start() error {
	if err := n.stateCheck(nodeCreated); err != nil {
		return err
	}

	logDebug("[Node]", "(%v) starting", n)
	if err := n.cm.start(); err != nil {
		logErr("[Node]", err)
	}
	n.setState(nodeRunning)
	logDebug("[Node]", "(%v) started", n)

	return nil
}
393114
func (m *Memberlist) resetNodes() {
	m.nodeLock.Lock()
	defer m.nodeLock.Unlock()

	// Move dead nodes, but respect gossip to the dead interval
	deadIdx := moveDeadNodes(m.nodes, m.config.GossipToTheDeadTime)

	// Deregister the dead nodes
	for i := deadIdx; i < len(m.nodes); i++ {
		delete(m.nodeMap, m.nodes[i].Name)
		m.nodes[i] = nil
	}

	// Trim the nodes to exclude the dead nodes
	m.nodes = m.nodes[0:deadIdx]

	// Update numNodes after we've trimmed the dead nodes
	atomic.StoreUint32(&m.numNodes, uint32(deadIdx))

	// Shuffle live nodes
	shuffleNodes(m.nodes)
}
298337
func boot(net *Network, quit chan struct{}, nodeCount int) {
	_, err := connectNodesInRing(net, nodeCount)
	if err != nil {
		panic("Could not startup node network for mocker")
	}
}
888573
func (n *Node) Start(ctx context.Context) error {
	err := errNodeStarted

	n.startOnce.Do(func() {
		close(n.started)
		go n.run(ctx)
		err = nil // clear error above, only once.
	})
	return err
}
913676
func (p *Process) Restart() (err error) {
	if p.isAlive() {
		if _, err = p.StopAndWait(); err != nil {
			p.log.Warnf("Cannot stop process %s due to error, trying force stop... (err: %v)", p.GetName(), err)
			if err = p.forceStopProcess(); err != nil {
				return err
			}
		}
	}
	p.command, err = p.startProcess()
	p.log.Debugf("Process %s was restarted (PID: %d)", p.GetName(), p.GetPid())
	return err
}
933023
func (actor Actor) RestartApplication(appGUID string) (Warnings, error) {
	_, warnings, err := actor.CloudControllerClient.UpdateApplicationRestart(appGUID)

	return Warnings(warnings), err
}
1091329
func (es *EventStream) Restart() {
	es.Stop()
	es.Resume = true
	es.Start()
}
1350135
func (c *Cluster) Start() error {
	if c.isCurrentState(clusterRunning) {
		logWarnln("[Cluster]", "cluster already running.")
		return nil
	}

	if err := c.stateCheck(clusterCreated); err != nil {
		return err
	}

	logDebug("[Cluster]", "starting")

	c.Lock()
	defer c.Unlock()
	for _, node := range c.nodes {
		if err := node.start(); err != nil {
			return err
		}
	}

	c.setState(clusterRunning)
	logDebug("[Cluster]", "cluster started")

	return nil
}
1210587
func (s *Simulation) StartNode(id enode.ID) (err error) {
	return s.Net.Start(id)
}