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