This commit is contained in:
Looly
2019-10-29 19:05:23 +08:00
parent 3cef7fa9a7
commit bf03aebcef
107 changed files with 283 additions and 456 deletions

View File

@@ -16,12 +16,10 @@ public class SimpleTaskListener implements TaskListener{
@Override
public void onSucceeded(TaskExecutor executor) {
}
@Override
public void onFailed(TaskExecutor executor, Throwable exception) {
}
}

View File

@@ -12,7 +12,7 @@ import cn.hutool.core.util.StrUtil;
*/
public class BoolArrayValueMatcher implements ValueMatcher{
boolean[] bValues;
private final boolean[] bValues;
public BoolArrayValueMatcher(List<Integer> intValueList) {
bValues = new boolean[Collections.max(intValueList) + 1];

View File

@@ -18,8 +18,7 @@ import cn.hutool.cron.CronException;
*
*/
public class InvokeTask implements Task{
private Class<?> clazz;
private Object obj;
private Method method;
@@ -41,18 +40,18 @@ public class InvokeTask implements Task{
if(StrUtil.isBlank(className)) {
throw new IllegalArgumentException("Class name is blank !");
}
this.clazz = ClassLoaderUtil.loadClass(className);
if(null == this.clazz) {
final Class<?> clazz = ClassLoaderUtil.loadClass(className);
if(null == clazz) {
throw new IllegalArgumentException("Load class with name of [" + className + "] fail !");
}
this.obj = ReflectUtil.newInstanceIfPossible(this.clazz);
this.obj = ReflectUtil.newInstanceIfPossible(clazz);
//方法
final String methodName = classNameWithMethodName.substring(splitIndex + 1);
if(StrUtil.isBlank(methodName)) {
throw new IllegalArgumentException("Method name is blank !");
}
this.method = ClassUtil.getPublicMethod(this.clazz, methodName);
this.method = ClassUtil.getPublicMethod(clazz, methodName);
if(null == this.method) {
throw new IllegalArgumentException("No method with name of [" + methodName + "] !");
}

View File

@@ -26,6 +26,7 @@ public class TestJob {
/**
* 执行循环定时任务测试在定时任务结束时作为deamon线程是否能正常结束
*/
@SuppressWarnings("InfiniteLoopStatement")
public void doWhileTest() {
String name = Thread.currentThread().getName();
while (true) {