OSGi r4.1 中的 ServiceTracker
我使用 org.osgi.util.tracker.ServiceTracker(PrintableServiceTracker 实现 ServiceTrackerCustomizer,并在添加新服务时简单地打印)。
Filter filter = bc.createFilter("(objectClass=se.enea.print.Printable)");
tracker = new ServiceTracker(bc, filter, new PrintableServiceTracker(bc));
我在新电子书“OSGi in action”中读到了有关“伪注册”的内容,我想知道我是否必须显式进行伪注册,或者框架是否自动处理此问题?
(已安装的可打印服务是否会被 ServiceTracker 捕获。是否会为每个预安装的可打印服务调用 ServiceTracker.addingService(ServiceReference))
Im using a org.osgi.util.tracker.ServiceTracker
(PrintableServiceTracker implements ServiceTrackerCustomizer and simply prints when a new service is added).
Filter filter = bc.createFilter("(objectClass=se.enea.print.Printable)");
tracker = new ServiceTracker(bc, filter, new PrintableServiceTracker(bc));
I've read about "pseudo registration" in the new ebook "OSGi in action" and I wonder if I have to do pseudo registration explicitly or if the framwork handles this automatically?
(Will already installed Printable services be caught by the ServiceTracker. will ServiceTracker.addingService(ServiceReference) be called for each of the pre installed Printable services)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定伪注册是什么意思,但是PrintableServiceTracker中的addingService方法不仅会为新服务调用,还会为现有服务调用。
Not sure what pseudo registration means, but the method addingService in PrintableServiceTracker will be called not only for new services but also for existing services.