// Stop implements Service.Stop. It stops any containers related to the service.
425640
func (s *Service) Stop(ctx context.Context, timeout int) error {
	timeout = s.stopTimeout(timeout)
	return s.collectContainersAndDo(ctx, func(c *container.Container) error {
		return c.Stop(ctx, timeout)
	})
}
1225832
func (q *queue) Stop() {

	q.mutex.Lock()
	defer q.mutex.Unlock()

	if q.status != queueStopped {
		close(q.kill)
		q.status = queueStopped
	}
}
1095029
func (cs *ChaincodeSupport) Stop(ccci *ccprovider.ChaincodeContainerInfo) error {
	return cs.Runtime.Stop(ccci)
}
828345
func (s *GrpcServer) Stop() {
	s.lock.Lock()
	defer s.lock.Unlock()

	if !s.running {
		return
	}

	s.server.Stop()
	s.wg.Wait()
	s.running = false
}
668571
func (s *Server) Stop() {
	toClose := []Closable{s.netListener, s.listener}

	s.peersLock.Lock()
	defer s.peersLock.Unlock()
	for _, peer := range s.Peers {
		toClose = append(toClose, peer)
	}

	for _, close := range toClose {
		if close == nil {
			continue
		}
		if err := close.Close(); err != nil {
			s.Println(err)
		}
	}
}
732056
func (driver *MesosExecutorDriver) Stop() (mesosproto.Status, error) {
	driver.lock.Lock()
	defer driver.lock.Unlock()
	return driver.stop()
}
1056378
func (r *Runner) Stop() {
	r.lock.Lock()
	defer r.lock.Unlock()
	if r.stop != nil {
		close(*r.stop)
		r.stop = nil
	}
}
227019
func (c *dockerLoggerClient) Stop() error {
	req := &proto.StopRequest{}
	_, err := c.client.Stop(context.Background(), req)
	return err
}
420606
func (s *Service) stop() {
	dc := make(chan struct{})
	go func() {
		for i := len(s.modules) - 1; i >= 0; i-- {
			n := getModuleName(s.modules[i])
			c := s.configs[n]
			if c.Stop != nil {
				BootPrintln("[service] stopping", n)
				c.Stop()
			}
		}
		dc <- struct{}{}
	}()

	select {
	case <-dc:
	case <-time.After(30 * time.Second): // todo: make this configurable
		BootPrintln("[service] stop timed out")
	}
}
287419
func (s *reliableSender) Stop() {
	s.stop.Do(func() {
		close(s.quit)
		s.wg.Wait()
	})
}
592819
func (s *Service) Pause(ctx context.Context) error {
	return s.collectContainersAndDo(ctx, func(c *container.Container) error {
		return c.Pause(ctx)
	})
}
296120
func (a *Transport) Stop() error {
	return a.once.Stop(func() error {
		a.connectorsGroup.Wait()
		return nil
	})
}
915814
func (p *Project) Stop(services ...string) error {
	// FIXME(vdemeester) handle timeout
	err := p.StopOnly(services...)
	if err != nil {
		return err
	}

	err = p.composeProject.Delete(context.Background(), options.Delete{}, services...)
	if err != nil {
		return err
	}
	<-p.deleted

	existingContainers, err := p.existContainers(project.AnyState)
	if err != nil {
		return err
	}
	// Close channels only if there are no running services
	if !existingContainers {
		p.hasOpenedChan = false
		close(p.started)
		close(p.stopped)
		close(p.deleted)
		close(p.listenChan)
	}
	return nil
}
33844
func (n *NomadAgent) Stop() error {
	if err := n.Cmd.Process.Signal(os.Interrupt); err != nil {
		return err
	}

	return n.Cmd.Wait()
}
716044
func (s Service) Stop(wait time.Duration) (bool, error) {
	// We stop by removing the job. This works for non-demand and demand jobs.
	output, err := exec.Command("/bin/launchctl", "remove", s.label).CombinedOutput()
	s.log.Debug("Output (launchctl remove): %s", string(output))
	if err != nil {
		exitStatus := exitStatus(err)
		// Exit status 3 on remove means there was no job to remove
		if exitStatus == 3 {
			s.log.Info("Nothing to stop (%s)", s.label)
			return false, nil
		}
		return false, fmt.Errorf("Error removing via launchctl: %s", err)
	}
	if wait > 0 {
		// The docs say launchd ExitTimeOut defaults to 20 seconds, but in practice
		// it seems more like 5 seconds before it resorts to a SIGKILL.
		// Because of the SIGKILL fallback we can use a large timeout here of 25
		// seconds, which we'll likely never reach unless the process is zombied.
		if waitErr := s.WaitForExit(wait); waitErr != nil {
			return false, waitErr
		}
	}
	s.log.Info("Stopped %s", s.label)
	return true, nil
}
876934
func (d *deliverServiceImpl) Stop() {
	d.lock.Lock()
	defer d.lock.Unlock()
	// Marking flag to indicate the shutdown of the delivery service
	d.stopping = true

	for _, client := range d.blockProviders {
		client.Stop()
	}
}
1362098
func (client *Client) Stop() {
	if client.ctx.Err() != nil {
		return
	}

	log.Infof("Lake ~ (%v) Stopping", client.region)
	client.cancel()
	<-client.exitSignal
	log.Infof("Lake ~ (%v) Stopped", client.region)
}