How to use RestTemplate efficiently in Multithreaded environment?
问题 I am working on a project in which I need to make a HTTP URL call to my server which is running Restful Service which returns back the response as a JSON String. Below is my main code which is using the future and callables - public class TimeoutThreadExample { private ExecutorService executor = Executors.newFixedThreadPool(10); public String getData() { Future<String> future = executor.submit(new Task()); String response = null; try { response = future.get(100, TimeUnit.MILLISECONDS); }