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

方法注册是在load中好呢还是使用BeeHiveService(servicename,impl)好呢?两者有何区别 #120

Closed
MountainHill opened this issue May 28, 2018 · 15 comments

Comments

@MountainHill
Copy link

MountainHill commented May 28, 2018

服务的注册在beehive中有两种方式(不讨论plist),一种是在

+(void)load {
}

另一种是用(使用__attribute形式)

BeeHiveService(servicename,impl)

这两种有何区别呢?

@MemoryReload
Copy link

load是在执行期注册到容器中的,但是,比类的加载稍微早一点。__attribute其实是一种注解方式,是在编译阶段注册到容器中的。个人觉得,本质并无差别。可能,注解稍微效率高那么一点点吧。

@MountainHill
Copy link
Author

@MemoryReload 只是两种写法的不同而已,对吗?我一同事说load注册有问题,说现在都没有人用load注册,所以我就问下是这样吗?

@MemoryReload
Copy link

One good suggestion for you: reading the source code, if feeling curious about that. : )

@MountainHill
Copy link
Author

@MemoryReload Actually I have read the source code at all.

@MemoryReload
Copy link

So, I’m confused why you’re doing this.

@MountainHill
Copy link
Author

Because I'm curious.I wonder if you ask question after you have read other open source framework.Maybe you don't.

@MemoryReload
Copy link

I'm not meaning to be offensive. But I have to tell you that I think your question is a little bit meaningless since you've read the source code. The differences between two strategies are obvious. If you think the load strategy is error-prone, just test it and give your error reproduction as an issue. Sincerely sorry to bother you and happy Children's Day. : )

@rjinxx
Copy link

rjinxx commented Jun 1, 2018

Just two options, no need to tell explicitly which one is more preferable...

@MountainHill
Copy link
Author

@MemoryReload I know the difference.I have this question because my workmate came from AliBaba.And he says in ALiBaba not use load to register service.
Sincerely sorry to bother you and happy Children's Day. : )

@MemoryReload
Copy link

MemoryReload commented Jun 1, 2018

@MountainHill Well, in my opinion, his words are not reasonable. As I know, There's no problem when using load strategy to register a service. But maybe my test is not robust enough. And after all, That's all up to you to make your own decision.

@MountainHill
Copy link
Author

@MemoryReload I get it.Thank you very much.

@MountainHill
Copy link
Author

@MemoryReload Please close this issue.

@MemoryReload
Copy link

MemoryReload commented Jun 12, 2018

@MountainHill Maybe, it's your responsibility to do that. You're the issuer.

@JpacheGitHub
Copy link

应该是考虑到App的启动时间问题吧, 大量用load会拉长启动时间吧

@d553296416
Copy link

你们绝了,中文聊着聊着切英语交流,目的是什么呢

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

No branches or pull requests

5 participants