55
66import java .util .concurrent .ArrayBlockingQueue ;
77import java .util .concurrent .Executor ;
8+ import java .util .concurrent .ExecutorService ;
89import java .util .concurrent .Executors ;
910import java .util .concurrent .SynchronousQueue ;
1011import java .util .concurrent .ThreadFactory ;
@@ -16,9 +17,9 @@ public class ExecutorUtil {
1617
1718 private static Executor sMainExecutor ;
1819 private static Handler sMainHandler ;
19- private static Executor sCalculateExecutor ;
20- private static Executor sSingleThreadExecutor ;
21- private static Executor sIOExecutor ;
20+ private static ExecutorService sCalculateExecutor ;
21+ private static ExecutorService sSingleThreadExecutor ;
22+ private static ExecutorService sIOExecutor ;
2223
2324
2425 private synchronized static Executor getMainExecutor () {
@@ -34,7 +35,7 @@ public void execute(Runnable command) {
3435 return sMainExecutor ;
3536 }
3637
37- public synchronized static Executor getIOExecutor () {
38+ public synchronized static ExecutorService getIOExecutor () {
3839 if (sIOExecutor == null ) {
3940 sIOExecutor = new ThreadPoolExecutor (0 , Integer .MAX_VALUE ,
4041 60L , TimeUnit .SECONDS ,
@@ -44,7 +45,7 @@ public synchronized static Executor getIOExecutor() {
4445 return sIOExecutor ;
4546 }
4647
47- public synchronized static Executor getCalculateExecutor () {
48+ public synchronized static ExecutorService getCalculateExecutor () {
4849 if (sCalculateExecutor == null ) {
4950 int processors = Runtime .getRuntime ().availableProcessors ();
5051 sCalculateExecutor = new ThreadPoolExecutor (processors , processors ,
@@ -56,7 +57,7 @@ public synchronized static Executor getCalculateExecutor() {
5657 return sCalculateExecutor ;
5758 }
5859
59- public synchronized static Executor getSingleThreadExecutor () {
60+ public synchronized static ExecutorService getSingleThreadExecutor () {
6061 if (sSingleThreadExecutor == null ) {
6162 sSingleThreadExecutor = Executors .newSingleThreadExecutor ();
6263 }
0 commit comments