Exemplo n.º 1
0
func (master *Master) updateStatus(proc process.ProcContainer) {
	if proc.IsAlive() {
		proc.SetStatus("running")
	} else {
		proc.NotifyStopped()
		proc.SetStatus("stopped")
	}
}
Exemplo n.º 2
0
// NOT thread safe method. Lock should be acquire before calling it.
func (master *Master) stop(proc process.ProcContainer) error {
	if proc.IsAlive() {
		waitStop := master.Watcher.StopWatcher(proc.Identifier())
		err := proc.GracefullyStop()
		if err != nil {
			return err
		}
		if waitStop != nil {
			<-waitStop
			proc.NotifyStopped()
			proc.SetStatus("stopped")
		}
		log.Infof("Proc %s successfully stopped.", proc.Identifier())
	}
	return nil
}