Implement a TaskService class responsible for running the asynchronous processing:
private class TaskService { public TaskService) {
// (...)
}
public String execute() throws InterruptedException {
String url = (...); RestTemplate restTemplate = new RestTemplate();
return restTemplate.getForObject(url, <RETURNED_CLASS_NAME>.class); }
}
Implement the calling code for the above TaskService:
private void callICECAT() throws IOException {
TaskService taskService = new TaskService(); Callable<string> callable = taskService::execute;
try {
callable.call();
} catch (Exception e) {
(...)
}
}