zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.changhong.epc.parsing.service.loop.tools.impl;
 
import com.changhong.epc.constter.parsing.loop.LoopServiceConst;
import com.changhong.epc.parsing.service.loop.tools.ICalcSleepTime;
import com.changhong.epc.parsing.service.loop.tools.thread.MyThread;
 
public class CalcDefaultSleepTime implements ICalcSleepTime {
 
    private  MyThread currThread;
 
    private Long oldRunTime = LoopServiceConst.RUN_DEF_TIME;
    
    public CalcDefaultSleepTime(MyThread thread) {
        this.currThread = thread;
    }
    
    @Override
    public Long getSleepTime() {
         long sleep = AlgorithmTool.calcServiceGapTime(oldRunTime, currThread.getOnceServiceRunTime(), currThread.getSleepTime());
 
         oldRunTime = currThread.getOnceServiceRunTime();
         
        return sleep;
    }
 
}