negotiated = negotiate(preferences);
}
private NegotiableCapabilitySet negotiate(NegotiableCapabilitySet prefs) {
OperationRegistry registry = nodeSupport.getRegistry();
NegotiableCapabilitySet serverCap = null;
// Get the RemoteDescriptor for protocolName
RemoteDescriptor descriptor = (RemoteDescriptor)
registry.getDescriptor(RemoteDescriptor.class, protocolName);
if (descriptor == null) {
Object[] msgArg0 = {new String(protocolName)};
MessageFormat formatter = new MessageFormat("");
formatter.setLocale(Locale.getDefault());
formatter.applyPattern(JaiI18N.getString("RemoteJAI16"));
throw new RuntimeException(formatter.format(msgArg0));
}
int count=0;
int numRetries = getNumRetries();
int retryInterval = getRetryInterval();
Exception rieSave = null;
while (count++ < numRetries) {
try {
serverCap = descriptor.getServerCapabilities(serverName);
break;
} catch (RemoteImagingException rie) {
// Print that an Exception occured
System.err.println(JaiI18N.getString("RemoteJAI24"));
rieSave = rie;
// Sleep for retryInterval milliseconds
try {
Thread.sleep(retryInterval);
} catch (InterruptedException ie) {
// throw new RuntimeException(ie.toString());
sendExceptionToListener(JaiI18N.getString("Generic5"),
new ImagingException(JaiI18N.getString("Generic5"), ie));
}
}
}
if (serverCap == null && count > numRetries) {
sendExceptionToListener(JaiI18N.getString("RemoteJAI18"), rieSave);
// throw new RemoteImagingException(JaiI18N.getString("RemoteJAI18")
// + "\n" + rieSave.getMessage());
}
RemoteRIF rrif = (RemoteRIF)registry.getFactory("remoteRenderable",
protocolName);
return RemoteJAI.negotiate(prefs,
serverCap,
rrif.getClientCapabilities());