Browse Source

优化下命名

高鹏 6 years ago
parent
commit
ee5b0fdc76

+ 8 - 8
xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java View File

@@ -88,12 +88,12 @@ public class XxlJobExecutor implements ApplicationContextAware {
88 88
         JobLogFileCleanThread.getInstance().start(logRetentionDays);
89 89
     }
90 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 94
                 removeJobThread(item.getKey(), "web container destroy and kill the job.");
95 95
             }
96
-            JobThreadRepository.clear();
96
+            jobThreadRepository.clear();
97 97
         }
98 98
 
99 99
         // destory executor-server
@@ -174,13 +174,13 @@ public class XxlJobExecutor implements ApplicationContextAware {
174 174
 
175 175
 
176 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 178
     public static JobThread registJobThread(int jobId, IJobHandler handler, String removeOldReason){
179 179
         JobThread newJobThread = new JobThread(jobId, handler);
180 180
         newJobThread.start();
181 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 184
         if (oldJobThread != null) {
185 185
             oldJobThread.toStop(removeOldReason);
186 186
             oldJobThread.interrupt();
@@ -189,14 +189,14 @@ public class XxlJobExecutor implements ApplicationContextAware {
189 189
         return newJobThread;
190 190
     }
191 191
     public static void removeJobThread(int jobId, String removeOldReason){
192
-        JobThread oldJobThread = JobThreadRepository.remove(jobId);
192
+        JobThread oldJobThread = jobThreadRepository.remove(jobId);
193 193
         if (oldJobThread != null) {
194 194
             oldJobThread.toStop(removeOldReason);
195 195
             oldJobThread.interrupt();
196 196
         }
197 197
     }
198 198
     public static JobThread loadJobThread(int jobId){
199
-        JobThread jobThread = JobThreadRepository.get(jobId);
199
+        JobThread jobThread = jobThreadRepository.get(jobId);
200 200
         return jobThread;
201 201
     }
202 202