示例#1
0
文件: master.go 项目: banduk/apm
func (master *Master) updateStatus(proc *process.Proc) {
	if proc.IsAlive() {
		proc.Status.SetStatus("running")
	} else {
		proc.Pid = -1
		proc.Status.SetStatus("stopped")
	}
}
示例#2
0
文件: master.go 项目: banduk/apm
// NOT thread safe method. Lock should be acquire before calling it.
func (master *Master) stop(proc *process.Proc) error {
	if proc.IsAlive() {
		waitStop := master.Watcher.StopWatcher(proc.Name)
		err := proc.GracefullyStop()
		if err != nil {
			return err
		}
		if waitStop != nil {
			<-waitStop
			proc.Pid = -1
			proc.Status.SetStatus("stopped")
		}
		log.Infof("Proc %s sucessfully stopped.", proc.Name)
	}
	return nil
}