Re: serviceRemoved / serviceAdded problem
Dan Creswell <[email protected]>
| Newsgroups | gmane.comp.java.sun.jini |
|---|---|
| Message-ID | <[email protected]> |
Francisco Dário Mourão wrote:
> Hi all again,
>
>
>
> I have an application running a number x of Jini services (according to
> configuration x can be over than 10 in a specific production environment).
>
> For now all the services run in a single machine (RedHat9.0 jsdk5).
>
> I’m using Jini 2.1.
>
> I use the http server provided in classserver.jar. I also use reggie,
> norm, and fiddler services.
>
>
>
> Some services act as client of other services.
>
> Each service acting as a client, has a lookup cache to the services it
> uses more frequently:
>
> …
>
> discover = new LookupDiscoveryManager(groups, locators, null);
>
> sdm = new ServiceDiscoveryManager(discover, new
> LeaseRenewalManager(), conf);
>
>
>
> serviceTemplate = new ServiceTemplate (null,
>
> new Class[] {IServiceX.class},
>
> new Entry[] {entry});
>
>
>
> lCache = sdm.createLookupCache(serviceTemplate, null, new
> ServiceListener());
>
> …
>
> In this case a service say ClientService uses a lookupCache for the
> service x (IServiceX).
>
>
>
> The application runs with no problem for while. Sometimes it takes 5 or
> more days until the problem occurs…
>
>
>
> THE PROBLEM:
>
>
>
> At a given point in time, I don’t know why, the client services receive
> through their implementation of ServiceListener(), the notifications of
>
> serviceRemoved and then serviceAdded for all the services it is a client
> (all the services in the LookupCache).
>
>
>
> The application recovers a few minutes later because there is a
> corresponding serviceAdded few moments after a serviceRemoved
> notification is sent,
>
> but until it recovers the application doesn’t respond which is expected
> according to what’s happening.
>
> *Note*: with Jini 2.0_2 I had the same problem, but sometimes some
> client services only received a serviceRemoved notification and no
> corresponding serviceAdded. That would crash my application.
>
> Changing to Jini 2.1 corrected the problem of not receiving the
> corresponding serviceAdded… but the question remains:
>
>
>
> QUESTION:
>
> What causes this serviceRemoved / serviceAdded sequence?
>
>
>
> Could be service lease expiration?
>
> I’m trying get a cpu analyser to see if the cpu has some peeks. Could
> this be associated? I wonder if in a peek of cpu it can’t renew services
> (???)
>
>
>
> But I’m a little bit confused because
> net.jini.lookup.ServiceDiscoveryManager.registerListener() does this:
>
>
>
> leaseRenewalMgr.renewFor(eventLease,
>
> duration, //equals to LONG.MAX_VALUE
>
> new LeaseListenerImpl(proxy));
>
>
>
> and according to api doc this is the same as
>
>
>
> renewFor(eventLease, duration, Lease.FOREVER, new LeaseListenerImpl(proxy));
>
>
>
> so this means that the lease will last LONG.MAX_VALUE and will never need to be renewed (because renewal duration = Lease.FOREVER) right?
>
Wrong I think - you can ask for a lease that long but you aren't
guarenteed to get it.
In this case, I imagine you'll be granted a 5 minute lease or so which
thus must be renewed relatively frequently.
Your services using JoinManager to register with lookup services will
also be doing something similar I suspect.
Hope that helps,
Dan.
--------------------------------------------------------------------------
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]