Written by
java-style
on
on
java async 방식으로
java async 방식으로
과거에는 잘 동작했으나 지금은 느린 속도
before
EventGroup ev = new EventGroup(); for(int i=0; i
after
ExecutorService executor = Executors.newFixedThreadPool(psCateList.size()); Collection callableTasks = new LinkedList(); for(int i=0; i futures = null; psCateList = new ArrayList(); try { futures = executor.invokeAll(callableTasks); for (Future future : futures) { try { psCateList.add(future.get()); } catch (ExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } catch (InterruptedException e) { } finally { executor.shutdown(); }
from http://subinpapa.tistory.com/66 by ccl(A) rewrite - 2021-12-29 18:01:15