overflow_discovery/server/server_handlers.go
crusader 8239f564f7 ing
2017-12-14 17:55:57 +09:00

45 lines
958 B
Go

package server
import (
"git.loafle.net/commons_go/server"
"git.loafle.net/overflow/overflow_discovery/discovery"
oopcs "git.loafle.net/overflow/overflow_probe_container/server"
)
func newServerHandler(pidPath string, socketHandler SocketHandler) ServerHandler {
sh := &ServerHandlers{}
sh.ServerHandler = oopcs.NewServerHandler(pidPath, "Discovery Containter", socketHandler)
return sh
}
type ServerHandlers struct {
oopcs.ServerHandler
}
func (sh *ServerHandlers) Init(serverCTX server.ServerContext) error {
if err := sh.ServerHandler.Init(serverCTX); nil != err {
return err
}
return nil
}
func (sh *ServerHandlers) OnStart(serverCTX server.ServerContext) {
sh.ServerHandler.OnStart(serverCTX)
discovery.DiscoveryInit()
}
func (sh *ServerHandlers) OnStop(serverCTX server.ServerContext) {
discovery.DiscoveryDestroy()
sh.ServerHandler.OnStop(serverCTX)
}
func (sh *ServerHandlers) Validate() {
sh.ServerHandler.Validate()
}