Skip to content
Snippets Groups Projects
Commit bd975ae3 authored by 高辛格's avatar 高辛格
Browse files

modify based rw

parent f18436f6
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,7 @@ import (
import (
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/logger"
"github.com/apache/dubbo-go/registry"
"github.com/apache/dubbo-go/remoting"
)
......@@ -119,7 +120,12 @@ func newConsulListener(registryUrl common.URL, consumerUrl common.URL) (*consulL
// this case.
func (l *consulListener) run() {
defer l.wg.Done()
defer func() { recover() }()
defer func() {
p := recover()
if p != nil {
logger.Warnf("consul listener finish with panic %v", p)
}
}()
if l.running {
err := l.plan.Run(l.registryUrl.Location)
......
......@@ -112,7 +112,7 @@ func (r *consulRegistry) Subscribe(url common.URL) (registry.Listener, error) {
role, _ := strconv.Atoi(r.URL.GetParam(constant.ROLE_KEY, ""))
if role == common.CONSUMER {
listener, err = r.subscribe(url)
listener, err = r.getListener(url)
if err != nil {
return nil, err
}
......@@ -120,7 +120,7 @@ func (r *consulRegistry) Subscribe(url common.URL) (registry.Listener, error) {
return listener, nil
}
func (r *consulRegistry) subscribe(url common.URL) (registry.Listener, error) {
func (r *consulRegistry) getListener(url common.URL) (registry.Listener, error) {
listener, err := newConsulListener(*r.URL, url)
return listener, err
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment