pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreThread.java
@@ -4,13 +4,22 @@
import com.dy.common.queue.Queue;
/**
 * 2024-11-21 该类已经弃用,改由CoreTimer实现。
 * 当采用Thread实现时,在while(true){}中使用Thread.sleep(),可能导致的严重性能问题,不推荐在循环中使用线程休眠。
 * Java线程实现采用内核线程实现,线程的休眠及唤醒(状态切换)需借助操作系统进行,这是一个极其耗时耗力的操作。
 * 在线程休眠或运行时间较长的情景下,其对性能的影响还不算明显,因为对线程状态的切换并不频繁。
 * 但若线程休眠及运行的时间都很短(例如毫秒/秒),
 * 系统将频繁的对线程状态进行切换,导致严重的性能损耗,并对着循环次数的递增而放大。
 */
@Deprecated
public class CoreThread extends Thread{
   
   private static Logger log = LogManager.getLogger(CoreThread.class.getName()) ;
   
   private static CoreThread instance = new CoreThread() ;
   private static Long sleepBigBusy = 100L ;//大忙时(除了恒久任务,还有其他任务),核心线程暂停间隔
   private static Long sleepBigBusy = 100L ;//大忙时(除了恒久任务,还是其他任务),核心线程暂停间隔
   private static Long sleepSmallBusy = 500L ;//小忙时(只有恒久任务,无其他任务),核心线程暂停间隔
   
   private CoreThread(){
@@ -22,8 +31,8 @@
   
   /**
    * 设置暂停时长
    * @param sleepBigBusy 大忙时(除了恒久任务,还有其他任务),核心线程暂停间隔
    * @param sleepSmallBusy 小忙时(只有恒久任务,无其他任务),核心线程暂停间隔
    * @param sleepBigBusy 大忙时睡眠时长
    * @param sleepSmallBusy 小忙时睡眠时长
    */
   public void setSleep(Long sleepBigBusy, Long sleepSmallBusy){
      CoreThread.sleepBigBusy = sleepBigBusy ;
@@ -52,7 +61,7 @@
               while(n < count){
                  CoreTask task = (CoreTask)coreQueue.pop() ;
                  if(task != null){
                     task.excute();
                     task.execute();
                  }
                  n ++ ;
               }