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