0
我有一個兔子消費者,裏面有一個線程池。我決定建立一個線程池,因爲我需要等待計算完成。但正如我注意到的那樣,TP的使用會導致怪異的效果,如凍結等。所以我想問一下,在兔子消費者中使用TP是否正確?使用春季兔子工具可以實現相同的功能嗎?java彈簧消除兔子線程池
...
ThreadPoolExecutor pool = new ThreadPoolExecutor(cores, 50, 30L, TimeUnit.SECONDS, new ArrayBlockingQueue<>(3000));
public void onMessage(){
pool.execute(()->{
//do something
handleMessage(...);//return to some output queue
});
}
或
public void onMessage(){
//do something
handleMessage(...);//return to some output queue
}
春季rabbitmq工具做的差不多。您是否在使用自動確認功能消息? –