| | |
| | | public void start(UnitStartedCallbackInterface callback) throws Exception { |
| | | if(!started){ |
| | | started = true ; |
| | | if(confVo.enableShortThreadPool) { |
| | | TreadPoolFactory.initThreadPoolShort("短任务工作线程池", |
| | | this.confVo.short_maxThread, |
| | | this.confVo.short_minThread, |
| | | this.confVo.short_freeTimeout, |
| | | if(confVo.enableThreadPool){ |
| | | TreadPoolFactory.initThreadPoolShort("短任务工作线程池", |
| | | this.confVo.short_maxThread, |
| | | this.confVo.short_minThread, |
| | | this.confVo.short_freeTimeout, |
| | | this.confVo.short_busyTimeout); |
| | | }else{ |
| | | System.out.println("短线程池配置不启动"); |
| | | } |
| | | if(confVo.enableLongThreadPool) { |
| | | TreadPoolFactory.initThreadPoolLong("长任务工作线程池", |
| | | this.confVo.long_maxThread, |
| | | this.confVo.long_minThread, |
| | | this.confVo.long_freeTimeout, |
| | | TreadPoolFactory.initThreadPoolLong("长任务工作线程池", |
| | | this.confVo.long_maxThread, |
| | | this.confVo.long_minThread, |
| | | this.confVo.long_freeTimeout, |
| | | this.confVo.long_busyTimeout); |
| | | }else{ |
| | | System.out.println("长线程池配置不启动"); |
| | | |
| | | if(this.confVo.showStartInfo){ |
| | | System.out.println("线程池模块成功启动"); |
| | | } |
| | | } |
| | | if(this.confVo.showStartInfo){ |
| | | System.out.println("线程池模块成功启动"); |
| | | } |
| | | callback.call(null); |
| | | } |
| | | callback.call(null); |
| | | } |
| | | |
| | | @Override |
| | | public void stop(UnitStartedCallbackInterface callback) { |
| | | public void stop(UnitStartedCallbackInterface callback) throws Exception { |
| | | } |
| | | |
| | | /* |
| | | |
| | | public static void main(String[] args) throws Exception{ |
| | | SupportUnitConfigVo supVo = new SupportUnitConfigVo() ; |
| | | //短工作时长线程池,线程负责用时较短的工作任务 |
| | |
| | | supVo.long_busyTimeout = -1 ; |
| | | } |
| | | |
| | | supVo.enableShortThreadPool = true ; |
| | | supVo.enableLongThreadPool = true ; |
| | | |
| | | supVo.enableThreadPool = true ; |
| | | |
| | | supVo.showStartInfo = true ; |
| | | |
| | | SupportUnit supUnit = SupportUnit.getInstance() ; |
| | |
| | | supUnit.start(obj -> { |
| | | }); |
| | | } |
| | | |
| | | private static class AdapterImp_SupportUnit implements SupportUnitAdapter { |
| | | |
| | | private SupportUnitConfigVo configVo = null ; |
| | |
| | | public void setConfig(SupportUnitConfigVo configVo) { |
| | | this.configVo = configVo; |
| | | } |
| | | |
| | | |
| | | } |
| | | */ |
| | | } |