|  |  | 
 |  |  | import com.dy.common.queue.Queue; | 
 |  |  | 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 CoreUnit implements UnitInterface { | 
 |  |  |     | 
 |  |  | 
 |  |  |       if(vo == null){ | 
 |  |  |          throw new Exception("核心模块配置对象不能为空!") ; | 
 |  |  |       } | 
 |  |  |       if(vo.sleepBigBusy == null || vo.sleepSmallBusy == null){ | 
 |  |  |       if(vo.coreInterval == null){ | 
 |  |  |          throw new Exception("核心模块配置对象间隔属性值不能为空!") ; | 
 |  |  |       } | 
 |  |  |       if(vo.sleepBigBusy <= 0){ | 
 |  |  |          throw new Exception("核心模块配置对象属性sleepBigBusy值不能小于0!") ; | 
 |  |  |       if(vo.coreInterval <= 0){ | 
 |  |  |          throw new Exception("核心模块配置对象属性coreInterval值不能小于0!") ; | 
 |  |  |       } | 
 |  |  |       if(vo.sleepBigBusy > 1000){ | 
 |  |  |          throw new Exception("核心模块配置对象属性sleepBigBusy值不能大于1000!") ; | 
 |  |  |       } | 
 |  |  |       if(vo.sleepSmallBusy > 1000){ | 
 |  |  |          throw new Exception("核心模块配置对象属性sleepSmallBusy值不能大于1000!") ; | 
 |  |  |       if(vo.coreInterval > 1000){ | 
 |  |  |          throw new Exception("核心模块配置对象属性coreInterval值不能大于1000!") ; | 
 |  |  |       } | 
 |  |  |       if(vo.queueWarnSize == null || vo.queueMaxSize == null){ | 
 |  |  |          throw new Exception("核心模块配置对象队列节点限制数量属性值不能为空!") ; | 
 |  |  | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    @Override | 
 |  |  |    public void start(UnitStartedCallbackInterface callback) throws Exception { | 
 |  |  |    public void start(UnitCallbackInterface callback) throws Exception { | 
 |  |  |       if(!started){ | 
 |  |  |          started = true ; | 
 |  |  |          /* | 
 |  |  |          CoreThread ct = CoreThread.getInstance() ; | 
 |  |  |          ct.setSleep(this.adapter.getConfig().sleepBigBusy, this.adapter.getConfig().sleepSmallBusy); | 
 |  |  |          ct.start();  | 
 |  |  | 			 | 
 |  |  |          ct.start(); | 
 |  |  |          */ | 
 |  |  |          CoreTimer ct = CoreTimer.getInstance() ; | 
 |  |  |          ct.setSleep(this.adapter.getConfig().coreInterval); | 
 |  |  |          ct.start(); | 
 |  |  |  | 
 |  |  |          CoreConstantManage ccm = CoreConstantManage.getInstance() ; | 
 |  |  |          ccm.setSleep(this.adapter.getConfig().sleepBigBusy, this.adapter.getConfig().sleepSmallBusy); | 
 |  |  |          ccm.setSleep(this.adapter.getConfig().coreInterval); | 
 |  |  |          ccm.start(); | 
 |  |  |           | 
 |  |  |          if(adapter.getConfig().showStartInfo){ | 
 |  |  |             System.out.println("核心模块成功启动," | 
 |  |  |                   + "主线程繁忙间隔:" + adapter.getConfig().sleepBigBusy + "毫秒," | 
 |  |  |                   + "轻闲间隔:" + adapter.getConfig().sleepSmallBusy + "毫秒"  ); | 
 |  |  |                   + "主线程执行间隔:" + adapter.getConfig().coreInterval + "毫秒"); | 
 |  |  |          } | 
 |  |  |          callback.call(null); | 
 |  |  |       } | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    @Override | 
 |  |  |    public void stop(UnitStartedCallbackInterface callback) { | 
 |  |  |    public void stop(UnitCallbackInterface callback) { | 
 |  |  |    } | 
 |  |  |     | 
 |  |  |  |