update 优化 !pr493 代码结构与问题修复

This commit is contained in:
疯狂的狮子Li
2024-03-14 01:13:29 +08:00
parent 1b6b74c67b
commit abe6b05c5c
14 changed files with 236 additions and 261 deletions

View File

@ -3,18 +3,21 @@ package org.dromara.job.easyretry;
import com.aizuda.easy.retry.client.job.core.annotation.JobExecutor;
import com.aizuda.easy.retry.client.job.core.dto.JobArgs;
import com.aizuda.easy.retry.client.model.ExecuteResult;
import com.aizuda.easy.retry.common.core.util.JsonUtil;
import com.aizuda.easy.retry.common.log.EasyRetryLog;
import org.springframework.stereotype.Component;
/**
* @author www.byteblogs.com
* @date 2023-09-28 22:54:07
* @since 2.4.0
*/
@Component
@JobExecutor(name = "testJobExecutor")
public class TestAnnoJobExecutor {
public ExecuteResult jobExecute(JobArgs jobArgs) {
EasyRetryLog.LOCAL.info("testJobExecutor. jobArgs:{}", JsonUtil.toJsonString(jobArgs));
EasyRetryLog.REMOTE.info("testJobExecutor. jobArgs:{}", JsonUtil.toJsonString(jobArgs));
return ExecuteResult.success("测试成功");
}
}

View File

@ -1,27 +0,0 @@
package org.dromara.job.easyretry;
import com.aizuda.easy.retry.client.job.core.annotation.JobExecutor;
import com.aizuda.easy.retry.client.job.core.dto.JobArgs;
import com.aizuda.easy.retry.client.model.ExecuteResult;
import com.aizuda.easy.retry.common.core.util.JsonUtil;
import org.springframework.stereotype.Component;
/**
* @author www.byteblogs.com
* @date 2023-09-28 22:54:07
* @since 2.4.0
*/
@Component
@JobExecutor(name = "testAnnoJobExecutorSleep10s")
public class TestAnnoJobExecutorSleep10s {
public ExecuteResult jobExecute(JobArgs jobArgs) {
System.out.println(JsonUtil.toJsonString(jobArgs));
try {
Thread.sleep(10 * 1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
return ExecuteResult.success("测试成功");
}
}

View File

@ -1,27 +0,0 @@
package org.dromara.job.easyretry;
import com.aizuda.easy.retry.client.job.core.annotation.JobExecutor;
import com.aizuda.easy.retry.client.job.core.dto.JobArgs;
import com.aizuda.easy.retry.client.model.ExecuteResult;
import com.aizuda.easy.retry.common.core.util.JsonUtil;
import org.springframework.stereotype.Component;
/**
* @author www.byteblogs.com
* @date 2023-09-28 22:54:07
* @since 2.4.0
*/
@Component
@JobExecutor(name = "testAnnoJobExecutorSleep1s")
public class TestAnnoJobExecutorSleep1s {
public ExecuteResult jobExecute(JobArgs jobArgs) {
System.out.println(JsonUtil.toJsonString(jobArgs));
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
return ExecuteResult.success("测试成功");
}
}

View File

@ -1,27 +0,0 @@
package org.dromara.job.easyretry;
import com.aizuda.easy.retry.client.job.core.annotation.JobExecutor;
import com.aizuda.easy.retry.client.job.core.dto.JobArgs;
import com.aizuda.easy.retry.client.model.ExecuteResult;
import com.aizuda.easy.retry.common.core.util.JsonUtil;
import org.springframework.stereotype.Component;
/**
* @author www.byteblogs.com
* @date 2023-09-28 22:54:07
* @since 2.4.0
*/
@Component
@JobExecutor(name = "testAnnoJobExecutorSleep30s")
public class TestAnnoJobExecutorSleep30s {
public ExecuteResult jobExecute(JobArgs jobArgs) {
System.out.println(JsonUtil.toJsonString(jobArgs));
try {
Thread.sleep(30 * 1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
return ExecuteResult.success("测试成功");
}
}

View File

@ -1,30 +0,0 @@
package org.dromara.job.easyretry;
import com.aizuda.easy.retry.client.job.core.annotation.JobExecutor;
import com.aizuda.easy.retry.client.job.core.dto.JobArgs;
import com.aizuda.easy.retry.client.model.ExecuteResult;
import com.aizuda.easy.retry.common.core.util.JsonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author www.byteblogs.com
* @date 2023-09-28 22:54:07
* @since 2.4.0
*/
@Component
@Slf4j
@JobExecutor(name = "testAnnoJobExecutorSleep5s")
public class TestAnnoJobExecutorSleep5s {
public ExecuteResult jobExecute(JobArgs jobArgs) {
log.info("testAnnoJobExecutorSleep5s. jobArgs:{}", JsonUtil.toJsonString(jobArgs));
try {
Thread.sleep(5 * 1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
return ExecuteResult.success("测试成功");
}
}

View File

@ -8,7 +8,6 @@ import org.springframework.stereotype.Component;
/**
* @author www.byteblogs.com
* @date 2023-09-28 22:54:07
* @since 2.4.0
*/
@Component
public class TestClassJobExecutor extends AbstractJobExecutor {