| 
															
																@@ -49,17 +49,20 @@ public class JobScheduleHelper { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 } 
															 | 
															
															 | 
															
																                 } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 logger.info(">>>>>>>>> init xxl-job admin scheduler success."); 
															 | 
															
															 | 
															
																                 logger.info(">>>>>>>>> init xxl-job admin scheduler success."); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                Connection conn = null; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 while (!scheduleThreadToStop) { 
															 | 
															
															 | 
															
																                 while (!scheduleThreadToStop) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     // Scan Job 
															 | 
															
															 | 
															
																                     // Scan Job 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     long start = System.currentTimeMillis(); 
															 | 
															
															 | 
															
																                     long start = System.currentTimeMillis(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    Connection conn = null; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                    Boolean connAutoCommit = null; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     PreparedStatement preparedStatement = null; 
															 | 
															
															 | 
															
																                     PreparedStatement preparedStatement = null; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     boolean preReadSuc = true; 
															 | 
															
															 | 
															
																                     boolean preReadSuc = true; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     try { 
															 | 
															
															 | 
															
																                     try { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                        if (conn==null || conn.isClosed()) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                            conn = XxlJobAdminConfig.getAdminConfig().getDataSource().getConnection(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                        } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        conn = XxlJobAdminConfig.getAdminConfig().getDataSource().getConnection(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        connAutoCommit = conn.getAutoCommit(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         conn.setAutoCommit(false); 
															 | 
															
															 | 
															
																                         conn.setAutoCommit(false); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         preparedStatement = conn.prepareStatement(  "select * from xxl_job_lock where lock_name = 'schedule_lock' for update" ); 
															 | 
															
															 | 
															
																                         preparedStatement = conn.prepareStatement(  "select * from xxl_job_lock where lock_name = 'schedule_lock' for update" ); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -169,11 +172,27 @@ public class JobScheduleHelper { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     } finally { 
															 | 
															
															 | 
															
																                     } finally { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         // commit 
															 | 
															
															 | 
															
																                         // commit 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                        try { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                            conn.commit(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                        } catch (SQLException e) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                            if (!scheduleThreadToStop) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                                logger.error(e.getMessage(), e); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                        if (conn != null) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            try { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                conn.commit(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            } catch (SQLException e) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                if (!scheduleThreadToStop) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                    logger.error(e.getMessage(), e); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            try { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                conn.setAutoCommit(connAutoCommit); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            } catch (SQLException e) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                if (!scheduleThreadToStop) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                    logger.error(e.getMessage(), e); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            try { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                conn.close(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                            } catch (SQLException e) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                if (!scheduleThreadToStop) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                    logger.error(e.getMessage(), e); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+                                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                             } 
															 | 
															
															 | 
															
																                             } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         } 
															 | 
															
															 | 
															
																                         } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -204,12 +223,7 @@ public class JobScheduleHelper { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                     } 
															 | 
															
															 | 
															
																                     } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 } 
															 | 
															
															 | 
															
																                 } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                if (conn != null) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    try { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                        conn.close(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    } catch (SQLException e) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                    } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-                } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                 logger.info(">>>>>>>>>>> xxl-job, JobScheduleHelper#scheduleThread stop"); 
															 | 
															
															 | 
															
																                 logger.info(">>>>>>>>>>> xxl-job, JobScheduleHelper#scheduleThread stop"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             } 
															 | 
															
															 | 
															
																             } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         }); 
															 | 
															
															 | 
															
																         }); 
															 |