DiscoveryService disco = netpg.getDiscoveryService();
disco.getRemoteAdvertisements(null,
DiscoveryService.ADV,
"Name", "JXTASPEC:RMIService:HelloService", 5, null);
try {
Thread.sleep(timeout);
} catch (InterruptedException ie) {}
System.out.println("Looking for RMI Service peers...");
while (count-- > 0) {
try {
peers = disco.getLocalAdvertisements(DiscoveryService.ADV,
"Name", "JXTASPEC:RMIService:HelloService");
if (peers != null && peers.hasMoreElements())
break;
disco.getRemoteAdvertisements(null,
DiscoveryService.ADV,
"Name", "JXTASPEC:RMIService:HelloService", 5,
null);
try {
Thread.sleep(timeout);
} catch (InterruptedException ie) {}
} catch (Exception e) {
// Try again
}
}
if (peers == null || !peers.hasMoreElements())
return false;
return true;