Lookup Service Discovery

Patrick Wright <[email protected]> Wed, 14 Nov 2007 16:54:04 +0100
Newsgroups gmane.comp.java.sun.jini
Message-ID <[email protected]>
Hi

I'm trying to understand when I need to programmatically issue a new
search for lookup services. This comes about in looking into a problem
where our clients did not find a service after it was restarted, and
we suspect the reason might be due to a restart of one of two LUS
instances at the same time.

I set up a simple test using the Jini Starter Kit classes, with one
instance of Reggie, one codebase server, and one instance of
HelloServer. My client constructs a ServiceDiscoveryManager, then
requests a lookupCache(). It retrieves the Hello client, calls
sayHello(), and then repeats with a pause of a few seconds in between.

I find I can repeatedly restart the HelloServer, and the client will
re-discover the service (there is a discard called on the LookupCache
when a RemoteException is caught). However, if I first restart Reggie,
then restart the Server, my client will not discover the new Reggie
instance, and does not discover the restarted Service. If this is the
expected behavior (and not a coding or configuration bug on my part),
then it's unclear to me under what circumstances I must re-initiate a
search for registrars, and whether I need to do that with a new SDM,
or by asking the current SDM for a new LookupCache.

Also (may be important), in this test I shut down Reggie with a
control-C, and there was no DiscoveryEvent (for discarded()) received
on the client related to the registrar. I've also observed that I
don't receive DiscoveryEvents for new instances of Reggie once the
client is running. This makes me think that the LookupCache is
entirely passive as regards registrars once it has received its
initial set--is that correct?

Our current idea is that, when the LookupCache.lookup() returns null,
that we create a Future to perform a lookup on the SDM (using
createLookupCache()), and if a future is present and until that future
is done, client threads just back off.


TIA
Patrick

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to [email protected]