Object result = null;
long stopTime = 0;
while (!terminated) {
T service = getServiceSelectionStrategy().getService();
if(service==null) {
AssociationDescriptor aDesc = a.getAssociationDescriptor();
if(aDesc.getServiceDiscoveryTimeout()>0) {
stopTime = (stopTime==0?
System.currentTimeMillis()+
aDesc.getServiceDiscoveryTimeUnits().toMillis(aDesc.getServiceDiscoveryTimeout()): stopTime);
if(System.currentTimeMillis()<stopTime) {
if(logger.isTraceEnabled()) {
logger.trace("The association proxy for {} is not available. A service discovery timeout of " +
"[{} {}], has been configured, and the computed stop time is: {}, sleep for one " +
"second and re-evaluate",
formatAssociationService(a),
aDesc.getServiceDiscoveryTimeout(),
aDesc.getServiceDiscoveryTimeUnits().name(),
new Date(stopTime));
}
Thread.sleep(1000);
continue;
} else {
String s = formatAssociationService(a);
throw new RemoteException("No services available for associated service " +
s+", "+formatDiscoveryAttributes(a)+". "+
"A timeout of "+aDesc.getServiceDiscoveryTimeout()+" "+
aDesc.getServiceDiscoveryTimeUnits()+" expired. Check network " +
"connections and ensure that the "+s+" service is deployed");
}
} else {
String s = formatAssociationService(a);
throw new RemoteException("No services available for service association " +
s+", "+formatDiscoveryAttributes(a)+". Check network " +
"connections and ensure that the ["+s+"] service is deployed. " +
"You may also want to check the service discovery timeout property, " +
"it is set to ["+aDesc.getServiceDiscoveryTimeout()+"]. Changing this " +
"value will allow Rio to wait the specified amount of time for a service " +
"to become available.");
}
}
try {