Coder Social home page Coder Social logo

非单例service生命周期 about beehive HOT 5 CLOSED

alibaba avatar alibaba commented on May 2, 2024
非单例service生命周期

from beehive.

Comments (5)

778477 avatar 778477 commented on May 2, 2024

恩,是的。这个很有必要,BeeHive会把注册服务变成"单例"。延长了生命周期

from beehive.

rexqin avatar rexqin commented on May 2, 2024

这是一个设计模式的问题 如果允许注销service的话 容易导致其它模块里API调用不可用。同时注销的行为对于其它模块也是不可见的。我能想到的一种解决方法是,当发现API不可用的时候,去查询API归属的service,然后重新自动注册servcie 类似比较常见的多进程模块唤起机制。不知道有没有更好的解题思路

from beehive.

wanyakun avatar wanyakun commented on May 2, 2024

@rexqin service 在使用之前是通过- (id)createService:(Protocol *)service来获得实例的,每次都会重新生成(单例除外),普通service 实例生成后会被保存到BHContextservicesByName字典中,而不能够被释放的问题,除非再次生成实例重新保存时才能释放旧的实例。而保存起来的实例,好像并没有什么用处。
通过Protocol 生成的service,应该在超出自己的作用域之后自动释放才对吧?

from beehive.

yaochenfeng avatar yaochenfeng commented on May 2, 2024

这个现在已经不存在了吧

from beehive.

xilin avatar xilin commented on May 2, 2024

看现在的代码实现里只有singleton才会被持有了,这个issue可以关闭了吧?

from beehive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.