ThreadUtil.newExecutor等方法变更方法签名,返回值变更为ThreadPoolExecutor

This commit is contained in:
Looly 2024-06-30 17:59:16 +08:00
parent a8e959c37c
commit db5806f0e8
2 changed files with 6 additions and 5 deletions

View File

@ -14,6 +14,7 @@
* 【cache 】 Cache.put变更策略对于替换的键值对不清理队列issue#3618@Github * 【cache 】 Cache.put变更策略对于替换的键值对不清理队列issue#3618@Github
* 【core 】 添加 Windows 资源管理器风格字符串比较器pr#3620@Github * 【core 】 添加 Windows 资源管理器风格字符串比较器pr#3620@Github
* 【core 】 Week.of支持中文名称issue#3637@Github * 【core 】 Week.of支持中文名称issue#3637@Github
* 【core 】 ThreadUtil.newExecutor等方法变更方法签名返回值变更为ThreadPoolExecutorpr#1230@Gitee
### 🐞Bug修复 ### 🐞Bug修复
* 【core 】 修复AnnotationUtil可能的空指针错误 * 【core 】 修复AnnotationUtil可能的空指针错误

View File

@ -54,7 +54,7 @@ public class ThreadUtil {
* *
* @return ExecutorService * @return ExecutorService
*/ */
public static ExecutorService newExecutor() { public static ThreadPoolExecutor newExecutor() {
return ExecutorBuilder.create().useSynchronousQueue().build(); return ExecutorBuilder.create().useSynchronousQueue().build();
} }
@ -102,7 +102,7 @@ public class ThreadUtil {
* @return {@link ThreadPoolExecutor} * @return {@link ThreadPoolExecutor}
* @since 5.4.1 * @since 5.4.1
*/ */
public static ExecutorService newExecutor(int corePoolSize, int maximumPoolSize, int maximumQueueSize) { public static ThreadPoolExecutor newExecutor(int corePoolSize, int maximumPoolSize, int maximumQueueSize) {
return ExecutorBuilder.create() return ExecutorBuilder.create()
.setCorePoolSize(corePoolSize) .setCorePoolSize(corePoolSize)
.setMaxPoolSize(maximumPoolSize) .setMaxPoolSize(maximumPoolSize)
@ -147,7 +147,7 @@ public class ThreadUtil {
* @author luozongle * @author luozongle
* @since 5.8.0 * @since 5.8.0
*/ */
public static ExecutorService newFixedExecutor(int nThreads, String threadNamePrefix, boolean isBlocked) { public static ThreadPoolExecutor newFixedExecutor(int nThreads, String threadNamePrefix, boolean isBlocked) {
return newFixedExecutor(nThreads, 1024, threadNamePrefix, isBlocked); return newFixedExecutor(nThreads, 1024, threadNamePrefix, isBlocked);
} }
@ -167,7 +167,7 @@ public class ThreadUtil {
* @author luozongle * @author luozongle
* @since 5.8.0 * @since 5.8.0
*/ */
public static ExecutorService newFixedExecutor(int nThreads, int maximumQueueSize, String threadNamePrefix, boolean isBlocked) { public static ThreadPoolExecutor newFixedExecutor(int nThreads, int maximumQueueSize, String threadNamePrefix, boolean isBlocked) {
return newFixedExecutor(nThreads, maximumQueueSize, threadNamePrefix, return newFixedExecutor(nThreads, maximumQueueSize, threadNamePrefix,
(isBlocked ? RejectPolicy.BLOCK : RejectPolicy.ABORT).getValue()); (isBlocked ? RejectPolicy.BLOCK : RejectPolicy.ABORT).getValue());
} }
@ -187,7 +187,7 @@ public class ThreadUtil {
* @author luozongle * @author luozongle
* @since 5.8.0 * @since 5.8.0
*/ */
public static ExecutorService newFixedExecutor(int nThreads, public static ThreadPoolExecutor newFixedExecutor(int nThreads,
int maximumQueueSize, int maximumQueueSize,
String threadNamePrefix, String threadNamePrefix,
RejectedExecutionHandler handler) { RejectedExecutionHandler handler) {