Exemplo n.º 1
0
func Run() {
	cfg.Load()
	sheepCfgLs := cfg.LoadConfigFile()
	log4go.New(cfg.LOGPATH)
	log4go.Logger.Printf("[SYSTEM]START SYSTEM INIT.")
	maxProcs := runtime.NumCPU()
	log4go.Logger.Printf("[SYSTEM]CPU NUM: %d ", maxProcs)
	runtime.GOMAXPROCS(maxProcs)
	log4go.Logger.Printf("[SYSTEM]MAX GOROUTINE: %d ", maxProcs)
	SignalHandle.StartSignalHandle("interrupt", exit.Now, true)
	log4go.Logger.Printf("[SYSTEM]FINISH SYSTEM INIT.")
	//add sheep
	log4go.Logger.Printf("[INFO]Start Loading sheeps .")
	for _, sheepCfg := range sheepCfgLs {
		sheep.SHEEPS[sheepCfg.NAME] = sheep.New(sheepCfg)
	}
	log4go.Logger.Printf("[INFO]Load sheeps success .")
	//
	log4go.Logger.Printf("[INFO]Start Yell .")
	exit.ALL.Add(1)
	go yell.Start()
	exit.ALL.Add(1)
	go http.Start()
	exit.ALL.Wait()
}
Exemplo n.º 2
0
func TestHeartbeat(t *testing.T) {
	cfg.Load()
	log4go.New(*cfg.LOGPATH)
	shep := sheep.New("test", "192.168.33.81", 12981)
	shep.Heatbeat()
}