package luo.common.thread.pool; import java.util.LinkedList; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; public class SyncThreadPool { public static List<SessionCallable<String>> getSessionCallable(List<String> lists){ List<SessionCallable<String>> callables = new LinkedList<SessionCallable<String>>(); if(null!=lists&&lists.size()>0){ for (final String str : lists) { callables.add(new SessionCallable<String>() { @Override public String call() throws Exception { String temp = str+"luocheng"; System.err.println("뎠품窟넋:"+Thread.currentThread()+"--뇹잿품돨鑒앴:"+str+"--뇹잿빈돨鑒앴:"+temp); return temp; } }); } } return callables; } public static <T> List<Future<T>> syncFn(List<SessionCallable<T>> callables){ try { //눼쉔窟넋넥 ExecutorService threadPool = Executors.newFixedThreadPool(5); if(null!=callables&&callables.size()>0){ List<Future<T>> Futures = threadPool.invokeAll(callables); threadPool.shutdown(); return Futures; } } catch (InterruptedException e) { new RuntimeException("鑒앴속흙窟넋넥뇹잿呵겨",e); } return null; } }

2469095052 LV8
2022年5月27日
mylzdy LV12
2022年5月21日
ts10542 LV9
2021年10月30日
石乐志 LV1
2021年7月17日
尹恒yingying LV18
2021年4月29日
liuzzz LV5
2021年4月26日
zhenghongixin4065 LV9
2021年1月23日
w85225864 LV1
2020年8月24日
倪卟懂 LV18
2020年1月21日
lyd19931203 LV21
2019年12月5日