Fix typos and clean some code...
This commit is contained in:
parent
787ca40319
commit
4fa63e3aae
|
@ -19,8 +19,8 @@ XXL-JOB is a lightweight distributed task scheduling framework, the core design
|
||||||
- 1.Simple: support through the Web page on the task CRUD operation, simple operation, a minute to get started;
|
- 1.Simple: support through the Web page on the task CRUD operation, simple operation, a minute to get started;
|
||||||
- 2.Dynamic: support dynamic modification of task status, pause / resume tasks, and termination of running tasks,immediate effect;
|
- 2.Dynamic: support dynamic modification of task status, pause / resume tasks, and termination of running tasks,immediate effect;
|
||||||
- 3.Dispatch center HA (center type): Dispatch with central design, "dispatch center" based on the cluster of Quartz implementation, can guarantee the scheduling - center HA;
|
- 3.Dispatch center HA (center type): Dispatch with central design, "dispatch center" based on the cluster of Quartz implementation, can guarantee the scheduling - center HA;
|
||||||
- 4.Executer HA (Distributed): Task Distributed Execution, Task " Executer " supports cluster deployment to ensure that tasks perform HA;
|
- 4.Executor HA (Distributed): Task Distributed Execution, Task " Executer " supports cluster deployment to ensure that tasks perform HA;
|
||||||
- 5.Task Failover: Deploy the Excuter cluster,tasks will be smooth to switch excuter when the strategy of the router choose ‘failover’;
|
- 5.Task Failover: Deploy the Excutor cluster,tasks will be smooth to switch excuter when the strategy of the router choose ‘failover’;
|
||||||
- 6.Consistency: "Dispatch Center" through the DB lock to ensure the consistency of cluster distributed scheduling,one task excuted for once;
|
- 6.Consistency: "Dispatch Center" through the DB lock to ensure the consistency of cluster distributed scheduling,one task excuted for once;
|
||||||
- 7.Custom task parameters: support online configuration scheduling tasks into the parameters, immediate effect;
|
- 7.Custom task parameters: support online configuration scheduling tasks into the parameters, immediate effect;
|
||||||
- 8.Scheduling thread pool: scheduling system multi-threaded trigger scheduling operation, to ensure accurate scheduling, not blocked;
|
- 8.Scheduling thread pool: scheduling system multi-threaded trigger scheduling operation, to ensure accurate scheduling, not blocked;
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class JobApiController implements InitializingBean {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class JobLogController {
|
||||||
Date triggerTimeEnd = null;
|
Date triggerTimeEnd = null;
|
||||||
if (filterTime!=null && filterTime.trim().length()>0) {
|
if (filterTime!=null && filterTime.trim().length()>0) {
|
||||||
String[] temp = filterTime.split(" - ");
|
String[] temp = filterTime.split(" - ");
|
||||||
if (temp!=null && temp.length == 2) {
|
if (temp.length == 2) {
|
||||||
triggerTimeStart = DateUtil.parseDateTime(temp[0]);
|
triggerTimeStart = DateUtil.parseDateTime(temp[0]);
|
||||||
triggerTimeEnd = DateUtil.parseDateTime(temp[1]);
|
triggerTimeEnd = DateUtil.parseDateTime(temp[1]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class XxlJobAdminConfig implements InitializingBean{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() {
|
||||||
adminConfig = this;
|
adminConfig = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class XxlJobScheduler implements InitializingBean, DisposableBean {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() {
|
||||||
// init i18n
|
// init i18n
|
||||||
initI18n();
|
initI18n();
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ public class XxlJobScheduler implements InitializingBean, DisposableBean {
|
||||||
|
|
||||||
// ---------------------- executor-client ----------------------
|
// ---------------------- executor-client ----------------------
|
||||||
private static ConcurrentMap<String, ExecutorBiz> executorBizRepository = new ConcurrentHashMap<String, ExecutorBiz>();
|
private static ConcurrentMap<String, ExecutorBiz> executorBizRepository = new ConcurrentHashMap<String, ExecutorBiz>();
|
||||||
public static ExecutorBiz getExecutorBiz(String address) throws Exception {
|
public static ExecutorBiz getExecutorBiz(String address) {
|
||||||
// valid
|
// valid
|
||||||
if (address==null || address.trim().length()==0) {
|
if (address==null || address.trim().length()==0) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -952,7 +952,6 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
|
|
||||||
protected int skipWhiteSpace(int i, String s) {
|
protected int skipWhiteSpace(int i, String s) {
|
||||||
for (; i < s.length() && (s.charAt(i) == ' ' || s.charAt(i) == '\t'); i++) {
|
for (; i < s.length() && (s.charAt(i) == ' ' || s.charAt(i) == '\t'); i++) {
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
|
@ -960,7 +959,6 @@ public final class CronExpression implements Serializable, Cloneable {
|
||||||
|
|
||||||
protected int findNextWhiteSpace(int i, String s) {
|
protected int findNextWhiteSpace(int i, String s) {
|
||||||
for (; i < s.length() && (s.charAt(i) != ' ' || s.charAt(i) != '\t'); i++) {
|
for (; i < s.length() && (s.charAt(i) != ' ' || s.charAt(i) != '\t'); i++) {
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
//
|
//
|
||||||
///**
|
///**
|
||||||
// * http job bean
|
// * http job bean
|
||||||
// * “@DisallowConcurrentExecution” diable concurrent, thread size can not be only one, better given more
|
// * “@DisallowConcurrentExecution” disable concurrent, thread size can not be only one, better given more
|
||||||
// * @author xuxueli 2015-12-17 18:20:34
|
// * @author xuxueli 2015-12-17 18:20:34
|
||||||
// */
|
// */
|
||||||
////@DisallowConcurrentExecution
|
////@DisallowConcurrentExecution
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class ExecutorRouteLRU extends ExecutorRouter {
|
||||||
if (lruItem == null) {
|
if (lruItem == null) {
|
||||||
/**
|
/**
|
||||||
* LinkedHashMap
|
* LinkedHashMap
|
||||||
* a、accessOrder:ture=访问顺序排序(get/put时排序);false=插入顺序排期;
|
* a、accessOrder:true=访问顺序排序(get/put时排序);false=插入顺序排期;
|
||||||
* b、removeEldestEntry:新增元素时将会调用,返回true时会删除最老元素;可封装LinkedHashMap并重写该方法,比如定义最大容量,超出是返回true即可实现固定长度的LRU算法;
|
* b、removeEldestEntry:新增元素时将会调用,返回true时会删除最老元素;可封装LinkedHashMap并重写该方法,比如定义最大容量,超出是返回true即可实现固定长度的LRU算法;
|
||||||
*/
|
*/
|
||||||
lruItem = new LinkedHashMap<String, String>(16, 0.75f, true);
|
lruItem = new LinkedHashMap<String, String>(16, 0.75f, true);
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class JobScheduleHelper {
|
||||||
|
|
||||||
// 1、trigger
|
// 1、trigger
|
||||||
JobTriggerPoolHelper.trigger(jobInfo.getId(), TriggerTypeEnum.CRON, -1, null, null);
|
JobTriggerPoolHelper.trigger(jobInfo.getId(), TriggerTypeEnum.CRON, -1, null, null);
|
||||||
logger.debug(">>>>>>>>>>> xxl-job, shecule push trigger : jobId = " + jobInfo.getId() );
|
logger.debug(">>>>>>>>>>> xxl-job, schedule push trigger : jobId = " + jobInfo.getId() );
|
||||||
|
|
||||||
// 2、fresh next
|
// 2、fresh next
|
||||||
jobInfo.setTriggerLastTime(jobInfo.getTriggerNextTime());
|
jobInfo.setTriggerLastTime(jobInfo.getTriggerNextTime());
|
||||||
|
@ -177,9 +177,9 @@ public class JobScheduleHelper {
|
||||||
if (null != preparedStatement) {
|
if (null != preparedStatement) {
|
||||||
try {
|
try {
|
||||||
preparedStatement.close();
|
preparedStatement.close();
|
||||||
} catch (SQLException ignore) {
|
} catch (SQLException e) {
|
||||||
if (!scheduleThreadToStop) {
|
if (!scheduleThreadToStop) {
|
||||||
logger.error(ignore.getMessage(), ignore);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ public class JobScheduleHelper {
|
||||||
|
|
||||||
// ring trigger
|
// ring trigger
|
||||||
logger.debug(">>>>>>>>>>> xxl-job, time-ring beat : " + nowSecond + " = " + Arrays.asList(ringItemData) );
|
logger.debug(">>>>>>>>>>> xxl-job, time-ring beat : " + nowSecond + " = " + Arrays.asList(ringItemData) );
|
||||||
if (ringItemData!=null && ringItemData.size()>0) {
|
if (ringItemData.size() > 0) {
|
||||||
// do trigger
|
// do trigger
|
||||||
for (int jobId: ringItemData) {
|
for (int jobId: ringItemData) {
|
||||||
// do trigger
|
// do trigger
|
||||||
|
@ -291,7 +291,7 @@ public class JobScheduleHelper {
|
||||||
}
|
}
|
||||||
ringItemData.add(jobId);
|
ringItemData.add(jobId);
|
||||||
|
|
||||||
logger.debug(">>>>>>>>>>> xxl-job, shecule push time-ring : " + ringSecond + " = " + Arrays.asList(ringItemData) );
|
logger.debug(">>>>>>>>>>> xxl-job, schedule push time-ring : " + ringSecond + " = " + Arrays.asList(ringItemData) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toStop(){
|
public void toStop(){
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class LocalCacheUtil {
|
||||||
public static boolean set(String key, Object val, long cacheTime){
|
public static boolean set(String key, Object val, long cacheTime){
|
||||||
|
|
||||||
// clean timeout cache, before set new cache (avoid cache too much)
|
// clean timeout cache, before set new cache (avoid cache too much)
|
||||||
cleanTimeutCache();
|
cleanTimeoutCache();
|
||||||
|
|
||||||
// set new cache
|
// set new cache
|
||||||
if (key==null || key.trim().length()==0) {
|
if (key==null || key.trim().length()==0) {
|
||||||
|
@ -118,7 +118,7 @@ public class LocalCacheUtil {
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean cleanTimeutCache(){
|
public static boolean cleanTimeoutCache(){
|
||||||
if (!cacheRepository.keySet().isEmpty()) {
|
if (!cacheRepository.keySet().isEmpty()) {
|
||||||
for (String key: cacheRepository.keySet()) {
|
for (String key: cacheRepository.keySet()) {
|
||||||
LocalCacheData localCacheData = cacheRepository.get(key);
|
LocalCacheData localCacheData = cacheRepository.get(key);
|
||||||
|
|
|
@ -26,7 +26,7 @@ public interface XxlJobRegistryDao {
|
||||||
@Param("registryKey") String registryKey,
|
@Param("registryKey") String registryKey,
|
||||||
@Param("registryValue") String registryValue);
|
@Param("registryValue") String registryValue);
|
||||||
|
|
||||||
public int registryDelete(@Param("registryGroup") String registGroup,
|
public int registryDelete(@Param("registryGroup") String registryGroup,
|
||||||
@Param("registryKey") String registryKey,
|
@Param("registryKey") String registryKey,
|
||||||
@Param("registryValue") String registryValue);
|
@Param("registryValue") String registryValue);
|
||||||
|
|
||||||
|
|
|
@ -126,9 +126,9 @@ public class AdminBizImpl implements AdminBiz {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReturnT<String> registry(RegistryParam registryParam) {
|
public ReturnT<String> registry(RegistryParam registryParam) {
|
||||||
int ret = xxlJobRegistryDao.registryUpdate(registryParam.getRegistGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue());
|
int ret = xxlJobRegistryDao.registryUpdate(registryParam.getRegistryGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue());
|
||||||
if (ret < 1) {
|
if (ret < 1) {
|
||||||
xxlJobRegistryDao.registrySave(registryParam.getRegistGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue());
|
xxlJobRegistryDao.registrySave(registryParam.getRegistryGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue());
|
||||||
|
|
||||||
// fresh
|
// fresh
|
||||||
freshGroupRegistryInfo(registryParam);
|
freshGroupRegistryInfo(registryParam);
|
||||||
|
@ -138,7 +138,7 @@ public class AdminBizImpl implements AdminBiz {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReturnT<String> registryRemove(RegistryParam registryParam) {
|
public ReturnT<String> registryRemove(RegistryParam registryParam) {
|
||||||
int ret = xxlJobRegistryDao.registryDelete(registryParam.getRegistGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue());
|
int ret = xxlJobRegistryDao.registryDelete(registryParam.getRegistryGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue());
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
|
|
||||||
// fresh
|
// fresh
|
||||||
|
|
|
@ -284,18 +284,18 @@ public class XxlJobServiceImpl implements XxlJobService {
|
||||||
int jobLogSuccessCount = xxlJobLogDao.triggerCountByHandleCode(ReturnT.SUCCESS_CODE);
|
int jobLogSuccessCount = xxlJobLogDao.triggerCountByHandleCode(ReturnT.SUCCESS_CODE);
|
||||||
|
|
||||||
// executor count
|
// executor count
|
||||||
Set<String> executerAddressSet = new HashSet<String>();
|
Set<String> executorAddressSet = new HashSet<String>();
|
||||||
List<XxlJobGroup> groupList = xxlJobGroupDao.findAll();
|
List<XxlJobGroup> groupList = xxlJobGroupDao.findAll();
|
||||||
|
|
||||||
if (groupList!=null && !groupList.isEmpty()) {
|
if (groupList!=null && !groupList.isEmpty()) {
|
||||||
for (XxlJobGroup group: groupList) {
|
for (XxlJobGroup group: groupList) {
|
||||||
if (group.getRegistryList()!=null && !group.getRegistryList().isEmpty()) {
|
if (group.getRegistryList()!=null && !group.getRegistryList().isEmpty()) {
|
||||||
executerAddressSet.addAll(group.getRegistryList());
|
executorAddressSet.addAll(group.getRegistryList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int executorCount = executerAddressSet.size();
|
int executorCount = executorAddressSet.size();
|
||||||
|
|
||||||
Map<String, Object> dashboardMap = new HashMap<String, Object>();
|
Map<String, Object> dashboardMap = new HashMap<String, Object>();
|
||||||
dashboardMap.put("jobInfoCount", jobInfoCount);
|
dashboardMap.put("jobInfoCount", jobInfoCount);
|
||||||
|
|
|
@ -8,23 +8,23 @@ import java.io.Serializable;
|
||||||
public class RegistryParam implements Serializable {
|
public class RegistryParam implements Serializable {
|
||||||
private static final long serialVersionUID = 42L;
|
private static final long serialVersionUID = 42L;
|
||||||
|
|
||||||
private String registGroup;
|
private String registryGroup;
|
||||||
private String registryKey;
|
private String registryKey;
|
||||||
private String registryValue;
|
private String registryValue;
|
||||||
|
|
||||||
public RegistryParam(){}
|
public RegistryParam(){}
|
||||||
public RegistryParam(String registGroup, String registryKey, String registryValue) {
|
public RegistryParam(String registryGroup, String registryKey, String registryValue) {
|
||||||
this.registGroup = registGroup;
|
this.registryGroup = registryGroup;
|
||||||
this.registryKey = registryKey;
|
this.registryKey = registryKey;
|
||||||
this.registryValue = registryValue;
|
this.registryValue = registryValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRegistGroup() {
|
public String getRegistryGroup() {
|
||||||
return registGroup;
|
return registryGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegistGroup(String registGroup) {
|
public void setRegistryGroup(String registryGroup) {
|
||||||
this.registGroup = registGroup;
|
this.registryGroup = registryGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRegistryKey() {
|
public String getRegistryKey() {
|
||||||
|
@ -46,7 +46,7 @@ public class RegistryParam implements Serializable {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "RegistryParam{" +
|
return "RegistryParam{" +
|
||||||
"registGroup='" + registGroup + '\'' +
|
"registryGroup='" + registryGroup + '\'' +
|
||||||
", registryKey='" + registryKey + '\'' +
|
", registryKey='" + registryKey + '\'' +
|
||||||
", registryValue='" + registryValue + '\'' +
|
", registryValue='" + registryValue + '\'' +
|
||||||
'}';
|
'}';
|
||||||
|
|
Loading…
Reference in New Issue