japonensisjava學(xué)生 java多線程ExecutorService線程數(shù)量?
java多線程ExecutorService線程數(shù)量?添加了一個(gè)新的executors工廠類(lèi)來(lái)生成線程池,如以下方法-public static executors service newfixedt
java多線程ExecutorService線程數(shù)量?
添加了一個(gè)新的executors工廠類(lèi)來(lái)生成線程池,如以下方法
-public static executors service newfixedthreadpool(int nthreads)
-public static executors service newsinglethreadexecutor()這些方法的返回值是executorservice object,它表示線程池,可以執(zhí)行由可運(yùn)行對(duì)象或可調(diào)用對(duì)象表示的線程。它提供以下方法:
-未來(lái)<?> submit(可運(yùn)行任務(wù))
-<T> future<T> submit(可調(diào)用<T>任務(wù))