Re: Using lookupService()
Daniel Evers <[email protected]> Tue, 19 Dec 2006 22:09:32 +0100
| Newsgroups | gmane.comp.java.jxta.user |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello Mike, > PeerGroup.lookupService() is designed to return a reference to a local > instance of a running service. It's not capable of finding service > instances running on other peers. I hoped so ... > There is no built-in API for finding service instances running on other > peers. Commonly a pipe is used for service instance location. All > instances of the service will listen on a well-known pipe and peers can > locate instances by opening an output pipe and sending a contact > request. One or more instances of the service should respond to the > client and the client will then establish a connection to one of the > instances. That's exactly what I wanted to know! All examples I've seen use pipes and pipe advs, and I always wondered where service instance come into the game. But seems like I have to do my own RMI/RPC-like communication here (the JXTA-RMI project looks kinda ... dead). > Depends on what the advertisements are for. If you are adding your > service to the peer group implementation then you need to publish the > service module implementation, peer group module implementation > advertisement (and the class and spec advs) into the peer group in which > you will be instantiating your peer group. OK, I'll try that. > If you are publishing the impl advertisements into your peer group then > peers which want to instantiate your peer group can't access them. It's > a chicken and egg problem. They need the advertisement to instantiate > the peergroup but can't get it because the peergroup is not instantiated. Sounds reasonable... > I'm not sure I follow. Are these two services part of the same peer > group? Or the same service running on two different peers? You should > also make sure you are running with Log4J INFO level in order to better > see what's happing Both are running on the same peer in the same peer group (I'm doing exactly the same with both class, spec and impl advs). Seems like I have to start debugging here... (I hoped I didn't have to :( ) > Yes, your application needs to call newgroup.startApp(). What do you > mean by "join" in this case. Do you mean MembershipService.join() or > something else? Yes, so that the peer who created the group also joins it (= becomes a member of that peer group). I think I remember reading, that the peer who creates a peer group automatically joins it, but I'm not sure about that. Thanks a lot!! Daniel -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFiFUMBHvLeozhC4kRAv1lAJ0ez5sH9SzdM/F8dp8V2jrPyHlGnwCeO3gy OgJYTQZ3MOhZRU/qjHDBuJ8= =JIDD -----END PGP SIGNATURE-----