程序中用了这个 LinkedBlockingDeque队列
// 设置异步执行器
if (this.threadPoolExecutor == null) {
this.threadPoolExecutor = new ThreadPoolExecutor(200,Integer.MAX_VALUE, 5 * 60, TimeUnit.SECONDS,new LinkedBlockingDeque());
}
然而在Future<?> future = this.threadPoolExecutor.submit(runnable);用了这个,很明显,在多线程环境下,排队多了的情况,会有概率性,出现执行的并不是当前 request的线程。也有可能是 a客户端的request,的结果返回给了b客户端,虽然概率很低很低,但是会有可能发生,建议主机把 LinkedBlockingDeque提出来。
程序中用了这个 LinkedBlockingDeque队列
// 设置异步执行器
if (this.threadPoolExecutor == null) {
this.threadPoolExecutor = new ThreadPoolExecutor(200,Integer.MAX_VALUE, 5 * 60, TimeUnit.SECONDS,new LinkedBlockingDeque());
}
然而在Future<?> future = this.threadPoolExecutor.submit(runnable);用了这个,很明显,在多线程环境下,排队多了的情况,会有概率性,出现执行的并不是当前 request的线程。也有可能是 a客户端的request,的结果返回给了b客户端,虽然概率很低很低,但是会有可能发生,建议主机把 LinkedBlockingDeque提出来。