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;
|
}
|
|
}
|