2021
04-27
04-27
Java利用线程工厂监控线程池的实现示例
ThreadFactory线程池中的线程从哪里来呢?就是ThreadFoctorypublicinterfaceThreadFactory{ThreadnewThread(Runnabler);}Threadfactory里面有个接口,当线程池中需要创建线程就会调用该方法,也可以自定义线程工厂publicclassThreadfactoryText{publicstaticvoidmain(String[]args){Runnablerunnable=newRunnable(){@Overridepublicvoidrun(){intnum...
继续阅读 >