Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command zookeeper registry #49

Merged
merged 8 commits into from
Jun 3, 2016

Conversation

sunnights
Copy link
Collaborator

feat: 支持指令的ZooKeeper注册中心
@qdaxb @half-dead

@qdaxb
Copy link
Collaborator

qdaxb commented May 12, 2016

motan-registry-command-zookeeper的功能可以直接合并到motan-registry-zookeeper里吧,没有必要再新建一个工程。

@sunnights
Copy link
Collaborator Author

这个之前跟 @rayzhang0603 交流过,他觉得两个独立开比较好,不需要指令支持的就不包含指令相关的代码,内部的configserver也是这么用的...

@qdaxb
Copy link
Collaborator

qdaxb commented May 12, 2016

我理解这个没有新的依赖,应用场景也类似,指令支持应该也是基本特性之一,没必要分开。

@sunnights sunnights force-pushed the command-zookeeper-registry branch from f5de4e3 to 34e2263 Compare May 23, 2016 08:15
@sunnights
Copy link
Collaborator Author

@qdaxb 功能已完成,请求merge

@sunnights sunnights force-pushed the command-zookeeper-registry branch from 6fec8b1 to 6e57383 Compare May 30, 2016 11:13
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class CommandZookeeperRegistry extends CommandFailbackRegistry {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个类应该是在zookeeper registry的基础上增加了功能,为什么还要把zookeeper registry的功能实现一遍?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另一个是直接继承的FailbackRegistry,这个继承的是CommandFailbackRegistry,重写了部分FailbackRegistry的方法,增加了servicelistener和commandlistener
两个类只是服务注册的逻辑一样,服务发现和客户端订阅的逻辑变化比较多

@sunnights sunnights force-pushed the command-zookeeper-registry branch from ebb9a2f to fab32d0 Compare May 31, 2016 09:22
@sunnights sunnights force-pushed the command-zookeeper-registry branch from fab32d0 to 3f00591 Compare May 31, 2016 09:45
try {
Map<NotifyListener, IZkChildListener> childChangeListeners = urlListeners.get(url);
Map<ServiceListener, IZkChildListener> childChangeListeners = serviceListeners.get(url);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsubscribe时没有清childChangeListeners的map,是否有场景会造成内存泄漏?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个我理解是client在订阅service的时候,对于同一个clienturl,订阅这个service时不会重复添加childChangeListeners,只要clienturl数量是可控的就OK
如果要清除的话就是加个逻辑判断childChangeListeners是否为空,若为空就置null

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我理解如果client一直在变化,而server不重启的话,有可能有溢出的问题。

@qdaxb
Copy link
Collaborator

qdaxb commented Jun 3, 2016

LGTM

@qdaxb qdaxb merged commit acd3c87 into weibocom:master Jun 3, 2016
@sunnights sunnights deleted the command-zookeeper-registry branch December 24, 2018 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants