mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-04 06:54:45 +08:00
优化启动流程整理代码
This commit is contained in:
@@ -70,7 +70,6 @@ func (slf *Service) Init(iservice IService,getClientFun rpc.FuncRpcClient,getSer
|
||||
slf.serviceCfg = serviceCfg
|
||||
slf.gorouterNum = 1
|
||||
slf.eventHandler.Init(&slf.eventProcessor)
|
||||
slf.self.OnInit()
|
||||
}
|
||||
|
||||
func (slf *Service) SetGoRouterNum(gorouterNum int32) bool {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package service
|
||||
|
||||
import "github.com/duanhf2012/origin/log"
|
||||
|
||||
//本地所有的service
|
||||
var mapServiceName map[string]IService
|
||||
|
||||
@@ -13,24 +11,18 @@ func Init(chanCloseSig chan bool) {
|
||||
closeSig=chanCloseSig
|
||||
|
||||
for _,s := range mapServiceName {
|
||||
err := s.OnInit()
|
||||
if err!=nil {
|
||||
log.Fatal("start server fail :%+v.....",err)
|
||||
}
|
||||
s.OnInit()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func Setup(s IService) bool {
|
||||
|
||||
_,ok := mapServiceName[s.GetName()]
|
||||
if ok == true {
|
||||
return false
|
||||
}
|
||||
|
||||
//s.Init(s)
|
||||
mapServiceName[s.GetName()] = s
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user