Exemple #1
0
func (s *SlaveNode) Run(monitor *SlaveMonitor) {
	nextState := SUnbooted
	for {
		s.L.Lock()
		s.state = nextState
		s.L.Unlock()
		monitor.tree.StateChanged <- true
		switch nextState {
		case SUnbooted:
			s.trace("entering state SUnbooted")
			nextState = s.doUnbootedState(monitor)
		case SBooting:
			s.trace("entering state SBooting")
			nextState = s.doBootingState()
		case SReady:
			s.trace("entering state SReady")
			nextState = s.doReadyState()
		case SCrashed:
			s.trace("entering state SCrashed")
			nextState = s.doCrashedState()
		default:
			slog.FatalErrorString("Unrecognized state: " + nextState)
		}
	}
}
Exemple #2
0
func (s *SlaveNode) Run(monitor *SlaveMonitor) {
	nextState := sWaiting
	for {
		s.L.Lock()
		s.changeState(nextState)
		s.L.Unlock()
		switch nextState {
		case sWaiting:
			nextState = s.doWaitingState()
		case sUnbooted:
			nextState = s.doUnbootedState(monitor)
		case sBooting:
			nextState = s.doBootingState()
		case sCrashed:
			nextState = s.doCrashedOrReadyState()
		case sReady:
			nextState = s.doCrashedOrReadyState()
		default:
			slog.FatalErrorString("Unrecognized state: " + nextState)
		}
	}
}