소스 검색

update document

xuxueli 6 년 전
부모
커밋
3e0082ce62
1개의 변경된 파일2개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 4
      xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java

+ 2 - 4
xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java 파일 보기

171
 
171
 
172
                 // align second
172
                 // align second
173
                 try {
173
                 try {
174
-                    TimeUnit.MILLISECONDS.sleep(System.currentTimeMillis()%1000 );
174
+                    TimeUnit.MILLISECONDS.sleep(1000 - System.currentTimeMillis()%1000 );
175
                 } catch (InterruptedException e) {
175
                 } catch (InterruptedException e) {
176
                     if (!toStop) {
176
                     if (!toStop) {
177
                         logger.error(e.getMessage(), e);
177
                         logger.error(e.getMessage(), e);
181
                 int lastSecond = -1;
181
                 int lastSecond = -1;
182
                 while (!toStop) {
182
                 while (!toStop) {
183
 
183
 
184
-                    long start = System.currentTimeMillis();
185
                     try {
184
                     try {
186
                         // second data
185
                         // second data
187
                         List<Integer> ringItemData = new ArrayList<>();
186
                         List<Integer> ringItemData = new ArrayList<>();
219
                             logger.error(">>>>>>>>>>> xxl-job, JobScheduleHelper#ringThread error:{}", e);
218
                             logger.error(">>>>>>>>>>> xxl-job, JobScheduleHelper#ringThread error:{}", e);
220
                         }
219
                         }
221
                     }
220
                     }
222
-                    long cost = System.currentTimeMillis() - start;
223
 
221
 
224
                     // next second, align second
222
                     // next second, align second
225
                     try {
223
                     try {
226
-                        TimeUnit.MILLISECONDS.sleep(1000-cost);
224
+                        TimeUnit.MILLISECONDS.sleep(1000 - System.currentTimeMillis()%1000);
227
                     } catch (InterruptedException e) {
225
                     } catch (InterruptedException e) {
228
                         if (!toStop) {
226
                         if (!toStop) {
229
                             logger.error(e.getMessage(), e);
227
                             logger.error(e.getMessage(), e);