ExecutorService executorService = Executors.newFixedThreadPool(5); Callable<String> call = new Callable<String>() { public String call() throws Exception { return soap.createBooking(token, objBill, objOil); } }; Future<String> future = executorService.submit(call); try { info = future.get(1000 * timeOut, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } catch (TimeoutException e) { e.printStackTrace(); } executorService.shutdown();
接口实现超时熔断
最新推荐文章于 2023-01-13 15:44:12 发布