overflow_probe_container/service/ProbeService.go

29 lines
556 B
Go
Raw Normal View History

2018-03-22 12:12:17 +00:00
package service
import (
"reflect"
2018-03-22 17:23:26 +00:00
"sync"
2018-03-22 12:12:17 +00:00
cda "git.loafle.net/commons_go/di/annotation"
cdr "git.loafle.net/commons_go/di/registry"
cr "git.loafle.net/commons_go/rpc"
)
func init() {
cdr.RegisterType(reflect.TypeOf((*ProbeService)(nil)))
}
type ProbeService struct {
cda.TypeAnnotation `annotation:"@overFlow:Service()"`
RPCServlet cr.Servlet
2018-03-22 17:23:26 +00:00
sendMtx sync.RWMutex
2018-03-22 12:12:17 +00:00
}
func (ps *ProbeService) Send(method string, params ...interface{}) error {
2018-03-22 17:23:26 +00:00
ps.sendMtx.RLock()
defer ps.sendMtx.RUnlock()
2018-03-22 12:12:17 +00:00
return ps.RPCServlet.Send(method, params...)
}