请求代码:
Sender.setup(Tasks.getTaskScheduler());
Request req = Request.create(url, Request.METHOD.POST);
req.setData(data);
req.getHeader().set("Content-Type", contentType);
Sender sender = Sender.create(req).setConnTimeout(connectTimeout).setTimeout(readTimeout);
Future<Response> responseFuture = sender.send(obj -> log.infof("请求结束...%s", obj.getContent()));
String result = responseFuture.get(5, TimeUnit.SECONDS).getContent();
return result;
第一次没问题,第二次就开始报错
错误如下:
java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@4ce880ad rejected from java.util.concurrent.ScheduledThreadPoolExecutor@2623dcb7[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 2]