|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private static CoreThread instance = new CoreThread() ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private static Long sleepBigBusy = 100L ;//大忙时(除了恒久任务,还有其他任务),核心线程暂停间隔 | 
|---|
|  |  |  | private static Long sleepBigBusy = 100L ;//大忙时(除了恒久任务,还是其他任务),核心线程暂停间隔 | 
|---|
|  |  |  | private static Long sleepSmallBusy = 500L ;//小忙时(只有恒久任务,无其他任务),核心线程暂停间隔 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private CoreThread(){ | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 设置暂停时长 | 
|---|
|  |  |  | * @param sleepBigBusy 大忙时(除了恒久任务,还有其他任务),核心线程暂停间隔 | 
|---|
|  |  |  | * @param sleepSmallBusy 小忙时(只有恒久任务,无其他任务),核心线程暂停间隔 | 
|---|
|  |  |  | * @param sleepBigBusy 大忙时睡眠时长 | 
|---|
|  |  |  | * @param sleepSmallBusy 小忙时睡眠时长 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public void setSleep(Long sleepBigBusy, Long sleepSmallBusy){ | 
|---|
|  |  |  | CoreThread.sleepBigBusy = sleepBigBusy ; | 
|---|
|  |  |  | 
|---|
|  |  |  | while(n < count){ | 
|---|
|  |  |  | CoreTask task = (CoreTask)coreQueue.pop() ; | 
|---|
|  |  |  | if(task != null){ | 
|---|
|  |  |  | task.excute(); | 
|---|
|  |  |  | task.execute(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | n ++ ; | 
|---|
|  |  |  | } | 
|---|