Re: Using lookupService()
"Mark S. Petrovic" <[email protected]> Tue, 19 Dec 2006 09:28:55 -0800
| Newsgroups | gmane.comp.java.jxta.user |
|---|---|
| Message-ID | <20061219172855.GC2158@false> |
Hello, Daniel. Some simple (read naive) observations below... On Tue, Dec 19, 2006 at 06:04:21PM +0100, Daniel Evers wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hello! > > I'm trying to find a service that I advertised on another peer, using > PeerGroup.lookupService(). Since that doesn't work, I have some questions: My experience is limited to searching for service instances on the local peer, whereby I use lookupService() effectively. I have not read the platform source code in this regard, but I always assumed the result came out of an internal hashtable that gets populated when you "set" the various services via "params" on the new app peergroup. iow, the lookup does not do any sort of network discovery. And if it did, you'd sort of be looking at some sort of RMI scheme whereby you either pulled bytecodes from the network for purposes of executing them locally, or you actually do some sort of RMI on them. This is way off in the weeds, sorry. But that's what it sounds like you're thinking. I could be wrong. > 1. I like to publish the advertisements inside a new group. All examples > I found (mostly in the book by Brendon J. Wilson) use the net peer > group's discovery service to publish the advertisements, not the group > they create. Shouldn't they/I use newgroup.getDiscoveryService()? Any advertisement published with newgroup.publish/remotepublish should be discoverable via newgroup.getRemoteAdvertisements/getLocalAdvertisements. One cannot acquire advertisements published via newgroup.DiscoveryService with the discovery service of some other group. I don't think. > 2. I can't find the service implementation. I create the class adv, spec > adv and impl adv for the service and according to the examples I've > seen, only the class and spec advs are published. The implementation adv > is added to the group's parameters (using StdPeerGroupParamAdv etc.). > Since I cannot find this advertisement, shouldn't it be published along > with the others? Other readers: help. > 3. Something strange: I have 2 example services doing nothing, just > printing log statements on startApp(), init() and so on. I create and > treat both the same, but one service is always started (without using > it), i.e. I get log messages from init() and startApp(), but the other > one isn't. When are init() and startApp() called? I advise turning your debug level up and look for indications that the platform cannot find the impl class whose log messages you believe are missing. > 4. [Maybe related to 3.] Do I have to call newgroup.startApp() after > creating a new group to start the services? And must/should I join this > group, or am I joining it automatically? To the best of my knowledge and recollection, calling netpeergroup.newGroup() creates and starts the group. i.e., you should not have to explicitly call startApp(). In your log output, even at level INFO (I think), grep for and find all services in the net and app peergroup as they are configured, loaded and started: Consider this example for the PeerInfo Service. Grep for Configuring PeerInfo Service Loaded privileged module Module started Every formal service will output this to the log file, including the worldgroup (I think??), the netpeergroup, and your app group via the services you "set" on the service map for your app group. > Sorry to bother with so many questions, but I'm "punishing" google for No need to apologize. We've all passed this way. Mark -- Mark S. Petrovic Pasadena, CA http://www.petrovic.org