diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java b/xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java index dcc96b7e..ac2324f4 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java @@ -29,26 +29,26 @@ public class XxlJobExecutor implements ApplicationContextAware { private static final Logger logger = LoggerFactory.getLogger(XxlJobExecutor.class); // ---------------------- param ---------------------- + private String adminAddresses; + private String appName; private String ip; private int port; - private String appName; - private String adminAddresses; private String accessToken; private String logPath; private int logRetentionDays; + public void setAdminAddresses(String adminAddresses) { + this.adminAddresses = adminAddresses; + } + public void setAppName(String appName) { + this.appName = appName; + } public void setIp(String ip) { this.ip = ip; } public void setPort(int port) { this.port = port; } - public void setAppName(String appName) { - this.appName = appName; - } - public void setAdminAddresses(String adminAddresses) { - this.adminAddresses = adminAddresses; - } public void setAccessToken(String accessToken) { this.accessToken = accessToken; } diff --git a/xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/java/com/xuxueli/executor/sample/jfinal/config/JFinalCoreConfig.java b/xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/java/com/xuxueli/executor/sample/jfinal/config/JFinalCoreConfig.java index 3b16c4af..8a32f53f 100644 --- a/xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/java/com/xuxueli/executor/sample/jfinal/config/JFinalCoreConfig.java +++ b/xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/java/com/xuxueli/executor/sample/jfinal/config/JFinalCoreConfig.java @@ -29,12 +29,13 @@ public class JFinalCoreConfig extends JFinalConfig { // init executor xxlJobExecutor = new XxlJobExecutor(); + xxlJobExecutor.setAdminAddresses(xxlJobProp.get("xxl.job.admin.addresses")); + xxlJobExecutor.setAppName(xxlJobProp.get("xxl.job.executor.appname")); xxlJobExecutor.setIp(xxlJobProp.get("xxl.job.executor.ip")); xxlJobExecutor.setPort(xxlJobProp.getInt("xxl.job.executor.port")); - xxlJobExecutor.setAppName(xxlJobProp.get("xxl.job.executor.appname")); - xxlJobExecutor.setAdminAddresses(xxlJobProp.get("xxl.job.admin.addresses")); - xxlJobExecutor.setLogPath(xxlJobProp.get("xxl.job.executor.logpath")); xxlJobExecutor.setAccessToken(xxlJobProp.get("xxl.job.accessToken")); + xxlJobExecutor.setLogPath(xxlJobProp.get("xxl.job.executor.logpath")); + xxlJobExecutor.setLogRetentionDays(xxlJobProp.getInt("xxl.job.executor.logretentiondays")); // start executor try { diff --git a/xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/resources/xxl-job-executor.properties b/xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/resources/xxl-job-executor.properties index 4cafd293..7e4bb804 100644 --- a/xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/resources/xxl-job-executor.properties +++ b/xxl-job-executor-samples/xxl-job-executor-sample-jfinal/src/main/resources/xxl-job-executor.properties @@ -6,8 +6,10 @@ xxl.job.executor.appname=xxl-job-executor-sample xxl.job.executor.ip= xxl.job.executor.port=9996 +### xxl-job, access token +xxl.job.accessToken= + ### xxl-job log path xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler - -### xxl-job, access token -xxl.job.accessToken= \ No newline at end of file +### xxl-job log retention days +xxl.job.executor.logretentiondays=-1 diff --git a/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/config/NutzSetup.java b/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/config/NutzSetup.java index cc7c9c24..eb370ee2 100644 --- a/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/config/NutzSetup.java +++ b/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/java/com/xuxueli/executor/sample/nutz/config/NutzSetup.java @@ -39,12 +39,13 @@ public class NutzSetup implements Setup { // init executor xxlJobExecutor = new XxlJobExecutor(); + xxlJobExecutor.setAdminAddresses(xxlJobProp.get("xxl.job.admin.addresses")); + xxlJobExecutor.setAppName(xxlJobProp.get("xxl.job.executor.appname")); xxlJobExecutor.setIp(xxlJobProp.get("xxl.job.executor.ip")); xxlJobExecutor.setPort(xxlJobProp.getInt("xxl.job.executor.port")); - xxlJobExecutor.setAppName(xxlJobProp.get("xxl.job.executor.appname")); - xxlJobExecutor.setAdminAddresses(xxlJobProp.get("xxl.job.admin.addresses")); - xxlJobExecutor.setLogPath(xxlJobProp.get("xxl.job.executor.logpath")); xxlJobExecutor.setAccessToken(xxlJobProp.get("xxl.job.accessToken")); + xxlJobExecutor.setLogPath(xxlJobProp.get("xxl.job.executor.logpath")); + xxlJobExecutor.setLogRetentionDays(xxlJobProp.getInt("xxl.job.executor.logretentiondays")); // start executor try { diff --git a/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/resources/xxl-job-executor.properties b/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/resources/xxl-job-executor.properties index 19be360e..e703e006 100644 --- a/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/resources/xxl-job-executor.properties +++ b/xxl-job-executor-samples/xxl-job-executor-sample-nutz/src/main/resources/xxl-job-executor.properties @@ -6,8 +6,10 @@ xxl.job.executor.appname=xxl-job-executor-sample xxl.job.executor.ip= xxl.job.executor.port=9997 +### xxl-job, access token +xxl.job.accessToken= + ### xxl-job log path xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler - -### xxl-job, access token -xxl.job.accessToken= \ No newline at end of file +### xxl-job log retention days +xxl.job.executor.logretentiondays=-1 diff --git a/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/applicationcontext-xxl-job.xml b/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/applicationcontext-xxl-job.xml index 41bf2351..afa930db 100644 --- a/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/applicationcontext-xxl-job.xml +++ b/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/applicationcontext-xxl-job.xml @@ -23,14 +23,14 @@ + + + + - - - - diff --git a/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/xxl-job-executor.properties b/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/xxl-job-executor.properties index c30e613c..2fda3391 100644 --- a/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/xxl-job-executor.properties +++ b/xxl-job-executor-samples/xxl-job-executor-sample-spring/src/main/resources/xxl-job-executor.properties @@ -4,7 +4,7 @@ xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin ### xxl-job executor address xxl.job.executor.appname=xxl-job-executor-sample xxl.job.executor.ip= -xxl.job.executor.port=9999 +xxl.job.executor.port=9998 ### xxl-job, access token xxl.job.accessToken= @@ -13,4 +13,3 @@ xxl.job.accessToken= xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler ### xxl-job log retention days xxl.job.executor.logretentiondays=-1 - diff --git a/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/core/config/XxlJobConfig.java b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/core/config/XxlJobConfig.java index 1578fa7f..64e97027 100644 --- a/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/core/config/XxlJobConfig.java +++ b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/core/config/XxlJobConfig.java @@ -18,12 +18,11 @@ import org.springframework.context.annotation.Configuration; public class XxlJobConfig { private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class); - @Value("${xxl.job.admin.addresses}") - private String addresses; + private String adminAddresses; @Value("${xxl.job.executor.appname}") - private String appname; + private String appName; @Value("${xxl.job.executor.ip}") private String ip; @@ -31,22 +30,28 @@ public class XxlJobConfig { @Value("${xxl.job.executor.port}") private int port; - @Value("${xxl.job.executor.logpath}") - private String logpath; - @Value("${xxl.job.accessToken}") private String accessToken; + @Value("${xxl.job.executor.logpath}") + private String logPath; + + @Value("xxl.job.executor.logretentiondays") + private int logRetentionDays; + + @Bean(initMethod = "start", destroyMethod = "destroy") public XxlJobExecutor xxlJobExecutor() { logger.info(">>>>>>>>>>> xxl-job config init."); XxlJobExecutor xxlJobExecutor = new XxlJobExecutor(); + xxlJobExecutor.setAdminAddresses(adminAddresses); + xxlJobExecutor.setAppName(appName); xxlJobExecutor.setIp(ip); xxlJobExecutor.setPort(port); - xxlJobExecutor.setAppName(appname); - xxlJobExecutor.setAdminAddresses(addresses); - xxlJobExecutor.setLogPath(logpath); xxlJobExecutor.setAccessToken(accessToken); + xxlJobExecutor.setLogPath(logPath); + xxlJobExecutor.setLogRetentionDays(logRetentionDays); + return xxlJobExecutor; } diff --git a/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.properties b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.properties index 71fb98f2..2f0c3661 100644 --- a/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.properties +++ b/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.properties @@ -4,17 +4,19 @@ server.port=8081 # log config logging.config=classpath:logback.xml -# xxl-job + ### xxl-job admin address list, such as "http://address" or "http://address01,http://address02" xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin ### xxl-job executor address xxl.job.executor.appname=xxl-job-executor-sample xxl.job.executor.ip= -xxl.job.executor.port=9998 - -### xxl-job log path -xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler +xxl.job.executor.port=9999 ### xxl-job, access token xxl.job.accessToken= + +### xxl-job log path +xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler +### xxl-job log retention days +xxl.job.executor.logretentiondays=-1