自定义 JXTA PeerGroup 入门
在过去一年左右的时间里,我一直在使用 JXTA 2.3 来开发我正在开发的点对点计算平台。 我正在迁移到JXTA 2.5,在此过程中我试图清理我对JXTA的大量使用。 在大多数情况下,我以让它发挥作用的态度来接触JXTA。 我用它来快速开始创建和管理我的点对点覆盖网络并提供基本的通信服务。 我想以更JXTA的方式使用它,因为无论如何我都会进行更改以迁移到2.5。
我的第一步是基本创建一个自定义 PeerGroup
。 我看到一些使用 Java 的 META-INF.services
基础设施的新机制。 我是否应该在 net.jxta.platform.Module
中列出一个相关的 PeerGroup
实现对象以及 GUID ? 据我了解,如果我这样做,当遇到并加入或创建一个规范 ID 与 GUID 匹配的组时,它应该自动使用匹配的对象。 我应该能够手动将 PeerGroup
对象绑定到该组,但使用 META-INF
的这种新方法似乎更容易管理。
有没有人有任何使用此基础设施进行 PeerGroup
实现的指示或示例? 此外,有关 Java 中 META-INF.services
机制的一些常规信息也会有所帮助。
I have been working with JXTA 2.3 for the last year or so for a peer-to-peer computing platform I am developing. I am migrating to JXTA 2.5 and in the process I am trying to clean up a lot of my use of JXTA. For the most part, I approached JXTA with a just make it work attitude. I used it to jumpstart creating and managing my peer-to-peer overlay network and providing basic communication services. I would like to use it in a more JXTA way since I am making changes to move to 2.5 anyway.
My first step would be a basic creation of a custom PeerGroup
. I see some new new mechanisms that are using the META-INF.services
infrastructure of Java. Should I be listing a related PeerGroup
implementing object here with a GUID in net.jxta.platform.Module
? As I understand it, if I do this, when a group with a spec ID matching the GUID is encountered and joined or created it should automatically use the matching object. I should be able to just manually tie a PeerGroup
object to the group but this new method using META-INF
seems to be a lot easier to manage.
Does anyone have any pointers or examples of using this infrastructure for PeerGroup
implementation? Also, some general information on the META-INF.services
mechanism in Java would be helpful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
META-INF.services
内容通过 API 中的类名来识别:ServiceLoader。 通过 Google 搜索 ServiceLoader 可以得到一些信息。我不太熟悉它,但有时这一切都与了解正确的搜索关键字有关。
The
META-INF.services
stuff is known by its class name in the API: ServiceLoader. A Google search for ServiceLoader yields some information.I am not really familiar with it, but sometimes it's all about knowing the right search keywords.