|
@@ -38,7 +38,7 @@ public class JobScheduleHelper {
|
38
|
38
|
public void run() {
|
39
|
39
|
|
40
|
40
|
try {
|
41
|
|
- TimeUnit.MILLISECONDS.sleep(5000 + System.currentTimeMillis()%1000 );
|
|
41
|
+ TimeUnit.MILLISECONDS.sleep(5000 - System.currentTimeMillis()%1000 );
|
42
|
42
|
} catch (InterruptedException e) {
|
43
|
43
|
if (!toStop) {
|
44
|
44
|
logger.error(e.getMessage(), e);
|
|
@@ -148,7 +148,9 @@ public class JobScheduleHelper {
|
148
|
148
|
|
149
|
149
|
// next second, align second
|
150
|
150
|
try {
|
151
|
|
- TimeUnit.MILLISECONDS.sleep(cost<1000?(1000-cost):100);
|
|
151
|
+ if (cost < 1000) {
|
|
152
|
+ TimeUnit.MILLISECONDS.sleep(1000 - System.currentTimeMillis()%1000);
|
|
153
|
+ }
|
152
|
154
|
} catch (InterruptedException e) {
|
153
|
155
|
if (!toStop) {
|
154
|
156
|
logger.error(e.getMessage(), e);
|