I have some Task execute a I/O blocking operation that can hang (fetching a file from an URL)
task = new Task<List<WSDLOperation>>() {
@Override
protected List<WSDLOperation> call() {
List<WSDLOperation> services = new ArrayList<>();
try {
services = WSDLService.createService(wsdlURL).getOperations();
} catch (Exception ex) {
LOG.log(Level.WARNING, "Can't reach {0}", wsdlURL);
}
return services;
}
};
}
The method createService can wait forever without throwing any Exception.
(I execute the task using a global (static public)ExecutorService defined in Main class).