Parcourir la source

优化下命名

高鹏 il y a 6 ans
Parent
révision
ee5b0fdc76

+ 8 - 8
xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java Voir le fichier

88
         JobLogFileCleanThread.getInstance().start(logRetentionDays);
88
         JobLogFileCleanThread.getInstance().start(logRetentionDays);
89
     }
89
     }
90
     public void destroy(){
90
     public void destroy(){
91
-        // destory JobThreadRepository
92
-        if (JobThreadRepository.size() > 0) {
93
-            for (Map.Entry<Integer, JobThread> item: JobThreadRepository.entrySet()) {
91
+        // destory jobThreadRepository
92
+        if (jobThreadRepository.size() > 0) {
93
+            for (Map.Entry<Integer, JobThread> item: jobThreadRepository.entrySet()) {
94
                 removeJobThread(item.getKey(), "web container destroy and kill the job.");
94
                 removeJobThread(item.getKey(), "web container destroy and kill the job.");
95
             }
95
             }
96
-            JobThreadRepository.clear();
96
+            jobThreadRepository.clear();
97
         }
97
         }
98
 
98
 
99
         // destory executor-server
99
         // destory executor-server
174
 
174
 
175
 
175
 
176
     // ---------------------- job thread repository ----------------------
176
     // ---------------------- job thread repository ----------------------
177
-    private static ConcurrentHashMap<Integer, JobThread> JobThreadRepository = new ConcurrentHashMap<Integer, JobThread>();
177
+    private static ConcurrentHashMap<Integer, JobThread> jobThreadRepository = new ConcurrentHashMap<Integer, JobThread>();
178
     public static JobThread registJobThread(int jobId, IJobHandler handler, String removeOldReason){
178
     public static JobThread registJobThread(int jobId, IJobHandler handler, String removeOldReason){
179
         JobThread newJobThread = new JobThread(jobId, handler);
179
         JobThread newJobThread = new JobThread(jobId, handler);
180
         newJobThread.start();
180
         newJobThread.start();
181
         logger.info(">>>>>>>>>>> xxl-job regist JobThread success, jobId:{}, handler:{}", new Object[]{jobId, handler});
181
         logger.info(">>>>>>>>>>> xxl-job regist JobThread success, jobId:{}, handler:{}", new Object[]{jobId, handler});
182
 
182
 
183
-        JobThread oldJobThread = JobThreadRepository.put(jobId, newJobThread);	// putIfAbsent | oh my god, map's put method return the old value!!!
183
+        JobThread oldJobThread = jobThreadRepository.put(jobId, newJobThread);	// putIfAbsent | oh my god, map's put method return the old value!!!
184
         if (oldJobThread != null) {
184
         if (oldJobThread != null) {
185
             oldJobThread.toStop(removeOldReason);
185
             oldJobThread.toStop(removeOldReason);
186
             oldJobThread.interrupt();
186
             oldJobThread.interrupt();
189
         return newJobThread;
189
         return newJobThread;
190
     }
190
     }
191
     public static void removeJobThread(int jobId, String removeOldReason){
191
     public static void removeJobThread(int jobId, String removeOldReason){
192
-        JobThread oldJobThread = JobThreadRepository.remove(jobId);
192
+        JobThread oldJobThread = jobThreadRepository.remove(jobId);
193
         if (oldJobThread != null) {
193
         if (oldJobThread != null) {
194
             oldJobThread.toStop(removeOldReason);
194
             oldJobThread.toStop(removeOldReason);
195
             oldJobThread.interrupt();
195
             oldJobThread.interrupt();
196
         }
196
         }
197
     }
197
     }
198
     public static JobThread loadJobThread(int jobId){
198
     public static JobThread loadJobThread(int jobId){
199
-        JobThread jobThread = JobThreadRepository.get(jobId);
199
+        JobThread jobThread = jobThreadRepository.get(jobId);
200
         return jobThread;
200
         return jobThread;
201
     }
201
     }
202
 
202