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,
"UnknownLeaseException -- failed to "
+"removed the lease from the renewal manager");
}
/* Wait long enough to allow the registration lease to expire */
logger.log(Level.FINE,
"waiting for lease expiration ...");
boolean leaseExpired = false;
for(i=0;i<N_CYCLES_WAIT_EXPIRATION;i++) {
DiscoveryServiceUtil.delayMS(2*actualDur);
/* Verify the lease has expired by trying to renew the lease */
try {
lease.renew(duration);
} catch (UnknownLeaseException e) { //expected exception
leaseExpired = true;
logger.log(Level.FINE,
"lease on the registration has expired");
break;
}
}//end loop
if(!leaseExpired) {
logger.log(Level.FINE,
"failure -- lease still exists");
throw new TestException(
" -- lease did not expire after "
+(N_CYCLES_WAIT_EXPIRATION*2*(actualDur/1000))
+ "seconds");
}//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 admin2 = DiscoveryAdminUtil.getDiscoveryAdmin
(srvcReg);
String[] memberGroups2 = admin2.getMemberGroups();
LocatorsUtil.displayLocator(
QAConfig.getConstrainedLocator(srvcReg.getLocator()),
" lookup locator",Level.FINE);
logger.log(Level.FINE,
" lookup MemberGroup(s) = "