Skip to content
Snippets Groups Projects
Commit 1942615b authored by wangwx's avatar wangwx
Browse files

fix comments

parent 3c621f0c
No related branches found
No related tags found
No related merge requests found
......@@ -104,6 +104,7 @@ func (l *RegistryDataListener) DataChange(eventType remoting.Event) bool {
func (l *RegistryDataListener) Close() {
l.mutex.Lock()
defer l.mutex.Unlock()
l.closed = true
for _, listener := range l.subscribed {
listener.(*RegistryConfigurationListener).Close()
}
......
......@@ -127,15 +127,15 @@ func (r *zkRegistry) InitListeners() {
oldDataListener := r.dataListener
oldDataListener.mutex.Lock()
defer oldDataListener.mutex.Unlock()
recoverd := r.dataListener.subscribed
if recoverd != nil && len(recoverd) > 0 {
r.dataListener.closed = true
recovered := r.dataListener.subscribed
if recovered != nil && len(recovered) > 0 {
// recover all subscribed url
for _, oldListener := range recoverd {
for _, oldListener := range recovered {
var (
regConfigListener *RegistryConfigurationListener
ok bool
)
if regConfigListener, ok = oldListener.(*RegistryConfigurationListener); ok {
regConfigListener.Close()
}
......@@ -292,10 +292,10 @@ func (r *zkRegistry) getCloseListener(conf *common.URL) (*RegistryConfigurationL
r.dataListener.mutex.Lock()
configurationListener := r.dataListener.subscribed[conf.ServiceKey()]
if configurationListener != nil {
zkListener, _ := configurationListener.(*RegistryConfigurationListener)
if zkListener != nil {
if zkListener.isClosed {
r.dataListener.mutex.Unlock()
return nil, perrors.New("configListener already been closed")
}
}
......
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