func (master *Master) updateStatus(proc *process.Proc) { if proc.IsAlive() { proc.Status.SetStatus("running") } else { proc.Pid = -1 proc.Status.SetStatus("stopped") } }
// 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 }