Callable<String> task = new Callable<String>() { @Override public String call() throws Exception { return HttpRequestUtil.host().doGet(requestUrl); } }; ExecutorService executorService = Executors.newSingleThreadExecutor(); Future<String> future = executorService.submit(task); String hostInfo = future.get(10,TimeUnit.SECONDS);