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