scala - ThreadPool线程池


import java.util.concurrent.{LinkedBlockingQueue, ThreadPoolExecutor, TimeUnit}

object ReadToSpark {
//程线程池 private val threadpool = new ThreadPoolExecutor( 1, // core pool size 3, // max pool size 500, // keep alive time TimeUnit.MILLISECONDS, new LinkedBlockingQueue[Runnable]() ) def loadModels(list: List[Map[String, String]]) = { threadpool.execute(new Runnable { override def run(): Unit = {   // 调用运行方法 } }) }
}
posted @ 2021-02-20 14:35  快乐的张小凡  阅读(988)  评论(0编辑  收藏  举报