From c7afdb516e0cda23a03017efc427a388eed997d4 Mon Sep 17 00:00:00 2001 From: "yihua.huang" Date: Fri, 25 Apr 2014 18:44:33 +0800 Subject: [PATCH] remove thread utils #110 --- .../codecraft/webmagic/utils/ThreadUtils.java | 32 ------------------- 1 file changed, 32 deletions(-) delete mode 100644 webmagic-core/src/main/java/us/codecraft/webmagic/utils/ThreadUtils.java diff --git a/webmagic-core/src/main/java/us/codecraft/webmagic/utils/ThreadUtils.java b/webmagic-core/src/main/java/us/codecraft/webmagic/utils/ThreadUtils.java deleted file mode 100644 index 5c4d346..0000000 --- a/webmagic-core/src/main/java/us/codecraft/webmagic/utils/ThreadUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package us.codecraft.webmagic.utils; - -import com.google.common.util.concurrent.MoreExecutors; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.SynchronousQueue; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -/** - * @author code4crafer@gmail.com - * @since 0.1.0 - */ -public class ThreadUtils { - - /** - * @Deprecated - * @param threadSize - * @return - * @see us.codecraft.webmagic.selector.thread.CountableThreadPool - */ - public static ExecutorService newFixedThreadPool(int threadSize) { - if (threadSize <= 0) { - throw new IllegalArgumentException("ThreadSize must be greater than 0!"); - } - if (threadSize == 1) { - return MoreExecutors.sameThreadExecutor(); - } - return new ThreadPoolExecutor(threadSize - 1, threadSize - 1, 0L, TimeUnit.MILLISECONDS, - new SynchronousQueue(), new ThreadPoolExecutor.CallerRunsPolicy()); - } -}