logger.log(Level.FINE, "run()");
if(discoverySrvc == null) {
throw new TestException("could not successfully start the service "
+serviceName);
}
LeaseRenewalManager lrm =
new LeaseRenewalManager(getConfig().getConfiguration());
Lease lease = null;
long actualDur = 0;
/* Request a registration with the lookup discovery service */
logger.log(Level.FINE, "registering with the lookup discovery service");
ServiceEventListener eventListener = new ServiceEventListener();
LookupDiscoveryRegistration reg =
DiscoveryServiceUtil.getRegistration
(discoverySrvc,
eventListener,
memberGroups,
duration,
new MarshalledObject(GroupsUtil.toCommaSeparatedStr
(memberGroups)));
lease = getPreparedLease(reg);
lrm.renewUntil(lease,Lease.FOREVER,new LRMListener());
actualDur = DiscoveryServiceUtil.expirationToDuration
(lease.getExpiration(),
System.currentTimeMillis());
logger.log(Level.FINE,
"lease duration granted = "
+(actualDur/1000)+" second(s)");
long nSecsWait = ( (nSecsLookupDiscovery > (actualDur/1000)) ?
nSecsLookupDiscovery : (actualDur/1000) );
/* Give the event time to arrive */
int i = 0;
if(!eventReceived) {
for(i=1;i<nSecsWait;i++) {
DiscoveryServiceUtil.delayMS(1000);
if(eventReceived) break;
}
}//endif
if(eventReceived) {
logger.log(Level.FINE,
"first discovery event received after "
+i+" second(s)");
} else {
throw new TestException(
" -- waited "+i+" seconds, but no discovery "
+"event received for the first lookup "
+"service started");
}//endif
/* Start another lookup belonging to same group(s) as first */
logger.log(Level.FINE,
"starting a new lookup service");
synchronized(eventLock) {
eventReceived = false;
srvcReg = manager.startLookupService(); // prepared
lookupList.add( srvcReg );
}//end synchronized
// prepared by DiscoveryAdminUtil
DiscoveryAdmin admin1 = DiscoveryAdminUtil.getDiscoveryAdmin
(srvcReg);
String[] memberGroups1 = admin1.getMemberGroups();
LocatorsUtil.displayLocator(
QAConfig.getConstrainedLocator(srvcReg.getLocator()),
" lookup locator",Level.FINE);
logger.log(Level.FINE,
" lookup MemberGroup(s) = "
+GroupsUtil.toCommaSeparatedStr(memberGroups1));
/* Give the event time to arrive */
i = 0;
if(!eventReceived) {
for(i=1;i<nSecsWait;i++) {
DiscoveryServiceUtil.delayMS(1000);
if(eventReceived) break;
}
}//endif
if(eventReceived) {
logger.log(Level.FINE,
"second discovery event received after "+i+" second(s)");
} else {
throw new TestException(
" -- waited "+i+" seconds, but no discovery "
+"event received for the second lookup "
+"service started");
}//endif
/* Remove the lease from the renewal manager so it can expire */
try {
lrm.remove(lease);
logger.log(Level.FINE,
"removed the lease from the renewal "
+"manager");
} catch(UnknownLeaseException e) {
logger.log(Level.FINE,