JGroups是一个可靠的群组通讯Java工具包。 JGroups 3.x 有 4 个线程池: Regular thread pool: used for regular messages (default has a queue) OOB thread pool: used for OOB messages (no queue) Internal
thread pool: used for JGroups internal messages only. The main raison
d'etre for this pool was that internal messages such as heartbeats or
credits should never get queued up behind other messages, and get
processed immediately. Timer thread pool: all tasks in a timer need to be executed by a thread pool as they can potentially block
但是 JGroups 4.0 将只有一个线程池处理规则,这个新的线程池没有队列,否则它添加任务时不会出现RejectedExecutionException,但简单的队列,并不是我们想要的内部消息或定时器任务。 这个新的线程池也有一个不能被改变的"abort"默认拒绝策略,只能用自定义池替换线程池。 这大大降低了配置的复杂性:从4个到1个线程池,这个新的线程池只公开最小线程,最大线程,空闲时间和启用的配置选项。 4.0 配置举例如下:
thread_pool.enabled="true" thread_pool.min_threads="2" thread_pool.max_threads="8" thread_pool.keep_alive_time="5000" 文章来源:belas个人博客,作者:belas |