diff --git a/skywalking/agent/LICENSE b/deploy/skywalking/agent/LICENSE
similarity index 100%
rename from skywalking/agent/LICENSE
rename to deploy/skywalking/agent/LICENSE
diff --git a/skywalking/agent/NOTICE b/deploy/skywalking/agent/NOTICE
similarity index 100%
rename from skywalking/agent/NOTICE
rename to deploy/skywalking/agent/NOTICE
diff --git a/skywalking/agent/activations/apm-toolkit-kafka-activation-9.2.0.jar b/deploy/skywalking/agent/activations/apm-toolkit-kafka-activation-9.2.0.jar
similarity index 100%
rename from skywalking/agent/activations/apm-toolkit-kafka-activation-9.2.0.jar
rename to deploy/skywalking/agent/activations/apm-toolkit-kafka-activation-9.2.0.jar
diff --git a/skywalking/agent/activations/apm-toolkit-log4j-1.x-activation-9.2.0.jar b/deploy/skywalking/agent/activations/apm-toolkit-log4j-1.x-activation-9.2.0.jar
similarity index 100%
rename from skywalking/agent/activations/apm-toolkit-log4j-1.x-activation-9.2.0.jar
rename to deploy/skywalking/agent/activations/apm-toolkit-log4j-1.x-activation-9.2.0.jar
diff --git a/skywalking/agent/activations/apm-toolkit-log4j-2.x-activation-9.2.0.jar b/deploy/skywalking/agent/activations/apm-toolkit-log4j-2.x-activation-9.2.0.jar
similarity index 100%
rename from skywalking/agent/activations/apm-toolkit-log4j-2.x-activation-9.2.0.jar
rename to deploy/skywalking/agent/activations/apm-toolkit-log4j-2.x-activation-9.2.0.jar
diff --git a/skywalking/agent/activations/apm-toolkit-logback-1.x-activation-9.2.0.jar b/deploy/skywalking/agent/activations/apm-toolkit-logback-1.x-activation-9.2.0.jar
similarity index 100%
rename from skywalking/agent/activations/apm-toolkit-logback-1.x-activation-9.2.0.jar
rename to deploy/skywalking/agent/activations/apm-toolkit-logback-1.x-activation-9.2.0.jar
diff --git a/skywalking/agent/activations/apm-toolkit-logging-common-9.2.0.jar b/deploy/skywalking/agent/activations/apm-toolkit-logging-common-9.2.0.jar
similarity index 100%
rename from skywalking/agent/activations/apm-toolkit-logging-common-9.2.0.jar
rename to deploy/skywalking/agent/activations/apm-toolkit-logging-common-9.2.0.jar
diff --git a/skywalking/agent/activations/apm-toolkit-meter-activation-9.2.0.jar b/deploy/skywalking/agent/activations/apm-toolkit-meter-activation-9.2.0.jar
similarity index 100%
rename from skywalking/agent/activations/apm-toolkit-meter-activation-9.2.0.jar
rename to deploy/skywalking/agent/activations/apm-toolkit-meter-activation-9.2.0.jar
diff --git a/skywalking/agent/activations/apm-toolkit-micrometer-activation-9.2.0.jar b/deploy/skywalking/agent/activations/apm-toolkit-micrometer-activation-9.2.0.jar
similarity index 100%
rename from skywalking/agent/activations/apm-toolkit-micrometer-activation-9.2.0.jar
rename to deploy/skywalking/agent/activations/apm-toolkit-micrometer-activation-9.2.0.jar
diff --git a/skywalking/agent/activations/apm-toolkit-opentracing-activation-9.2.0.jar b/deploy/skywalking/agent/activations/apm-toolkit-opentracing-activation-9.2.0.jar
similarity index 100%
rename from skywalking/agent/activations/apm-toolkit-opentracing-activation-9.2.0.jar
rename to deploy/skywalking/agent/activations/apm-toolkit-opentracing-activation-9.2.0.jar
diff --git a/skywalking/agent/activations/apm-toolkit-trace-activation-9.2.0.jar b/deploy/skywalking/agent/activations/apm-toolkit-trace-activation-9.2.0.jar
similarity index 100%
rename from skywalking/agent/activations/apm-toolkit-trace-activation-9.2.0.jar
rename to deploy/skywalking/agent/activations/apm-toolkit-trace-activation-9.2.0.jar
diff --git a/skywalking/agent/activations/apm-toolkit-webflux-activation-9.2.0.jar b/deploy/skywalking/agent/activations/apm-toolkit-webflux-activation-9.2.0.jar
similarity index 100%
rename from skywalking/agent/activations/apm-toolkit-webflux-activation-9.2.0.jar
rename to deploy/skywalking/agent/activations/apm-toolkit-webflux-activation-9.2.0.jar
diff --git a/skywalking/agent/bootstrap-plugins/apm-jdk-forkjoinpool-plugin-9.2.0.jar b/deploy/skywalking/agent/bootstrap-plugins/apm-jdk-forkjoinpool-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/bootstrap-plugins/apm-jdk-forkjoinpool-plugin-9.2.0.jar
rename to deploy/skywalking/agent/bootstrap-plugins/apm-jdk-forkjoinpool-plugin-9.2.0.jar
diff --git a/skywalking/agent/bootstrap-plugins/apm-jdk-http-plugin-9.2.0.jar b/deploy/skywalking/agent/bootstrap-plugins/apm-jdk-http-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/bootstrap-plugins/apm-jdk-http-plugin-9.2.0.jar
rename to deploy/skywalking/agent/bootstrap-plugins/apm-jdk-http-plugin-9.2.0.jar
diff --git a/skywalking/agent/bootstrap-plugins/apm-jdk-threading-plugin-9.2.0.jar b/deploy/skywalking/agent/bootstrap-plugins/apm-jdk-threading-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/bootstrap-plugins/apm-jdk-threading-plugin-9.2.0.jar
rename to deploy/skywalking/agent/bootstrap-plugins/apm-jdk-threading-plugin-9.2.0.jar
diff --git a/skywalking/agent/bootstrap-plugins/apm-jdk-threadpool-plugin-9.2.0.jar b/deploy/skywalking/agent/bootstrap-plugins/apm-jdk-threadpool-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/bootstrap-plugins/apm-jdk-threadpool-plugin-9.2.0.jar
rename to deploy/skywalking/agent/bootstrap-plugins/apm-jdk-threadpool-plugin-9.2.0.jar
diff --git a/skywalking/agent/config/agent.config b/deploy/skywalking/agent/config/agent.config
similarity index 100%
rename from skywalking/agent/config/agent.config
rename to deploy/skywalking/agent/config/agent.config
diff --git a/skywalking/agent/expired-plugins/apm-impala-jdbc-2.6.x-plugin-9.2.0.jar b/deploy/skywalking/agent/expired-plugins/apm-impala-jdbc-2.6.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/expired-plugins/apm-impala-jdbc-2.6.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/expired-plugins/apm-impala-jdbc-2.6.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/licenses/LICENSE-asm.txt b/deploy/skywalking/agent/licenses/LICENSE-asm.txt
similarity index 100%
rename from skywalking/agent/licenses/LICENSE-asm.txt
rename to deploy/skywalking/agent/licenses/LICENSE-asm.txt
diff --git a/skywalking/agent/optional-plugins/apm-customize-enhance-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-customize-enhance-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-customize-enhance-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-customize-enhance-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-ehcache-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-ehcache-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-ehcache-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-ehcache-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-fastjson-1.x-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-fastjson-1.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-fastjson-1.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-fastjson-1.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-gson-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-gson-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-gson-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-gson-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-guava-cache-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-guava-cache-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-guava-cache-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-guava-cache-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-jackson-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-jackson-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-jackson-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-jackson-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-kotlin-coroutine-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-kotlin-coroutine-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-kotlin-coroutine-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-kotlin-coroutine-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-mybatis-3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-mybatis-3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-mybatis-3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-mybatis-3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-nacos-client-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-nacos-client-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-nacos-client-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-nacos-client-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-netty-http-4.1.x-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-netty-http-4.1.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-netty-http-4.1.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-netty-http-4.1.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-quartz-scheduler-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-quartz-scheduler-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-quartz-scheduler-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-quartz-scheduler-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-resttemplate-6.x-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-resttemplate-6.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-resttemplate-6.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-resttemplate-6.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-sentinel-1.x-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-sentinel-1.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-sentinel-1.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-sentinel-1.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-shenyu-2.4.x-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-shenyu-2.4.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-shenyu-2.4.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-shenyu-2.4.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-spring-annotation-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-spring-annotation-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-spring-annotation-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-spring-annotation-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-spring-cloud-gateway-2.0.x-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-spring-cloud-gateway-2.0.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-spring-cloud-gateway-2.0.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-spring-cloud-gateway-2.0.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-spring-cloud-gateway-2.1.x-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-spring-cloud-gateway-2.1.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-spring-cloud-gateway-2.1.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-spring-cloud-gateway-2.1.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-spring-cloud-gateway-3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-spring-cloud-gateway-3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-spring-cloud-gateway-3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-spring-cloud-gateway-3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-spring-cloud-gateway-4.x-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-spring-cloud-gateway-4.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-spring-cloud-gateway-4.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-spring-cloud-gateway-4.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-spring-tx-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-spring-tx-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-spring-tx-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-spring-tx-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-spring-webflux-5.x-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-spring-webflux-5.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-spring-webflux-5.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-spring-webflux-5.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-spring-webflux-6.x-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-spring-webflux-6.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-spring-webflux-6.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-spring-webflux-6.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-springmvc-annotation-6.x-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-springmvc-annotation-6.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-springmvc-annotation-6.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-springmvc-annotation-6.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-trace-ignore-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-trace-ignore-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-trace-ignore-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-trace-ignore-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/apm-zookeeper-3.4.x-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/apm-zookeeper-3.4.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/apm-zookeeper-3.4.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/apm-zookeeper-3.4.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-plugins/trace-sampler-cpu-policy-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-plugins/trace-sampler-cpu-policy-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-plugins/trace-sampler-cpu-policy-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-plugins/trace-sampler-cpu-policy-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-reporter-plugins/kafka-reporter-plugin-9.2.0.jar b/deploy/skywalking/agent/optional-reporter-plugins/kafka-reporter-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/optional-reporter-plugins/kafka-reporter-plugin-9.2.0.jar
rename to deploy/skywalking/agent/optional-reporter-plugins/kafka-reporter-plugin-9.2.0.jar
diff --git a/skywalking/agent/optional-reporter-plugins/lz4-java-1.6.0.jar b/deploy/skywalking/agent/optional-reporter-plugins/lz4-java-1.6.0.jar
similarity index 100%
rename from skywalking/agent/optional-reporter-plugins/lz4-java-1.6.0.jar
rename to deploy/skywalking/agent/optional-reporter-plugins/lz4-java-1.6.0.jar
diff --git a/skywalking/agent/optional-reporter-plugins/snappy-java-1.1.7.3.jar b/deploy/skywalking/agent/optional-reporter-plugins/snappy-java-1.1.7.3.jar
similarity index 100%
rename from skywalking/agent/optional-reporter-plugins/snappy-java-1.1.7.3.jar
rename to deploy/skywalking/agent/optional-reporter-plugins/snappy-java-1.1.7.3.jar
diff --git a/skywalking/agent/optional-reporter-plugins/zstd-jni-1.4.3-1.jar b/deploy/skywalking/agent/optional-reporter-plugins/zstd-jni-1.4.3-1.jar
similarity index 100%
rename from skywalking/agent/optional-reporter-plugins/zstd-jni-1.4.3-1.jar
rename to deploy/skywalking/agent/optional-reporter-plugins/zstd-jni-1.4.3-1.jar
diff --git a/skywalking/agent/plugins/apm-activemq-5.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-activemq-5.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-activemq-5.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-activemq-5.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-activemq-artemis-jakarta-client-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-activemq-artemis-jakarta-client-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-activemq-artemis-jakarta-client-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-activemq-artemis-jakarta-client-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-aerospike-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-aerospike-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-aerospike-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-aerospike-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-armeria-0.84.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-armeria-0.84.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-armeria-0.84.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-armeria-0.84.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-armeria-0.85.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-armeria-0.85.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-armeria-0.85.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-armeria-0.85.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-armeria-1.0.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-armeria-1.0.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-armeria-1.0.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-armeria-1.0.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-asynchttpclient-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-asynchttpclient-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-asynchttpclient-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-asynchttpclient-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-avro-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-avro-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-avro-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-avro-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-canal-1.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-canal-1.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-canal-1.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-canal-1.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-cassandra-java-driver-3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-cassandra-java-driver-3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-cassandra-java-driver-3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-cassandra-java-driver-3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-clickhouse-0.3.1-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-clickhouse-0.3.1-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-clickhouse-0.3.1-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-clickhouse-0.3.1-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-clickhouse-0.3.2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-clickhouse-0.3.2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-clickhouse-0.3.2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-clickhouse-0.3.2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-cxf-3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-cxf-3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-cxf-3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-cxf-3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-dubbo-2.7.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-dubbo-2.7.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-dubbo-2.7.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-dubbo-2.7.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-dubbo-3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-dubbo-3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-dubbo-3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-dubbo-3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-dubbo-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-dubbo-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-dubbo-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-dubbo-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-elastic-job-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-elastic-job-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-elastic-job-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-elastic-job-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-elasticjob-3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-elasticjob-3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-elasticjob-3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-elasticjob-3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-elasticsearch-5.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-elasticsearch-5.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-elasticsearch-5.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-elasticsearch-5.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-elasticsearch-6.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-elasticsearch-6.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-elasticsearch-6.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-elasticsearch-6.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-elasticsearch-7.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-elasticsearch-7.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-elasticsearch-7.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-elasticsearch-7.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-feign-default-http-9.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-feign-default-http-9.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-feign-default-http-9.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-feign-default-http-9.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-finagle-6.25.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-finagle-6.25.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-finagle-6.25.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-finagle-6.25.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-grizzly-2.x-4.x-work-threadpool-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-grizzly-2.x-4.x-work-threadpool-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-grizzly-2.x-4.x-work-threadpool-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-grizzly-2.x-4.x-work-threadpool-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-grizzly-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-grizzly-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-grizzly-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-grizzly-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-grpc-1.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-grpc-1.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-grpc-1.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-grpc-1.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-guava-eventbus-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-guava-eventbus-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-guava-eventbus-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-guava-eventbus-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-h2-1.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-h2-1.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-h2-1.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-h2-1.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-hbase-1.x-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-hbase-1.x-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-hbase-1.x-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-hbase-1.x-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-hikaricp-3.x-4.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-hikaricp-3.x-4.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-hikaricp-3.x-4.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-hikaricp-3.x-4.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-httpClient-4.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-httpClient-4.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-httpClient-4.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-httpClient-4.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-httpasyncclient-4.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-httpasyncclient-4.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-httpasyncclient-4.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-httpasyncclient-4.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-httpclient-3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-httpclient-3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-httpclient-3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-httpclient-3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-httpclient-5.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-httpclient-5.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-httpclient-5.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-httpclient-5.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-httpclient-commons-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-httpclient-commons-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-httpclient-commons-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-httpclient-commons-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-hutool-http-5.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-hutool-http-5.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-hutool-http-5.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-hutool-http-5.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-hystrix-1.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-hystrix-1.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-hystrix-1.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-hystrix-1.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-influxdb-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-influxdb-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-influxdb-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-influxdb-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-jdbc-commons-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-jdbc-commons-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-jdbc-commons-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-jdbc-commons-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-jersey-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-jersey-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-jersey-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-jersey-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-jersey-3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-jersey-3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-jersey-3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-jersey-3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-jetty-client-11.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-jetty-client-11.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-jetty-client-11.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-jetty-client-11.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-jetty-client-9.0-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-jetty-client-9.0-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-jetty-client-9.0-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-jetty-client-9.0-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-jetty-client-9.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-jetty-client-9.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-jetty-client-9.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-jetty-client-9.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-jetty-server-11.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-jetty-server-11.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-jetty-server-11.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-jetty-server-11.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-jetty-server-9.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-jetty-server-9.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-jetty-server-9.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-jetty-server-9.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-jetty-thread-pool-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-jetty-thread-pool-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-jetty-thread-pool-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-jetty-thread-pool-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-kafka-commons-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-kafka-commons-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-kafka-commons-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-kafka-commons-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-kafka-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-kafka-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-kafka-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-kafka-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-kylin-jdbc-2.6.x-3.x-4.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-kylin-jdbc-2.6.x-3.x-4.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-kylin-jdbc-2.6.x-3.x-4.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-kylin-jdbc-2.6.x-3.x-4.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-lettuce-5.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-lettuce-5.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-lettuce-5.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-lettuce-5.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-light4j-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-light4j-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-light4j-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-light4j-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-mariadb-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-mariadb-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-mariadb-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-mariadb-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-mongodb-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-mongodb-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-mongodb-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-mongodb-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-mongodb-3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-mongodb-3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-mongodb-3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-mongodb-3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-mongodb-4.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-mongodb-4.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-mongodb-4.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-mongodb-4.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-mssql-commons-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-mssql-commons-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-mssql-commons-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-mssql-commons-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-mssql-jdbc-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-mssql-jdbc-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-mssql-jdbc-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-mssql-jdbc-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-mssql-jtds-1.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-mssql-jtds-1.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-mssql-jtds-1.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-mssql-jtds-1.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-mysql-5.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-mysql-5.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-mysql-5.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-mysql-5.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-mysql-6.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-mysql-6.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-mysql-6.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-mysql-6.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-mysql-8.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-mysql-8.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-mysql-8.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-mysql-8.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-mysql-commons-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-mysql-commons-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-mysql-commons-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-mysql-commons-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-neo4j-4.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-neo4j-4.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-neo4j-4.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-neo4j-4.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-netty-socketio-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-netty-socketio-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-netty-socketio-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-netty-socketio-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-nutz-http-1.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-nutz-http-1.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-nutz-http-1.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-nutz-http-1.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-nutz-mvc-annotation-1.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-nutz-mvc-annotation-1.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-nutz-mvc-annotation-1.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-nutz-mvc-annotation-1.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-okhttp-3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-okhttp-3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-okhttp-3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-okhttp-3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-okhttp-4.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-okhttp-4.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-okhttp-4.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-okhttp-4.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-okhttp-common-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-okhttp-common-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-okhttp-common-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-okhttp-common-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-play-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-play-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-play-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-play-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-postgresql-8.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-postgresql-8.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-postgresql-8.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-postgresql-8.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-pulsar-2.2-2.7-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-pulsar-2.2-2.7-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-pulsar-2.2-2.7-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-pulsar-2.2-2.7-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-pulsar-2.8.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-pulsar-2.8.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-pulsar-2.8.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-pulsar-2.8.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-pulsar-common-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-pulsar-common-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-pulsar-common-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-pulsar-common-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-quasar-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-quasar-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-quasar-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-quasar-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-rabbitmq-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-rabbitmq-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-rabbitmq-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-rabbitmq-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-redisson-3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-redisson-3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-redisson-3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-redisson-3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-resttemplate-3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-resttemplate-3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-resttemplate-3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-resttemplate-3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-resttemplate-4.3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-resttemplate-4.3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-resttemplate-4.3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-resttemplate-4.3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-rocketMQ-5.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-rocketMQ-5.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-rocketMQ-5.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-rocketMQ-5.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-rocketmq-3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-rocketmq-3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-rocketmq-3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-rocketmq-3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-rocketmq-4.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-rocketmq-4.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-rocketmq-4.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-rocketmq-4.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-rocketmq-client-java-5.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-rocketmq-client-java-5.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-rocketmq-client-java-5.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-rocketmq-client-java-5.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-servicecomb-java-chassis-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-servicecomb-java-chassis-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-servicecomb-java-chassis-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-servicecomb-java-chassis-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-sharding-sphere-3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-sharding-sphere-3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-sharding-sphere-3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-sharding-sphere-3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-sharding-sphere-4.1.0-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-sharding-sphere-4.1.0-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-sharding-sphere-4.1.0-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-sharding-sphere-4.1.0-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-shardingsphere-4.0.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-shardingsphere-4.0.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-shardingsphere-4.0.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-shardingsphere-4.0.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-shardingsphere-5.0.0-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-shardingsphere-5.0.0-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-shardingsphere-5.0.0-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-shardingsphere-5.0.0-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-solrj-7.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-solrj-7.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-solrj-7.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-solrj-7.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-spring-async-annotation-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-spring-async-annotation-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-spring-async-annotation-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-spring-async-annotation-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-spring-cloud-feign-1.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-spring-cloud-feign-1.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-spring-cloud-feign-1.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-spring-cloud-feign-1.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-spring-cloud-feign-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-spring-cloud-feign-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-spring-cloud-feign-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-spring-cloud-feign-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-spring-concurrent-util-4.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-spring-concurrent-util-4.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-spring-concurrent-util-4.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-spring-concurrent-util-4.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-spring-core-patch-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-spring-core-patch-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-spring-core-patch-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-spring-core-patch-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-spring-kafka-1.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-spring-kafka-1.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-spring-kafka-1.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-spring-kafka-1.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-spring-kafka-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-spring-kafka-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-spring-kafka-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-spring-kafka-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-spring-scheduled-annotation-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-spring-scheduled-annotation-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-spring-scheduled-annotation-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-spring-scheduled-annotation-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-springmvc-annotation-3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-springmvc-annotation-3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-springmvc-annotation-3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-springmvc-annotation-3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-springmvc-annotation-4.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-springmvc-annotation-4.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-springmvc-annotation-4.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-springmvc-annotation-4.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-springmvc-annotation-5.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-springmvc-annotation-5.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-springmvc-annotation-5.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-springmvc-annotation-5.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-springmvc-annotation-commons-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-springmvc-annotation-commons-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-springmvc-annotation-commons-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-springmvc-annotation-commons-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-spymemcached-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-spymemcached-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-spymemcached-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-spymemcached-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-struts2-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-struts2-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-struts2-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-struts2-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-tomcat-thread-pool-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-tomcat-thread-pool-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-tomcat-thread-pool-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-tomcat-thread-pool-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-undertow-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-undertow-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-undertow-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-undertow-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-undertow-worker-thread-pool-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-undertow-worker-thread-pool-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-undertow-worker-thread-pool-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-undertow-worker-thread-pool-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-vertx-core-3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-vertx-core-3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-vertx-core-3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-vertx-core-3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-vertx-core-4.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-vertx-core-4.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-vertx-core-4.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-vertx-core-4.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-xmemcached-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-xmemcached-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-xmemcached-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-xmemcached-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/apm-xxl-job-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/apm-xxl-job-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/apm-xxl-job-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/apm-xxl-job-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/baidu-brpc-3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/baidu-brpc-3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/baidu-brpc-3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/baidu-brpc-3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/baidu-brpc-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/baidu-brpc-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/baidu-brpc-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/baidu-brpc-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/dbcp-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/dbcp-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/dbcp-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/dbcp-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/druid-1.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/druid-1.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/druid-1.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/druid-1.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/dubbo-2.7.x-conflict-patch-9.2.0.jar b/deploy/skywalking/agent/plugins/dubbo-2.7.x-conflict-patch-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/dubbo-2.7.x-conflict-patch-9.2.0.jar
rename to deploy/skywalking/agent/plugins/dubbo-2.7.x-conflict-patch-9.2.0.jar
diff --git a/skywalking/agent/plugins/dubbo-3.x-conflict-patch-9.2.0.jar b/deploy/skywalking/agent/plugins/dubbo-3.x-conflict-patch-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/dubbo-3.x-conflict-patch-9.2.0.jar
rename to deploy/skywalking/agent/plugins/dubbo-3.x-conflict-patch-9.2.0.jar
diff --git a/skywalking/agent/plugins/dubbo-conflict-patch-9.2.0.jar b/deploy/skywalking/agent/plugins/dubbo-conflict-patch-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/dubbo-conflict-patch-9.2.0.jar
rename to deploy/skywalking/agent/plugins/dubbo-conflict-patch-9.2.0.jar
diff --git a/skywalking/agent/plugins/elasticsearch-common-9.2.0.jar b/deploy/skywalking/agent/plugins/elasticsearch-common-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/elasticsearch-common-9.2.0.jar
rename to deploy/skywalking/agent/plugins/elasticsearch-common-9.2.0.jar
diff --git a/skywalking/agent/plugins/graphql-12.x-15.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/graphql-12.x-15.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/graphql-12.x-15.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/graphql-12.x-15.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/graphql-16plus-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/graphql-16plus-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/graphql-16plus-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/graphql-16plus-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/graphql-8.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/graphql-8.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/graphql-8.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/graphql-8.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/graphql-9.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/graphql-9.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/graphql-9.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/graphql-9.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/jedis-2.x-3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/jedis-2.x-3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/jedis-2.x-3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/jedis-2.x-3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/jedis-4.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/jedis-4.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/jedis-4.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/jedis-4.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/jsonrpc4j-1.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/jsonrpc4j-1.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/jsonrpc4j-1.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/jsonrpc4j-1.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/micronaut-http-client-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/micronaut-http-client-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/micronaut-http-client-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/micronaut-http-client-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/micronaut-http-server-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/micronaut-http-server-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/micronaut-http-server-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/micronaut-http-server-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/motan-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/motan-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/motan-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/motan-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/nats-2.14.x-2.15.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/nats-2.14.x-2.15.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/nats-2.14.x-2.15.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/nats-2.14.x-2.15.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/okhttp-2.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/okhttp-2.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/okhttp-2.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/okhttp-2.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/resteasy-server-3.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/resteasy-server-3.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/resteasy-server-3.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/resteasy-server-3.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/resteasy-server-4.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/resteasy-server-4.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/resteasy-server-4.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/resteasy-server-4.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/resteasy-server-6.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/resteasy-server-6.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/resteasy-server-6.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/resteasy-server-6.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/resttemplate-commons-9.2.0.jar b/deploy/skywalking/agent/plugins/resttemplate-commons-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/resttemplate-commons-9.2.0.jar
rename to deploy/skywalking/agent/plugins/resttemplate-commons-9.2.0.jar
diff --git a/skywalking/agent/plugins/sofa-rpc-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/sofa-rpc-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/sofa-rpc-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/sofa-rpc-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/spring-commons-9.2.0.jar b/deploy/skywalking/agent/plugins/spring-commons-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/spring-commons-9.2.0.jar
rename to deploy/skywalking/agent/plugins/spring-commons-9.2.0.jar
diff --git a/skywalking/agent/plugins/spring-webflux-5.x-webclient-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/spring-webflux-5.x-webclient-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/spring-webflux-5.x-webclient-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/spring-webflux-5.x-webclient-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/spring-webflux-6.x-webclient-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/spring-webflux-6.x-webclient-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/spring-webflux-6.x-webclient-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/spring-webflux-6.x-webclient-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/thrift-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/thrift-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/thrift-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/thrift-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/tomcat-10x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/tomcat-10x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/tomcat-10x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/tomcat-10x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/tomcat-7.x-8.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/tomcat-7.x-8.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/tomcat-7.x-8.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/tomcat-7.x-8.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/plugins/websphere-liberty-23.x-plugin-9.2.0.jar b/deploy/skywalking/agent/plugins/websphere-liberty-23.x-plugin-9.2.0.jar
similarity index 100%
rename from skywalking/agent/plugins/websphere-liberty-23.x-plugin-9.2.0.jar
rename to deploy/skywalking/agent/plugins/websphere-liberty-23.x-plugin-9.2.0.jar
diff --git a/skywalking/agent/skywalking-agent.jar b/deploy/skywalking/agent/skywalking-agent.jar
similarity index 100%
rename from skywalking/agent/skywalking-agent.jar
rename to deploy/skywalking/agent/skywalking-agent.jar
diff --git a/skywalking/ins b/deploy/skywalking/ins
similarity index 100%
rename from skywalking/ins
rename to deploy/skywalking/ins
diff --git a/skywalking/install/elasticsearch/elasticsearch.sh b/deploy/skywalking/install/elasticsearch/elasticsearch.sh
similarity index 100%
rename from skywalking/install/elasticsearch/elasticsearch.sh
rename to deploy/skywalking/install/elasticsearch/elasticsearch.sh
diff --git a/skywalking/install/skywalking-net.sh b/deploy/skywalking/install/skywalking-net.sh
similarity index 100%
rename from skywalking/install/skywalking-net.sh
rename to deploy/skywalking/install/skywalking-net.sh
diff --git a/skywalking/install/skywalking/skywalking-oap.sh b/deploy/skywalking/install/skywalking/skywalking-oap.sh
similarity index 100%
rename from skywalking/install/skywalking/skywalking-oap.sh
rename to deploy/skywalking/install/skywalking/skywalking-oap.sh
diff --git a/skywalking/install/skywalking/skywalking-ui.sh b/deploy/skywalking/install/skywalking/skywalking-ui.sh
similarity index 100%
rename from skywalking/install/skywalking/skywalking-ui.sh
rename to deploy/skywalking/install/skywalking/skywalking-ui.sh
diff --git a/skywalking/show b/deploy/skywalking/show
similarity index 100%
rename from skywalking/show
rename to deploy/skywalking/show
diff --git a/xxl-job/job-admin/config/application.properties b/deploy/xxl-job/job-admin/config/application.properties
similarity index 82%
rename from xxl-job/job-admin/config/application.properties
rename to deploy/xxl-job/job-admin/config/application.properties
index b9e7994..21ba111 100644
--- a/xxl-job/job-admin/config/application.properties
+++ b/deploy/xxl-job/job-admin/config/application.properties
@@ -1,16 +1,16 @@
### web 如果要改变端口和这个访问前缀在此进行更改
### 原端口是8080
-server.port=80
+server.port=8969
### 原请求路径是/xxl-job-admin
server.servlet.context-path=/
### 调度中心JDBC链接:链接地址请保持和 2.1章节 所创建的调度数据库的地址一致
-spring.datasource.url=jdbc:mysql://xxl-mysql:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
+spring.datasource.url=jdbc:mysql://xxl-mysql:3306/cloud-xxl-job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=root
-spring.datasource.driver-class-name=com.mysql.jdbc.Driver
+spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
### 报警邮箱
-spring.mail.host= smtp.163.com
+spring.mail.host=smtp.163.com
spring.mail.port=465
spring.mail.username=dongzl828@163.com
spring.mail.password=EGHEDRZUIZWUIGZY
diff --git a/xxl-job/job-admin/depXXLAdmin.sh b/deploy/xxl-job/job-admin/depXXLAdmin.sh
similarity index 100%
rename from xxl-job/job-admin/depXXLAdmin.sh
rename to deploy/xxl-job/job-admin/depXXLAdmin.sh
diff --git a/xxl-job/mysql/config/my.cnf b/deploy/xxl-job/mysql/config/my.cnf
similarity index 100%
rename from xxl-job/mysql/config/my.cnf
rename to deploy/xxl-job/mysql/config/my.cnf
diff --git a/xxl-job/mysql/depXXLMysql.sh b/deploy/xxl-job/mysql/depXXLMysql.sh
similarity index 100%
rename from xxl-job/mysql/depXXLMysql.sh
rename to deploy/xxl-job/mysql/depXXLMysql.sh
diff --git a/xxl-job/show b/deploy/xxl-job/show
similarity index 100%
rename from xxl-job/show
rename to deploy/xxl-job/show
diff --git a/xxl-job/xxl-net.sh b/deploy/xxl-job/xxl-net.sh
similarity index 100%
rename from xxl-job/xxl-net.sh
rename to deploy/xxl-job/xxl-net.sh
diff --git a/doc/xxl-job/XXL-JOB官方文档.md b/doc/xxl-job/XXL-JOB官方文档.md
new file mode 100644
index 0000000..bb91acc
--- /dev/null
+++ b/doc/xxl-job/XXL-JOB官方文档.md
@@ -0,0 +1,1718 @@
+## 《分布式任务调度平台XXL-JOB》
+## 一、简介
+
+### 1.1 概述
+XXL-JOB是一个分布式任务调度平台,其核心设计目标是开发迅速、学习简单、轻量级、易扩展。现已开放源代码并接入多家公司线上产品线,开箱即用。
+
+### 1.2 特性
+- 1、简单:支持通过Web页面对任务进行CRUD操作,操作简单,一分钟上手;
+- 2、动态:支持动态修改任务状态、启动/停止任务,以及终止运行中任务,即时生效;
+- 3、调度中心HA(中心式):调度采用中心式设计,“调度中心”自研调度组件并支持集群部署,可保证调度中心HA;
+- 4、执行器HA(分布式):任务分布式执行,任务"执行器"支持集群部署,可保证任务执行HA;
+- 5、注册中心: 执行器会周期性自动注册任务, 调度中心将会自动发现注册的任务并触发执行。同时,也支持手动录入执行器地址;
+- 6、弹性扩容缩容:一旦有新执行器机器上线或者下线,下次调度时将会重新分配任务;
+- 7、触发策略:提供丰富的任务触发策略,包括:Cron触发、固定间隔触发、固定延时触发、API(事件)触发、人工触发、父子任务触发;
+- 8、调度过期策略:调度中心错过调度时间的补偿处理策略,包括:忽略、立即补偿触发一次等;
+- 9、阻塞处理策略:调度过于密集执行器来不及处理时的处理策略,策略包括:单机串行(默认)、丢弃后续调度、覆盖之前调度;
+- 10、任务超时控制:支持自定义任务超时时间,任务运行超时将会主动中断任务;
+- 11、任务失败重试:支持自定义任务失败重试次数,当任务失败时将会按照预设的失败重试次数主动进行重试;其中分片任务支持分片粒度的失败重试;
+- 12、任务失败告警;默认提供邮件方式失败告警,同时预留扩展接口,可方便的扩展短信、钉钉等告警方式;
+- 13、路由策略:执行器集群部署时提供丰富的路由策略,包括:第一个、最后一个、轮询、随机、一致性HASH、最不经常使用、最近最久未使用、故障转移、忙碌转移等;
+- 14、分片广播任务:执行器集群部署时,任务路由策略选择"分片广播"情况下,一次任务调度将会广播触发集群中所有执行器执行一次任务,可根据分片参数开发分片任务;
+- 15、动态分片:分片广播任务以执行器为维度进行分片,支持动态扩容执行器集群从而动态增加分片数量,协同进行业务处理;在进行大数据量业务操作时可显著提升任务处理能力和速度。
+- 16、故障转移:任务路由策略选择"故障转移"情况下,如果执行器集群中某一台机器故障,将会自动Failover切换到一台正常的执行器发送调度请求。
+- 17、任务进度监控:支持实时监控任务进度;
+- 18、Rolling实时日志:支持在线查看调度结果,并且支持以Rolling方式实时查看执行器输出的完整的执行日志;
+- 19、GLUE:提供Web IDE,支持在线开发任务逻辑代码,动态发布,实时编译生效,省略部署上线的过程。支持30个版本的历史版本回溯。
+- 20、脚本任务:支持以GLUE模式开发和运行脚本任务,包括Shell、Python、NodeJS、PHP、PowerShell等类型脚本;
+- 21、命令行任务:原生提供通用命令行任务Handler(Bean任务,"CommandJobHandler");业务方只需要提供命令行即可;
+- 22、任务依赖:支持配置子任务依赖,当父任务执行结束且执行成功后将会主动触发一次子任务的执行, 多个子任务用逗号分隔;
+- 23、一致性:“调度中心”通过DB锁保证集群分布式调度的一致性, 一次任务调度只会触发一次执行;
+- 24、自定义任务参数:支持在线配置调度任务入参,即时生效;
+- 25、调度线程池:调度系统多线程触发调度运行,确保调度精确执行,不被堵塞;
+- 26、数据加密:调度中心和执行器之间的通讯进行数据加密,提升调度信息安全性;
+- 27、邮件报警:任务失败时支持邮件报警,支持配置多邮件地址群发报警邮件;
+- 28、推送maven中央仓库: 将会把最新稳定版推送到maven中央仓库, 方便用户接入和使用;
+- 29、运行报表:支持实时查看运行数据,如任务数量、调度次数、执行器数量等;以及调度报表,如调度日期分布图,调度成功分布图等;
+- 30、全异步:任务调度流程全异步化设计实现,如异步调度、异步运行、异步回调等,有效对密集调度进行流量削峰,理论上支持任意时长任务的运行;
+- 31、跨语言:调度中心与执行器提供语言无关的 RESTful API 服务,第三方任意语言可据此对接调度中心或者实现执行器。除此之外,还提供了 “多任务模式”和“httpJobHandler”等其他跨语言方案;
+- 32、国际化:调度中心支持国际化设置,提供中文、英文两种可选语言,默认为中文;
+- 33、容器化:提供官方docker镜像,并实时更新推送dockerhub,进一步实现产品开箱即用;
+- 34、线程池隔离:调度线程池进行隔离拆分,慢任务自动降级进入"Slow"线程池,避免耗尽调度线程,提高系统稳定性;
+- 35、用户管理:支持在线管理系统用户,存在管理员、普通用户两种角色;
+- 36、权限控制:执行器维度进行权限控制,管理员拥有全量权限,普通用户需要分配执行器权限后才允许相关操作;
+
+### 1.5 下载
+
+#### 文档地址
+
+- [中文文档](https://www.xuxueli.com/xxl-job/)
+
+#### 源码仓库地址
+
+源码仓库地址 | Release Download
+--- | ---
+[https://github.com/xuxueli/xxl-job](https://github.com/xuxueli/xxl-job) | [Download](https://github.com/xuxueli/xxl-job/releases)
+[http://gitee.com/xuxueli0323/xxl-job](http://gitee.com/xuxueli0323/xxl-job) | [Download](http://gitee.com/xuxueli0323/xxl-job/releases)
+[https://gitcode.com/xuxueli0323/xxl-job](https://gitcode.com/xuxueli0323/xxl-job) | [Download](https://gitcode.com/xuxueli0323/xxl-job/tags)
+
+
+#### 中央仓库地址
+
+```
+
+
+ com.xuxueli
+ xxl-job-core
+ ${最新稳定版本}
+
+```
+
+
+### 1.6 环境
+- Maven3+
+- Jdk1.8+
+- Mysql8.0+
+
+
+## 二、快速入门
+
+### 2.1 初始化“调度数据库”
+请下载项目源码并解压,获取 "调度数据库初始化SQL脚本" 并执行即可。
+
+"调度数据库初始化SQL脚本" 位置为:
+
+ /xxl-job/doc/db/tables_xxl_job.sql
+
+调度中心支持集群部署,集群情况下各节点务必连接同一个mysql实例;
+
+如果mysql做主从,调度中心集群节点务必强制走主库;
+
+### 2.2 编译源码
+解压源码,按照maven格式将源码导入IDE, 使用maven进行编译即可,源码结构如下:
+
+ xxl-job-admin:调度中心
+ xxl-job-core:公共依赖
+ xxl-job-executor-samples:执行器Sample示例(选择合适的版本执行器,可直接使用,也可以参考其并将现有项目改造成执行器)
+ :xxl-job-executor-sample-springboot:Springboot版本,通过Springboot管理执行器,推荐这种方式;
+ :xxl-job-executor-sample-frameless:无框架版本;
+
+
+### 2.3 配置部署“调度中心”
+
+ 调度中心项目:xxl-job-admin
+ 作用:统一管理任务调度平台上调度任务,负责触发调度执行,并且提供任务管理平台。
+
+#### 步骤一:调度中心配置:
+调度中心配置文件地址:
+
+ /xxl-job/xxl-job-admin/src/main/resources/application.properties
+
+
+调度中心配置内容说明:
+
+ ### 调度中心JDBC链接:链接地址请保持和 2.1章节 所创建的调度数据库的地址一致
+ spring.datasource.url=jdbc:mysql://127.0.0.1:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
+ spring.datasource.username=root
+ spring.datasource.password=root_pwd
+ spring.datasource.driver-class-name=com.mysql.jdbc.Driver
+
+ ### 报警邮箱
+ spring.mail.host=smtp.qq.com
+ spring.mail.port=25
+ spring.mail.username=xxx@qq.com
+ spring.mail.password=xxx
+ spring.mail.properties.mail.smtp.auth=true
+ spring.mail.properties.mail.smtp.starttls.enable=true
+ spring.mail.properties.mail.smtp.starttls.required=true
+ spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
+
+ ### 调度中心通讯TOKEN [选填]:非空时启用;
+ xxl.job.accessToken=
+
+ ### 调度中心国际化配置 [必填]: 默认为 "zh_CN"/中文简体, 可选范围为 "zh_CN"/中文简体, "zh_TC"/中文繁体 and "en"/英文;
+ xxl.job.i18n=zh_CN
+
+ ## 调度线程池最大线程配置【必填】
+ xxl.job.triggerpool.fast.max=200
+ xxl.job.triggerpool.slow.max=100
+
+ ### 调度中心日志表数据保存天数 [必填]:过期日志自动清理;限制大于等于7时生效,否则, 如-1,关闭自动清理功能;
+ xxl.job.logretentiondays=30
+
+
+
+#### 步骤二:部署项目:
+如果已经正确进行上述配置,可将项目编译打包部署。
+
+调度中心访问地址:http://localhost:8080/xxl-job-admin (该地址执行器将会使用到,作为回调地址)
+
+默认登录账号 "admin/123456", 登录后运行界面如下图所示。
+
+
+
+至此“调度中心”项目已经部署成功。
+
+#### 步骤三:调度中心集群(可选):
+调度中心支持集群部署,提升调度系统容灾和可用性。
+
+调度中心集群部署时,几点要求和建议:
+- DB配置保持一致;
+- 集群机器时钟保持一致(单机集群忽视);
+- 建议:推荐通过nginx为调度中心集群做负载均衡,分配域名。调度中心访问、执行器回调配置、调用API服务等操作均通过该域名进行。
+
+
+#### 其他:Docker 镜像方式搭建调度中心:
+
+- 下载镜像
+
+```
+// Docker地址:https://hub.docker.com/r/xuxueli/xxl-job-admin/ (建议指定版本号)
+docker pull xuxueli/xxl-job-admin
+```
+
+- 创建容器并运行
+
+```
+/**
+* 如需自定义 mysql 等配置,可通过 "-e PARAMS" 指定,参数格式 PARAMS="--key=value --key2=value2" ;
+* 配置项参考文件:/xxl-job/xxl-job-admin/src/main/resources/application.properties
+* 如需自定义 JVM内存参数 等配置,可通过 "-e JAVA_OPTS" 指定,参数格式 JAVA_OPTS="-Xmx512m" ;
+*/
+docker run -e PARAMS="--spring.datasource.url=jdbc:mysql://127.0.0.1:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai" -p 8080:8080 -v /tmp:/data/applogs --name xxl-job-admin -d xuxueli/xxl-job-admin:{指定版本}
+```
+
+
+### 2.4 配置部署“执行器项目”
+
+ “执行器”项目:xxl-job-executor-sample-springboot (提供多种版本执行器供选择,现以 springboot 版本为例,可直接使用,也可以参考其并将现有项目改造成执行器)
+ 作用:负责接收“调度中心”的调度并执行;可直接部署执行器,也可以将执行器集成到现有业务项目中。
+
+#### 步骤一:maven依赖
+确认pom文件中引入了 "xxl-job-core" 的maven依赖;
+
+#### 步骤二:执行器配置
+执行器配置,配置文件地址:
+
+ /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/resources/application.properties
+
+执行器配置,配置内容说明:
+
+ ### 调度中心部署根地址 [选填]:如调度中心集群部署存在多个地址则用逗号分隔。执行器将会使用该地址进行"执行器心跳注册"和"任务结果回调";为空则关闭自动注册;
+ xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin
+
+ ### 执行器通讯TOKEN [选填]:非空时启用;
+ xxl.job.accessToken=
+
+ ### 执行器AppName [选填]:执行器心跳注册分组依据;为空则关闭自动注册
+ xxl.job.executor.appname=xxl-job-executor-sample
+ ### 执行器注册 [选填]:优先使用该配置作为注册地址,为空时使用内嵌服务 ”IP:PORT“ 作为注册地址。从而更灵活的支持容器类型执行器动态IP和动态映射端口问题。
+ xxl.job.executor.address=
+ ### 执行器IP [选填]:默认为空表示自动获取IP,多网卡时可手动设置指定IP,该IP不会绑定Host仅作为通讯实用;地址信息用于 "执行器注册" 和 "调度中心请求并触发任务";
+ xxl.job.executor.ip=
+ ### 执行器端口号 [选填]:小于等于0则自动获取;默认端口为9999,单机部署多个执行器时,注意要配置不同执行器端口;
+ xxl.job.executor.port=9999
+ ### 执行器运行日志文件存储磁盘路径 [选填] :需要对该路径拥有读写权限;为空则使用默认路径;
+ xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler
+ ### 执行器日志文件保存天数 [选填] : 过期日志自动清理, 限制值大于等于3时生效; 否则, 如-1, 关闭自动清理功能;
+ xxl.job.executor.logretentiondays=30
+
+
+#### 步骤三:执行器组件配置
+
+执行器组件,配置文件地址:
+
+ /xxl-job/xxl-job-executor-samples/xxl-job-executor-sample-springboot/src/main/java/com/xxl/job/executor/core/config/XxlJobConfig.java
+
+执行器组件,配置内容说明:
+
+```
+@Bean
+public XxlJobSpringExecutor xxlJobExecutor() {
+ logger.info(">>>>>>>>>>> xxl-job config init.");
+ XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
+ xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
+ xxlJobSpringExecutor.setAppname(appname);
+ xxlJobSpringExecutor.setIp(ip);
+ xxlJobSpringExecutor.setPort(port);
+ xxlJobSpringExecutor.setAccessToken(accessToken);
+ xxlJobSpringExecutor.setLogPath(logPath);
+ xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
+
+ return xxlJobSpringExecutor;
+}
+```
+
+#### 步骤四:部署执行器项目:
+如果已经正确进行上述配置,可将执行器项目编译打部署,系统提供多种执行器Sample示例项目,选择其中一个即可,各自的部署方式如下。
+
+ xxl-job-executor-sample-springboot:项目编译打包成springboot类型的可执行JAR包,命令启动即可;
+ xxl-job-executor-sample-frameless:项目编译打包成JAR包,命令启动即可;
+
+
+至此“执行器”项目已经部署结束。
+
+#### 步骤五:执行器集群(可选):
+执行器支持集群部署,提升调度系统可用性,同时提升任务处理能力。
+
+执行器集群部署时,几点要求和建议:
+- 执行器回调地址(xxl.job.admin.addresses)需要保持一致;执行器根据该配置进行执行器自动注册等操作。
+- 同一个执行器集群内AppName(xxl.job.executor.appname)需要保持一致;调度中心根据该配置动态发现不同集群的在线执行器列表。
+
+
+### 2.5 开发第一个任务“Hello World”
+本示例以新建一个 “GLUE模式(Java)” 运行模式的任务为例。更多有关任务的详细配置,请查看“章节三:任务详解”。
+( “GLUE模式(Java)”的执行代码托管到调度中心在线维护,相比“Bean模式任务”需要在执行器项目开发部署上线,更加简便轻量)
+
+> 前提:请确认“调度中心”和“执行器”项目已经成功部署并启动;
+
+#### 步骤一:新建任务:
+登录调度中心,点击下图所示“新建任务”按钮,新建示例任务。然后,参考下面截图中任务的参数配置,点击保存。
+
+
+
+
+
+
+#### 步骤二:“GLUE模式(Java)” 任务开发:
+请点击任务右侧 “GLUE” 按钮,进入 “GLUE编辑器开发界面” ,见下图。“GLUE模式(Java)” 运行模式的任务默认已经初始化了示例任务代码,即打印Hello World。
+( “GLUE模式(Java)” 运行模式的任务实际上是一段继承自IJobHandler的Java类代码,它在执行器项目中运行,可使用@Resource/@Autowire注入执行器里中的其他服务,详细介绍请查看第三章节)
+
+
+
+
+
+#### 步骤三:触发执行:
+请点击任务右侧 “执行” 按钮,可手动触发一次任务执行(通常情况下,通过配置Cron表达式进行任务调度触发)。
+
+#### 步骤四:查看日志:
+请点击任务右侧 “日志” 按钮,可前往任务日志界面查看任务日志。
+在任务日志界面中,可查看该任务的历史调度记录以及每一次调度的任务调度信息、执行参数和执行信息。运行中的任务点击右侧的“执行日志”按钮,可进入日志控制台查看实时执行日志。
+
+
+
+在日志控制台,可以Rolling方式实时查看任务在执行器一侧运行输出的日志信息,实时监控任务进度;
+
+
+
+## 三、任务详解
+
+### 配置属性详细说明:
+
+ 基础配置:
+ - 执行器:任务的绑定的执行器,任务触发调度时将会自动发现注册成功的执行器, 实现任务自动发现功能; 另一方面也可以方便的进行任务分组。每个任务必须绑定一个执行器, 可在 "执行器管理" 进行设置;
+ - 任务描述:任务的描述信息,便于任务管理;
+ - 负责人:任务的负责人;
+ - 报警邮件:任务调度失败时邮件通知的邮箱地址,支持配置多邮箱地址,配置多个邮箱地址时用逗号分隔;
+
+ 触发配置:
+ - 调度类型:
+ 无:该类型不会主动触发调度;
+ CRON:该类型将会通过CRON,触发任务调度;
+ 固定速度:该类型将会以固定速度,触发任务调度;按照固定的间隔时间,周期性触发;
+ 固定延迟:该类型将会以固定延迟,触发任务调度;按照固定的延迟时间,从上次调度结束后开始计算延迟时间,到达延迟时间后触发下次调度;
+ - CRON:触发任务执行的Cron表达式;
+ - 固定速度:固定速度的时间间隔,单位为秒;
+ - 固定延迟:固定延迟的时间间隔,单位为秒;
+
+ 任务配置:
+ - 运行模式:
+ BEAN模式:任务以JobHandler方式维护在执行器端;需要结合 "JobHandler" 属性匹配执行器中任务;
+ GLUE模式(Java):任务以源码方式维护在调度中心;该模式的任务实际上是一段继承自IJobHandler的Java类代码并 "groovy" 源码方式维护,它在执行器项目中运行,可使用@Resource/@Autowire注入执行器里中的其他服务;
+ GLUE模式(Shell):任务以源码方式维护在调度中心;该模式的任务实际上是一段 "shell" 脚本;
+ GLUE模式(Python):任务以源码方式维护在调度中心;该模式的任务实际上是一段 "python" 脚本;
+ GLUE模式(PHP):任务以源码方式维护在调度中心;该模式的任务实际上是一段 "php" 脚本;
+ GLUE模式(NodeJS):任务以源码方式维护在调度中心;该模式的任务实际上是一段 "nodejs" 脚本;
+ GLUE模式(PowerShell):任务以源码方式维护在调度中心;该模式的任务实际上是一段 "PowerShell" 脚本;
+ - JobHandler:运行模式为 "BEAN模式" 时生效,对应执行器中新开发的JobHandler类“@XxlJob”注解自定义的value值;
+ - 执行参数:任务执行所需的参数;
+
+ 高级配置:
+ - 路由策略:当执行器集群部署时,提供丰富的路由策略,包括;
+ FIRST(第一个):固定选择第一个机器;
+ LAST(最后一个):固定选择最后一个机器;
+ ROUND(轮询):;
+ RANDOM(随机):随机选择在线的机器;
+ CONSISTENT_HASH(一致性HASH):每个任务按照Hash算法固定选择某一台机器,且所有任务均匀散列在不同机器上。
+ LEAST_FREQUENTLY_USED(最不经常使用):使用频率最低的机器优先被选举;
+ LEAST_RECENTLY_USED(最近最久未使用):最久未使用的机器优先被选举;
+ FAILOVER(故障转移):按照顺序依次进行心跳检测,第一个心跳检测成功的机器选定为目标执行器并发起调度;
+ BUSYOVER(忙碌转移):按照顺序依次进行空闲检测,第一个空闲检测成功的机器选定为目标执行器并发起调度;
+ SHARDING_BROADCAST(分片广播):广播触发对应集群中所有机器执行一次任务,同时系统自动传递分片参数;可根据分片参数开发分片任务;
+ - 子任务:每个任务都拥有一个唯一的任务ID(任务ID可以从任务列表获取),当本任务执行结束并且执行成功时,将会触发子任务ID所对应的任务的一次主动调度。
+ - 调度过期策略:
+ - 忽略:调度过期后,忽略过期的任务,从当前时间开始重新计算下次触发时间;
+ - 立即执行一次:调度过期后,立即执行一次,并从当前时间开始重新计算下次触发时间;
+ - 阻塞处理策略:调度过于密集执行器来不及处理时的处理策略;
+ 单机串行(默认):调度请求进入单机执行器后,调度请求进入FIFO队列并以串行方式运行;
+ 丢弃后续调度:调度请求进入单机执行器后,发现执行器存在运行的调度任务,本次请求将会被丢弃并标记为失败;
+ 覆盖之前调度:调度请求进入单机执行器后,发现执行器存在运行的调度任务,将会终止运行中的调度任务并清空队列,然后运行本地调度任务;
+ - 任务超时时间:支持自定义任务超时时间,任务运行超时将会主动中断任务;
+ - 失败重试次数;支持自定义任务失败重试次数,当任务失败时将会按照预设的失败重试次数主动进行重试;
+
+
+
+
+
+### 3.1 BEAN模式(类形式)
+
+Bean模式任务,支持基于类的开发方式,每个任务对应一个Java类。
+
+- 优点:不限制项目环境,兼容性好。即使是无框架项目,如main方法直接启动的项目也可以提供支持,可以参考示例项目 "xxl-job-executor-sample-frameless";
+- 缺点:
+ - 每个任务需要占用一个Java类,造成类的浪费;
+ - 不支持自动扫描任务并注入到执行器容器,需要手动注入。
+
+#### 步骤一:执行器项目中,开发Job类:
+
+ 1、开发一个继承自"com.xxl.job.core.handler.IJobHandler"的JobHandler类,实现其中任务方法。
+ 2、手动通过如下方式注入到执行器容器。
+ ```
+ XxlJobExecutor.registJobHandler("demoJobHandler", new DemoJobHandler());
+ ```
+
+#### 步骤二:调度中心,新建调度任务
+后续步骤和 "3.2 BEAN模式(方法形式)"一致,可以前往参考。
+
+
+### 3.2 BEAN模式(方法形式)
+
+Bean模式任务,支持基于方法的开发方式,每个任务对应一个方法。
+
+- 优点:
+ - 每个任务只需要开发一个方法,并添加"@XxlJob"注解即可,更加方便、快速。
+ - 支持自动扫描任务并注入到执行器容器。
+- 缺点:略。
+
+>基于方法开发的任务,底层会生成JobHandler代理,和基于类的方式一样,任务也会以JobHandler的形式存在于执行器任务容器中。
+
+#### 步骤一:执行器项目中,开发Job方法:
+
+ 1、任务开发:在Spring Bean实例中,开发Job方法;
+ 2、注解配置:为Job方法添加注解 "@XxlJob(value="自定义jobhandler名称", init = "JobHandler初始化方法", destroy = "JobHandler销毁方法")",注解value值对应的是调度中心新建任务的JobHandler属性的值。
+ 3、执行日志:需要通过 "XxlJobHelper.log" 打印执行日志;
+ 4、任务结果:默认任务结果为 "成功" 状态,不需要主动设置;如有诉求,比如设置任务结果为失败,可以通过 "XxlJobHelper.handleFail/handleSuccess" 自主设置任务结果;
+
+```
+// 可参考Sample示例执行器中的 "com.xxl.job.executor.service.jobhandler.SampleXxlJob" ,如下:
+@XxlJob("demoJobHandler")
+public void demoJobHandler() throws Exception {
+ XxlJobHelper.log("XXL-JOB, Hello World.");
+}
+```
+
+#### 步骤二:调度中心,新建调度任务
+参考上文“配置属性详细说明”对新建的任务进行参数配置,运行模式选中 "BEAN模式",JobHandler属性填写任务注解“@XxlJob”中定义的值;
+
+
+
+#### 原生内置Bean模式任务
+为方便用户参考与快速实用,示例执行器内原生提供多个Bean模式任务Handler,可以直接配置实用,如下:
+
+- demoJobHandler:简单示例任务,任务内部模拟耗时任务逻辑,用户可在线体验Rolling Log等功能;
+- shardingJobHandler:分片示例任务,任务内部模拟处理分片参数,可参考熟悉分片任务;
+- httpJobHandler:通用HTTP任务Handler;业务方只需要提供HTTP链接等信息即可,不限制语言、平台。示例任务入参如下:
+ ```
+ url: http://www.xxx.com
+ method: get 或 post
+ data: post-data
+ ```
+- commandJobHandler:通用命令行任务Handler;业务方只需要提供命令行即可;如 “pwd”命令;
+
+
+### 3.3 GLUE模式(Java)
+任务以源码方式维护在调度中心,支持通过Web IDE在线更新,实时编译和生效,因此不需要指定JobHandler。开发流程如下:
+
+#### 步骤一:调度中心,新建调度任务:
+参考上文“配置属性详细说明”对新建的任务进行参数配置,运行模式选中 "GLUE模式(Java)";
+
+
+
+#### 步骤二:开发任务代码:
+选中指定任务,点击该任务右侧“GLUE”按钮,将会前往GLUE任务的Web IDE界面,在该界面支持对任务代码进行开发(也可以在IDE中开发完成后,复制粘贴到编辑中)。
+
+版本回溯功能(支持30个版本的版本回溯):在GLUE任务的Web IDE界面,选择右上角下拉框“版本回溯”,会列出该GLUE的更新历史,选择相应版本即可显示该版本代码,保存后GLUE代码即回退到对应的历史版本;
+
+
+
+### 3.4 GLUE模式(Shell)
+
+#### 步骤一:调度中心,新建调度任务
+参考上文“配置属性详细说明”对新建的任务进行参数配置,运行模式选中 "GLUE模式(Shell)";
+
+#### 步骤二:开发任务代码:
+选中指定任务,点击该任务右侧“GLUE”按钮,将会前往GLUE任务的Web IDE界面,在该界面支持对任务代码进行开发(也可以在IDE中开发完成后,复制粘贴到编辑中)。
+
+该模式的任务实际上是一段 "shell" 脚本;
+
+
+
+### 3.4 GLUE模式(Python)
+
+#### 步骤一:调度中心,新建调度任务
+参考上文“配置属性详细说明”对新建的任务进行参数配置,运行模式选中 "GLUE模式(Python)";
+
+#### 步骤二:开发任务代码:
+选中指定任务,点击该任务右侧“GLUE”按钮,将会前往GLUE任务的Web IDE界面,在该界面支持对任务代码进行开发(也可以在IDE中开发完成后,复制粘贴到编辑中)。
+
+该模式的任务实际上是一段 "python" 脚本;
+
+
+
+### 3.5 GLUE模式(NodeJS)
+
+#### 步骤一:调度中心,新建调度任务
+参考上文“配置属性详细说明”对新建的任务进行参数配置,运行模式选中 "GLUE模式(NodeJS)";
+
+#### 步骤二:开发任务代码:
+选中指定任务,点击该任务右侧“GLUE”按钮,将会前往GLUE任务的Web IDE界面,在该界面支持对任务代码进行开发(也可以在IDE中开发完成后,复制粘贴到编辑中)。
+
+该模式的任务实际上是一段 "nodeJS" 脚本;
+
+### 3.6 GLUE模式(PHP)
+同上
+
+### 3.7 GLUE模式(PowerShell)
+同上
+
+
+
+## 四、操作指南
+
+### 4.1 配置执行器
+点击进入"执行器管理"界面, 如下图:
+
+
+ 1、"调度中心OnLine:"右侧显示在线的"调度中心"列表, 任务执行结束后, 将会以failover的模式进行回调调度中心通知执行结果, 避免回调的单点风险;
+ 2、"执行器列表" 中显示在线的执行器列表, 可通过"OnLine 机器"查看对应执行器的集群机器。
+
+点击按钮 "+新增执行器" 弹框如下图, 可新增执行器配置:
+
+
+
+执行器属性说明
+
+ AppName: 是每个执行器集群的唯一标示AppName, 执行器会周期性以AppName为对象进行自动注册。可通过该配置自动发现注册成功的执行器, 供任务调度时使用;
+ 名称: 执行器的名称, 因为AppName限制字母数字等组成,可读性不强, 名称为了提高执行器的可读性;
+ 排序: 执行器的排序, 系统中需要执行器的地方,如任务新增, 将会按照该排序读取可用的执行器列表;
+ 注册方式:调度中心获取执行器地址的方式;
+ 自动注册:执行器自动进行执行器注册,调度中心通过底层注册表可以动态发现执行器机器地址;
+ 手动录入:人工手动录入执行器的地址信息,多地址逗号分隔,供调度中心使用;
+ 机器地址:"注册方式"为"手动录入"时有效,支持人工维护执行器的地址信息;
+
+### 4.2 新建任务
+进入任务管理界面,点击“新增任务”按钮,在弹出的“新增任务”界面配置任务属性后保存即可。详情页参考章节 "三、任务详解"。
+
+### 4.3 编辑任务
+进入任务管理界面,选中指定任务。点击该任务右侧“编辑”按钮,在弹出的“编辑任务”界面更新任务属性后保存即可,可以修改设置的任务属性信息:
+
+### 4.4 编辑GLUE代码
+
+该操作仅针对GLUE任务。
+
+选中指定任务,点击该任务右侧“GLUE”按钮,将会前往GLUE任务的Web IDE界面,在该界面支持对任务代码进行开发。可参考章节 "3.3 GLUE模式(Java)"。
+
+### 4.5 启动/停止任务
+可对任务进行“启动”和“停止”操作。
+需要注意的是,此处的启动/停止仅针对任务的后续调度触发行为,不会影响到已经触发的调度任务,如需终止已经触发的调度任务,可查看“4.9 终止运行中的任务”
+
+
+
+### 4.6 手动触发一次调度
+点击“执行”按钮,可手动触发一次任务调度,不影响原有调度规则。
+
+
+
+### 4.7 查看调度日志
+点击“日志”按钮,可以查看任务历史调度日志。在历史调入日志界面可查看每次任务调度的调度结果、执行结果等,点击“执行日志”按钮可查看执行器完整日志。
+
+
+
+
+
+ 调度时间:"调度中心"触发本次调度并向"执行器"发送任务执行信号的时间;
+ 调度结果:"调度中心"触发本次调度的结果,200表示成功,500或其他表示失败;
+ 调度备注:"调度中心"触发本次调度的日志信息;
+ 执行器地址:本次任务执行的机器地址
+ 运行模式:触发调度时任务的运行模式,运行模式可参考章节 "三、任务详解";
+ 任务参数:本地任务执行的入参
+ 执行时间:"执行器"中本次任务执行结束后回调的时间;
+ 执行结果:"执行器"中本次任务执行的结果,200表示成功,500或其他表示失败;
+ 执行备注:"执行器"中本次任务执行的日志信息;
+ 操作:
+ "执行日志"按钮:点击可查看本地任务执行的详细日志信息;详见“4.8 查看执行日志”;
+ "终止任务"按钮:点击可终止本地调度对应执行器上本任务的执行线程,包括未执行的阻塞任务一并被终止;
+
+### 4.8 查看执行日志
+点击执行日志右侧的 “执行日志” 按钮,可跳转至执行日志界面,可以查看业务代码中打印的完整日志,如下图;
+
+
+
+### 4.9 终止运行中的任务
+仅针对执行中的任务。
+在任务日志界面,点击右侧的“终止任务”按钮,将会向本次任务对应的执行器发送任务终止请求,将会终止掉本次任务,同时会清空掉整个任务执行队列。
+
+
+
+任务终止时通过 "interrupt" 执行线程的方式实现, 将会触发 "InterruptedException" 异常。因此如果JobHandler内部catch到了该异常并消化掉的话, 任务终止功能将不可用。
+
+因此, 如果遇到上述任务终止不可用的情况, 需要在JobHandler中应该针对 "InterruptedException" 异常进行特殊处理 (向上抛出) , 正确逻辑如下:
+```
+try{
+ // do something
+} catch (Exception e) {
+ if (e instanceof InterruptedException) {
+ throw e;
+ }
+ logger.warn("{}", e);
+}
+```
+
+而且,在JobHandler中开启子线程时,子线程也不可catch处理"InterruptedException",应该主动向上抛出。
+
+任务终止时会执行对应JobHandler的"destroy()"方法,可以借助该方法处理一些资源回收的逻辑。
+
+
+### 4.10 删除执行日志
+在任务日志界面,选中执行器和任务之后,点击右侧的"删除"按钮将会出现"日志清理"弹框,弹框中支持选择不同类型的日志清理策略,选中后点击"确定"按钮即可进行日志清理操作;
+
+
+
+
+### 4.11 删除任务
+点击删除按钮,可以删除对应任务。
+
+
+
+### 4.12 用户管理
+进入 "用户管理" 界面,可查看和管理用户信息;
+
+目前用户分为两种角色:
+- 管理员:拥有全量权限,支持在线管理用户信息,为用户分配权限,权限分配粒度为执行器;
+- 普通用户:仅拥有被分配权限的执行器,及相关任务的操作权限;
+
+
+
+
+
+
+## 五、总体设计
+### 5.1 源码目录介绍
+ - /doc :文档资料
+ - /db :“调度数据库”建表脚本
+ - /xxl-job-admin :调度中心,项目源码
+ - /xxl-job-core :公共Jar依赖
+ - /xxl-job-executor-samples :执行器,Sample示例项目(大家可以在该项目上进行开发,也可以将现有项目改造生成执行器项目)
+
+### 5.2 “调度数据库”配置
+XXL-JOB调度模块基于自研调度组件并支持集群部署,调度数据库表说明如下:
+
+ - xxl_job_lock:任务调度锁表;
+ - xxl_job_group:执行器信息表,维护任务执行器信息;
+ - xxl_job_info:调度扩展信息表: 用于保存XXL-JOB调度任务的扩展信息,如任务分组、任务名、机器地址、执行器、执行入参和报警邮件等等;
+ - xxl_job_log:调度日志表: 用于保存XXL-JOB任务调度的历史信息,如调度结果、执行结果、调度入参、调度机器和执行器等等;
+ - xxl_job_log_report:调度日志报表:用户存储XXL-JOB任务调度日志的报表,调度中心报表功能页面会用到;
+ - xxl_job_logglue:任务GLUE日志:用于保存GLUE更新历史,用于支持GLUE的版本回溯功能;
+ - xxl_job_registry:执行器注册表,维护在线的执行器和调度中心机器地址信息;
+ - xxl_job_user:系统用户表;
+
+
+### 5.3 架构设计
+#### 5.3.1 设计思想
+将调度行为抽象形成“调度中心”公共平台,而平台自身并不承担业务逻辑,“调度中心”负责发起调度请求。
+
+将任务抽象成分散的JobHandler,交由“执行器”统一管理,“执行器”负责接收调度请求并执行对应的JobHandler中业务逻辑。
+
+因此,“调度”和“任务”两部分可以相互解耦,提高系统整体稳定性和扩展性;
+
+#### 5.3.2 系统组成
+- **调度模块(调度中心)**:
+ 负责管理调度信息,按照调度配置发出调度请求,自身不承担业务代码。调度系统与任务解耦,提高了系统可用性和稳定性,同时调度系统性能不再受限于任务模块;
+ 支持可视化、简单且动态的管理调度信息,包括任务新建,更新,删除,GLUE开发和任务报警等,所有上述操作都会实时生效,同时支持监控调度结果以及执行日志,支持执行器Failover。
+- **执行模块(执行器)**:
+ 负责接收调度请求并执行任务逻辑。任务模块专注于任务的执行等操作,开发和维护更加简单和高效;
+ 接收“调度中心”的执行请求、终止请求和日志请求等。
+
+#### 5.3.3 架构图
+
+
+
+### 5.4 调度模块剖析
+#### 5.4.1 quartz的不足
+Quartz作为开源作业调度中的佼佼者,是作业调度的首选。但是集群环境中Quartz采用API的方式对任务进行管理,从而可以避免上述问题,但是同样存在以下问题:
+
+- 问题一:调用API的的方式操作任务,不人性化;
+- 问题二:需要持久化业务QuartzJobBean到底层数据表中,系统侵入性相当严重。
+- 问题三:调度逻辑和QuartzJobBean耦合在同一个项目中,这将导致一个问题,在调度任务数量逐渐增多,同时调度任务逻辑逐渐加重的情况下,此时调度系统的性能将大大受限于业务;
+- 问题四:quartz底层以“抢占式”获取DB锁并由抢占成功节点负责运行任务,会导致节点负载悬殊非常大;而XXL-JOB通过执行器实现“协同分配式”运行任务,充分发挥集群优势,负载各节点均衡。
+
+XXL-JOB弥补了quartz的上述不足之处。
+
+#### 5.4.2 自研调度模块
+XXL-JOB最终选择自研调度组件(早期调度组件基于Quartz);一方面是为了精简系统降低冗余依赖,另一方面是为了提供系统的可控度与稳定性;
+
+XXL-JOB中“调度模块”和“任务模块”完全解耦,调度模块进行任务调度时,将会解析不同的任务参数发起远程调用,调用各自的远程执行器服务。这种调用模型类似RPC调用,调度中心提供调用代理的功能,而执行器提供远程服务的功能。
+
+#### 5.4.3 调度中心HA(集群)
+基于数据库的集群方案,数据库选用Mysql;集群分布式并发环境中进行定时任务调度时,会在各个节点会上报任务,存到数据库中,执行时会从数据库中取出触发器来执行,如果触发器的名称和执行时间相同,则只有一个节点去执行此任务。
+
+#### 5.4.4 调度线程池
+调度采用线程池方式实现,避免单线程因阻塞而引起任务调度延迟。
+
+#### 5.4.5 并行调度
+XXL-JOB调度模块默认采用并行机制,在多线程调度的情况下,调度模块被阻塞的几率很低,大大提高了调度系统的承载量。
+
+XXL-JOB的不同任务之间并行调度、并行执行。
+XXL-JOB的单个任务,针对多个执行器是并行运行的,针对单个执行器是串行执行的。同时支持任务终止。
+
+#### 5.4.6 过期处理策略
+任务调度错过触发时间时的处理策略:
+- 可能原因:服务重启;调度线程被阻塞,线程被耗尽;上次调度持续阻塞,下次调度被错过;
+- 处理策略:
+ - 过期超5s:本次忽略,当前时间开始计算下次触发时间
+ - 过期5s内:立即触发一次,当前时间开始计算下次触发时间
+
+
+#### 5.4.7 日志回调服务
+调度模块的“调度中心”作为Web服务部署时,一方面承担调度中心功能,另一方面也为执行器提供API服务。
+
+调度中心提供的"日志回调服务API服务"代码位置如下:
+```
+xxl-job-admin#com.xxl.job.admin.controller.JobApiController.callback
+```
+
+“执行器”在接收到任务执行请求后,执行任务,在执行结束之后会将执行结果回调通知“调度中心”:
+
+#### 5.4.8 任务HA(Failover)
+执行器如若集群部署,调度中心将会感知到在线的所有执行器,如“127.0.0.1:9997, 127.0.0.1:9998, 127.0.0.1:9999”。
+
+当任务"路由策略"选择"故障转移(FAILOVER)"时,当调度中心每次发起调度请求时,会按照顺序对执行器发出心跳检测请求,第一个检测为存活状态的执行器将会被选定并发送调度请求。
+
+调度成功后,可在日志监控界面查看“调度备注”,如下;
+
+
+“调度备注”可以看出本地调度运行轨迹,执行器的"注册方式"、"地址列表"和任务的"路由策略"。"故障转移(FAILOVER)"路由策略下,调度中心首先对第一个地址进行心跳检测,心跳失败因此自动跳过,第二个依然心跳检测失败……
+直至心跳检测第三个地址“127.0.0.1:9999”成功,选定为“目标执行器”;然后对“目标执行器”发送调度请求,调度流程结束,等待执行器回调执行结果。
+
+#### 5.4.9 调度日志
+调度中心每次进行任务调度,都会记录一条任务日志,任务日志主要包括以下三部分内容:
+
+- 任务信息:包括“执行器地址”、“JobHandler”和“执行参数”等属性,点击任务ID按钮可查看,根据这些参数,可以精确的定位任务执行的具体机器和任务代码;
+- 调度信息:包括“调度时间”、“调度结果”和“调度日志”等,根据这些参数,可以了解“调度中心”发起调度请求时具体情况。
+- 执行信息:包括“执行时间”、“执行结果”和“执行日志”等,根据这些参数,可以了解在“执行器”端任务执行的具体情况;
+
+调度日志,针对单次调度,属性说明如下:
+- 执行器地址:任务执行的机器地址;
+- JobHandler:Bean模式表示任务执行的JobHandler名称;
+- 任务参数:任务执行的入参;
+- 调度时间:调度中心,发起调度的时间;
+- 调度结果:调度中心,发起调度的结果,SUCCESS或FAIL;
+- 调度备注:调度中心,发起调度的备注信息,如地址心跳检测日志等;
+- 执行时间:执行器,任务执行结束后回调的时间;
+- 执行结果:执行器,任务执行的结果,SUCCESS或FAIL;
+- 执行备注:执行器,任务执行的备注信息,如异常日志等;
+- 执行日志:任务执行过程中,业务代码中打印的完整执行日志,见“4.8 查看执行日志”;
+
+#### 5.4.10 任务依赖
+原理:XXL-JOB中每个任务都对应有一个任务ID,同时,每个任务支持设置属性“子任务ID”,因此,通过“任务ID”可以匹配任务依赖关系。
+
+当父任务执行结束并且执行成功时,将会根据“子任务ID”匹配子任务依赖,如果匹配到子任务,将会主动触发一次子任务的执行。
+
+在任务日志界面,点击任务的“执行备注”的“查看”按钮,可以看到匹配子任务以及触发子任务执行的日志信息,如无信息则表示未触发子任务执行,可参考下图。
+
+
+
+
+
+#### 5.4.11 全异步化 & 轻量级
+
+- 全异步化设计:XXL-JOB系统中业务逻辑在远程执行器执行,触发流程全异步化设计。相比直接在调度中心内部执行业务逻辑,极大的降低了调度线程占用时间;
+ - 异步调度:调度中心每次任务触发时仅发送一次调度请求,该调度请求首先推送“异步调度队列”,然后异步推送给远程执行器
+ - 异步执行:执行器会将请求存入“异步执行队列”并且立即响应调度中心,异步运行。
+- 轻量级设计:XXL-JOB调度中心中每个JOB逻辑非常 “轻”,在全异步化的基础上,单个JOB一次运行平均耗时基本在 "10ms" 之内(基本为一次请求的网络开销);因此,可以保证使用有限的线程支撑大量的JOB并发运行;
+
+得益于上述两点优化,理论上默认配置下的调度中心,单机能够支撑 5000 任务并发运行稳定运行;
+
+实际场景中,由于调度中心与执行器网络ping延迟不同、DB读写耗时不同、任务调度密集程度不同,会导致任务量上限会上下波动。
+
+如若需要支撑更多的任务量,可以通过 "调大调度线程数" 、"降低调度中心与执行器ping延迟" 和 "提升机器配置" 几种方式优化。
+
+#### 5.4.12 均衡调度
+调度中心在集群部署时会自动进行任务平均分配,触发组件每次获取与线程池数量(调度中心支持自定义调度线程池大小)相关数量的任务,避免大量任务集中在单个调度中心集群节点;
+
+### 5.5 任务 "运行模式" 剖析
+#### 5.5.1 "Bean模式" 任务
+开发步骤:可参考 "章节三" ;
+原理:每个Bean模式任务都是一个Spring的Bean类实例,它被维护在“执行器”项目的Spring容器中。任务类需要加“@JobHandler(value="名称")”注解,因为“执行器”会根据该注解识别Spring容器中的任务。任务类需要继承统一接口“IJobHandler”,任务逻辑在execute方法中开发,因为“执行器”在接收到调度中心的调度请求时,将会调用“IJobHandler”的execute方法,执行任务逻辑。
+
+#### 5.5.2 "GLUE模式(Java)" 任务
+开发步骤:可参考 "章节三" ;
+原理:每个 "GLUE模式(Java)" 任务的代码,实际上是“一个继承自“IJobHandler”的实现类的类代码”,“执行器”接收到“调度中心”的调度请求时,会通过Groovy类加载器加载此代码,实例化成Java对象,同时注入此代码中声明的Spring服务(请确保Glue代码中的服务和类引用在“执行器”项目中存在),然后调用该对象的execute方法,执行任务逻辑。
+
+#### 5.5.3 GLUE模式(Shell) + GLUE模式(Python) + GLUE模式(PHP) + GLUE模式(NodeJS) + GLUE模式(Powershell)
+开发步骤:可参考 "章节三" ;
+原理:脚本任务的源码托管在调度中心,脚本逻辑在执行器运行。当触发脚本任务时,执行器会加载脚本源码在执行器机器上生成一份脚本文件,然后通过Java代码调用该脚本;并且实时将脚本输出日志写到任务日志文件中,从而在调度中心可以实时监控脚本运行情况;
+
+目前支持的脚本类型如下:
+
+ - shell脚本:任务运行模式选择为 "GLUE模式(Shell)"时支持 "Shell" 脚本任务;
+ - python脚本:任务运行模式选择为 "GLUE模式(Python)"时支持 "Python" 脚本任务;
+ - php脚本:任务运行模式选择为 "GLUE模式(PHP)"时支持 "PHP" 脚本任务;
+ - nodejs脚本:任务运行模式选择为 "GLUE模式(NodeJS)"时支持 "NodeJS" 脚本任务;
+ - powershell:任务运行模式选择为 "GLUE模式(PowerShell)"时支持 "PowerShell" 脚本任务;
+
+脚本任务通过 Exit Code 判断任务执行结果,状态码可参考章节 "5.15 任务执行结果说明";
+
+#### 5.5.4 执行器
+执行器实际上是一个内嵌的Server,默认端口9999(配置项:xxl.job.executor.port)。
+
+在项目启动时,执行器会通过“@XxlJob”识别Spring容器中“Bean模式任务”,以注解的value属性为key管理起来。
+
+“执行器”接收到“调度中心”的调度请求时,如果任务类型为“Bean模式”,将会匹配Spring容器中的“Bean模式任务”,然后调用其execute方法,执行任务逻辑。如果任务类型为“GLUE模式”,将会加载GLue代码,实例化Java对象,注入依赖的Spring服务(注意:Glue代码中注入的Spring服务,必须存在与该“执行器”项目的Spring容器中),然后调用execute方法,执行任务逻辑。
+
+#### 5.5.5 任务日志
+XXL-JOB会为每次调度请求生成一个单独的日志文件,需要通过 "XxlJobHelper.log" 打印执行日志,“调度中心”查看执行日志时将会加载对应的日志文件。
+
+(历史版本通过重写LOG4J的Appender实现,存在依赖限制,该方式在新版本已经被抛弃)
+
+日志文件存放的位置可在“执行器”配置文件进行自定义,默认目录格式为:/data/applogs/xxl-job/jobhandler/“格式化日期”/“数据库调度日志记录的主键ID.log”。
+
+在JobHandler中开启子线程时,子线程将会把日志打印在父线程即JobHandler的执行日志中,方便日志追踪。
+
+### 5.6 通讯模块剖析
+
+#### 5.6.1 一次完整的任务调度通讯流程
+ - 1、“调度中心”向“执行器”发送http调度请求: “执行器”中接收请求的服务,实际上是一台内嵌Server,默认端口9999;
+ - 2、“执行器”执行任务逻辑;
+ - 3、“执行器”http回调“调度中心”调度结果: “调度中心”中接收回调的服务,是针对执行器开放一套API服务;
+
+#### 5.6.2 通讯数据加密
+调度中心向执行器发送的调度请求时使用RequestModel和ResponseModel两个对象封装调度请求参数和响应数据, 在进行通讯之前底层会将上述两个对象对象序列化,并进行数据协议以及时间戳检验,从而达到数据加密的功能;
+
+### 5.7 任务注册, 任务自动发现
+自v1.5版本之后, 任务取消了"任务执行机器"属性, 改为通过任务注册和自动发现的方式, 动态获取远程执行器地址并执行。
+
+ AppName: 每个执行器机器集群的唯一标示, 任务注册以 "执行器" 为最小粒度进行注册; 每个任务通过其绑定的执行器可感知对应的执行器机器列表;
+ 注册表: 见"xxl_job_registry"表, "执行器" 在进行任务注册时将会周期性维护一条注册记录,即机器地址和AppName的绑定关系; "调度中心" 从而可以动态感知每个AppName在线的机器列表;
+ 执行器注册: 任务注册Beat周期默认30s; 执行器以一倍Beat进行执行器注册, 调度中心以一倍Beat进行动态任务发现; 注册信息的失效时间为三倍Beat;
+ 执行器注册摘除:执行器销毁时,将会主动上报调度中心并摘除对应的执行器机器信息,提高心跳注册的实时性;
+
+
+为保证系统"轻量级"并且降低学习部署成本,没有采用Zookeeper作为注册中心,采用DB方式进行任务注册发现;
+
+### 5.8 任务执行结果
+自v1.6.2之后,任务执行结果通过 "IJobHandler" 的返回值 "ReturnT" 进行判断;
+当返回值符合 "ReturnT.code == ReturnT.SUCCESS_CODE" 时表示任务执行成功,否则表示任务执行失败,而且可以通过 "ReturnT.msg" 回调错误信息给调度中心;
+从而,在任务逻辑中可以方便的控制任务执行结果;
+
+### 5.9 分片广播 & 动态分片
+执行器集群部署时,任务路由策略选择"分片广播"情况下,一次任务调度将会广播触发对应集群中所有执行器执行一次任务,同时系统自动传递分片参数;可根据分片参数开发分片任务;
+
+"分片广播" 以执行器为维度进行分片,支持动态扩容执行器集群从而动态增加分片数量,协同进行业务处理;在进行大数据量业务操作时可显著提升任务处理能力和速度。
+
+"分片广播" 和普通任务开发流程一致,不同之处在于可以获取分片参数,获取分片参数进行分片业务处理。
+
+- Java语言任务获取分片参数方式:BEAN、GLUE模式(Java)
+```
+// 可参考Sample示例执行器中的示例任务"ShardingJobHandler"了解试用
+int shardIndex = XxlJobHelper.getShardIndex();
+int shardTotal = XxlJobHelper.getShardTotal();
+```
+- 脚本语言任务获取分片参数方式:GLUE模式(Shell)、GLUE模式(Python)、GLUE模式(Nodejs)
+```
+// 脚本任务入参固定为三个,依次为:任务传参、分片序号、分片总数。以Shell模式任务为例,获取分片参数代码如下
+echo "分片序号 index = $2"
+echo "分片总数 total = $3"
+```
+
+分片参数属性说明:
+
+ index:当前分片序号(从0开始),执行器集群列表中当前执行器的序号;
+ total:总分片数,执行器集群的总机器数量;
+
+该特性适用场景如:
+- 1、分片任务场景:10个执行器的集群来处理10w条数据,每台机器只需要处理1w条数据,耗时降低10倍;
+- 2、广播任务场景:广播执行器机器运行shell脚本、广播集群节点进行缓存更新等
+
+### 5.10 访问令牌(AccessToken)
+为提升系统安全性,调度中心和执行器进行安全性校验,双方AccessToken匹配才允许通讯;
+
+调度中心和执行器,可通过配置项 "xxl.job.accessToken" 进行AccessToken的设置。
+
+调度中心和执行器,如果需要正常通讯,只有两种设置;
+
+- 设置一:调度中心和执行器,均不设置AccessToken;关闭安全性校验;
+- 设置二:调度中心和执行器,设置了相同的AccessToken;
+
+### 5.11 故障转移 & 失败重试
+一次完整任务流程包括"调度(调度中心) + 执行(执行器)"两个阶段。
+
+- "故障转移"发生在调度阶段,在执行器集群部署时,如果某一台执行器发生故障,该策略支持自动进行Failover切换到一台正常的执行器机器并且完成调度请求流程。
+- "失败重试"发生在"调度 + 执行"两个阶段,支持通过自定义任务失败重试次数,当任务失败时将会按照预设的失败重试次数主动进行重试;
+
+### 5.12 执行器灰度上线
+调度中心与业务解耦,只需部署一次后常年不需要维护。但是,执行器中托管运行着业务作业,作业上线和变更需要重启执行器,尤其是Bean模式任务。
+执行器重启可能会中断运行中的任务。但是,XXL-JOB得益于自建执行器与自建注册中心,可以通过灰度上线的方式,避免因重启导致的任务中断的问题。
+
+步骤如下:
+- 1、执行器改为手动注册,下线一半机器列表(A组),线上运行另一半机器列表(B组);
+- 2、等待A组机器任务运行结束并编译上线;执行器注册地址替换为A组;
+- 3、等待B组机器任务运行结束并编译上线;执行器注册地址替换为A组+B组;
+ 操作结束;
+
+### 5.13 任务执行结果说明
+系统根据以下标准判断任务执行结果,可参考之。
+
+-- | Bean/Glue(Java) | Glue(Shell) 等脚本任务
+--- | --- | ---
+成功 | IJobHandler.SUCCESS | 0
+失败 | IJobHandler.FAIL | -1(非0状态码)
+
+### 5.14 任务超时控制
+支持设置任务超时时间,任务运行超时的情况下,将会主动中断任务;
+
+需要注意的是,任务超时中断时与任务终止机制(可查看“4.9 终止运行中的任务”)类似,也是通过 "interrupt" 中断任务,因此业务代码需要将 "InterruptedException" 外抛,否则功能不可用。
+
+### 5.15 跨语言
+XXL-JOB是一个跨语言的任务调度平台,主要体现在如下几个方面:
+- 1、RESTful API:调度中心与执行器提供语言无关的 RESTful API 服务,第三方任意语言可据此对接调度中心或者实现执行器。(可参考章节 “调度中心/执行器 RESTful API” )
+- 2、多任务模式:提供Java、Python、PHP……等十来种任务模式,可参考章节 “5.5 任务 "运行模式" ”;理论上可扩展任意语言任务模式;
+- 2、提供基于HTTP的任务Handler(Bean任务,JobHandler="httpJobHandler");业务方只需要提供HTTP链接等相关信息即可,不限制语言、平台;(可参考章节 “原生内置Bean模式任务” )
+
+### 5.16 任务失败告警
+默认提供邮件失败告警,可扩展短信、钉钉等方式。如果需要新增一种告警方式,只需要新增一个实现 "com.xxl.job.admin.core.alarm.JobAlarm" 接口的告警实现即可。可以参考默认提供邮箱告警实现 "EmailJobAlarm"。
+
+### 5.17 调度中心Docker镜像构建
+可以通过以下命令快速构建调度中心,并启动运行;
+```
+mvn clean package
+docker build -t xuxueli/xxl-job-admin:{version} ./xxl-job-admin
+docker run --name xxl-job-admin -p 8080:8080 -d xuxueli/xxl-job-admin
+```
+
+### 5.20 避免任务重复执行
+调度密集或者耗时任务可能会导致任务阻塞,集群情况下调度组件小概率情况下会重复触发;
+针对上述情况,可以通过结合 "单机路由策略(如:第一台、一致性哈希)" + "阻塞策略(如:单机串行、丢弃后续调度)" 来规避,最终避免任务重复执行。
+
+### 5.21 命令行任务
+原生提供通用命令行任务Handler(Bean任务,"CommandJobHandler");业务方只需要提供命令行即可;
+如任务参数 "pwd" 将会执行命令并输出数据;
+
+### 5.22 日志自动清理
+XXL-JOB日志主要包含如下两部分,均支持日志自动清理,说明如下:
+- 调度中心日志表数据:可借助配置项 "xxl.job.logretentiondays" 设置日志表数据保存天数,过期日志自动清理;详情可查看上文配置说明;
+- 执行器日志文件数据:可借助配置项 "xxl.job.executor.logretentiondays" 设置日志文件数据保存天数,过期日志自动清理;详情可查看上文配置说明;
+
+### 5.23 调度结果丢失处理
+执行器因网络抖动回调失败或宕机等异常情况,会导致任务调度结果丢失。由于调度中心依赖执行器回调来感知调度结果,因此会导致调度日志永远处于 "运行中" 状态。
+
+针对该问题,调度中心提供内置组件进行处理,逻辑为:调度记录停留在 "运行中" 状态超过10min,且对应执行器心跳注册失败不在线,则将本地调度主动标记失败;
+
+
+## 六、调度中心/执行器 RESTful API
+XXL-JOB 目标是一种跨平台、跨语言的任务调度规范和协议。
+
+针对Java应用,可以直接通过官方提供的调度中心与执行器,方便快速的接入和使用调度中心,可以参考上文 “快速入门” 章节。
+
+针对非Java应用,可借助 XXL-JOB 的标准 RESTful API 方便的实现多语言支持。
+
+- 调度中心 RESTful API:
+ - 说明:调度中心提供给执行器使用的API;不局限于官方执行器使用,第三方可使用该API来实现执行器;
+ - API列表:执行器注册、任务结果回调等;
+- 执行器 RESTful API :
+ - 说明:执行器提供给调度中心使用的API;官方执行器默认已实现,第三方执行器需要实现并对接提供给调度中心;
+ - API列表:任务触发、任务终止、任务日志查询……等;
+
+此处 RESTful API 主要用于非Java语言定制个性化执行器使用,实现跨语言。除此之外,如果有需要通过API操作调度中心,可以个性化扩展 “调度中心 RESTful API” 并使用。
+
+### 6.1 调度中心 RESTful API
+
+API服务位置:com.xxl.job.core.biz.AdminBiz ( com.xxl.job.admin.controller.JobApiController )
+API服务请求参考代码:com.xxl.job.adminbiz.AdminBizTest
+
+#### a、任务回调
+```
+说明:执行器执行完任务后,回调任务结果时使用
+
+------
+
+地址格式:{调度中心根地址}/api/callback
+
+Header:
+ XXL-JOB-ACCESS-TOKEN : {请求令牌}
+
+请求数据格式如下,放置在 RequestBody 中,JSON格式:
+ [{
+ "logId":1, // 本次调度日志ID
+ "logDateTim":0, // 本次调度日志时间
+ "handleCode":200, // 200 表示任务执行正常,500表示失败
+ "handleMsg": null
+ }
+ }]
+
+响应数据格式:
+ {
+ "code": 200, // 200 表示正常、其他失败
+ "msg": null // 错误提示消息
+ }
+```
+
+#### b、执行器注册
+```
+说明:执行器注册时使用,调度中心会实时感知注册成功的执行器并发起任务调度
+
+------
+
+地址格式:{调度中心根地址}/api/registry
+
+Header:
+ XXL-JOB-ACCESS-TOKEN : {请求令牌}
+
+请求数据格式如下,放置在 RequestBody 中,JSON格式:
+ {
+ "registryGroup":"EXECUTOR", // 固定值
+ "registryKey":"xxl-job-executor-example", // 执行器AppName
+ "registryValue":"http://127.0.0.1:9999/" // 执行器地址,内置服务跟地址
+ }
+
+响应数据格式:
+ {
+ "code": 200, // 200 表示正常、其他失败
+ "msg": null // 错误提示消息
+ }
+```
+
+#### c、执行器注册摘除
+```
+说明:执行器注册摘除时使用,注册摘除后的执行器不参与任务调度与执行
+
+------
+
+地址格式:{调度中心根地址}/api/registryRemove
+
+Header:
+ XXL-JOB-ACCESS-TOKEN : {请求令牌}
+
+请求数据格式如下,放置在 RequestBody 中,JSON格式:
+ {
+ "registryGroup":"EXECUTOR", // 固定值
+ "registryKey":"xxl-job-executor-example", // 执行器AppName
+ "registryValue":"http://127.0.0.1:9999/" // 执行器地址,内置服务跟地址
+ }
+
+响应数据格式:
+ {
+ "code": 200, // 200 表示正常、其他失败
+ "msg": null // 错误提示消息
+ }
+```
+
+### 6.2 执行器 RESTful API
+
+API服务位置:com.xxl.job.core.biz.ExecutorBiz
+API服务请求参考代码:com.xxl.job.executorbiz.ExecutorBizTest
+
+#### a、心跳检测
+```
+说明:调度中心检测执行器是否在线时使用
+
+------
+
+地址格式:{执行器内嵌服务根地址}/beat
+
+Header:
+ XXL-JOB-ACCESS-TOKEN : {请求令牌}
+
+请求数据格式如下,放置在 RequestBody 中,JSON格式:
+
+响应数据格式:
+ {
+ "code": 200, // 200 表示正常、其他失败
+ "msg": null // 错误提示消息
+ }
+```
+
+#### b、忙碌检测
+```
+说明:调度中心检测指定执行器上指定任务是否忙碌(运行中)时使用
+
+------
+
+地址格式:{执行器内嵌服务根地址}/idleBeat
+
+Header:
+ XXL-JOB-ACCESS-TOKEN : {请求令牌}
+
+请求数据格式如下,放置在 RequestBody 中,JSON格式:
+ {
+ "jobId":1 // 任务ID
+ }
+
+响应数据格式:
+ {
+ "code": 200, // 200 表示正常、其他失败
+ "msg": null // 错误提示消息
+ }
+```
+
+#### c、触发任务
+```
+说明:触发任务执行
+
+------
+
+地址格式:{执行器内嵌服务根地址}/run
+
+Header:
+ XXL-JOB-ACCESS-TOKEN : {请求令牌}
+
+请求数据格式如下,放置在 RequestBody 中,JSON格式:
+ {
+ "jobId":1, // 任务ID
+ "executorHandler":"demoJobHandler", // 任务标识
+ "executorParams":"demoJobHandler", // 任务参数
+ "executorBlockStrategy":"COVER_EARLY", // 任务阻塞策略,可选值参考 com.xxl.job.core.enums.ExecutorBlockStrategyEnum
+ "executorTimeout":0, // 任务超时时间,单位秒,大于零时生效
+ "logId":1, // 本次调度日志ID
+ "logDateTime":1586629003729, // 本次调度日志时间
+ "glueType":"BEAN", // 任务模式,可选值参考 com.xxl.job.core.glue.GlueTypeEnum
+ "glueSource":"xxx", // GLUE脚本代码
+ "glueUpdatetime":1586629003727, // GLUE脚本更新时间,用于判定脚本是否变更以及是否需要刷新
+ "broadcastIndex":0, // 分片参数:当前分片
+ "broadcastTotal":0 // 分片参数:总分片
+ }
+
+响应数据格式:
+ {
+ "code": 200, // 200 表示正常、其他失败
+ "msg": null // 错误提示消息
+ }
+```
+
+#### f、终止任务
+```
+说明:终止任务
+
+------
+
+地址格式:{执行器内嵌服务根地址}/kill
+
+Header:
+ XXL-JOB-ACCESS-TOKEN : {请求令牌}
+
+请求数据格式如下,放置在 RequestBody 中,JSON格式:
+ {
+ "jobId":1 // 任务ID
+ }
+
+
+响应数据格式:
+ {
+ "code": 200, // 200 表示正常、其他失败
+ "msg": null // 错误提示消息
+ }
+```
+
+#### d、查看执行日志
+```
+说明:终止任务,滚动方式加载
+
+------
+
+地址格式:{执行器内嵌服务根地址}/log
+
+Header:
+ XXL-JOB-ACCESS-TOKEN : {请求令牌}
+
+请求数据格式如下,放置在 RequestBody 中,JSON格式:
+ {
+ "logDateTim":0, // 本次调度日志时间
+ "logId":0, // 本次调度日志ID
+ "fromLineNum":0 // 日志开始行号,滚动加载日志
+ }
+
+响应数据格式:
+ {
+ "code":200, // 200 表示正常、其他失败
+ "msg": null // 错误提示消息
+ "content":{
+ "fromLineNum":0, // 本次请求,日志开始行数
+ "toLineNum":100, // 本次请求,日志结束行号
+ "logContent":"xxx", // 本次请求日志内容
+ "isEnd":true // 日志是否全部加载完
+ }
+ }
+```
+
+
+
+## 七、版本更新日志
+### 7.1 版本 V1.1.x,新特性[2015-12-05]
+**【于V1.1.x版本,XXL-JOB正式应用于我司,内部定制别名为 “Ferrari”,新接入应用推荐使用最新版本】**
+- 1、简单:支持通过Web页面对任务进行CRUD操作,操作简单,一分钟上手;
+- 2、动态:支持动态修改任务状态,动态暂停/恢复任务,即时生效;
+- 3、服务HA:任务信息持久化到mysql中,Job服务天然支持集群,保证服务HA;
+- 4、任务HA:某台Job服务挂掉,任务会平滑分配给其他的某一台存活服务,即使所有服务挂掉,重启时或补偿执行丢失任务;
+- 5、一个任务只会在其中一台服务器上执行;
+- 6、任务串行执行;
+- 7、支持自定义参数;
+- 8、支持远程任务执行终止;
+
+### 7.2 版本 V1.2.x,新特性[2016-01-17]
+- 1、支持任务分组;
+- 2、支持“本地任务”、“远程任务”;
+- 3、底层通讯支持两种方式,Servlet方式 + JETTY方式;
+- 4、支持“任务日志”;
+- 5、支持“串行执行”,并行执行;
+
+ 说明:V1.2版本将系统架构按功能拆分为:
+
+ - 调度模块(调度中心):负责管理调度信息,按照调度配置发出调度请求;
+ - 执行模块(执行器):负责接收调度请求并执行任务逻辑;
+ - 通讯模块:负责调度模块和任务模块之间的信息通讯;
+ 优点:
+
+ - 解耦:任务模块提供任务接口,调度模块维护调度信息,业务相互独立;
+ - 高扩展性;
+ - 稳定性;
+
+### 7.3 版本 V1.3.0,新特性[2016-05-19]
+- 1、遗弃“本地任务”模式,推荐使用“远程任务”,易于系统解耦,任务对应的JobHandler统称为“执行器”;
+- 2、遗弃“servlet”方式底层系统通讯,推荐使用JETTY方式,调度+回调双向通讯,重构通讯逻辑;
+- 3、UI交互优化:左侧菜单展开状态优化,菜单项选中状态优化,任务列表打开表格有压缩优化;
+- 4、【重要】“执行器”细分为:BEAN、GLUE两种开发模式,简介见下文:
+
+ “执行器” 模式简介:
+ - BEAN模式执行器:每个执行器都是Spring的一个Bean实例,XXL-JOB通过注解@JobHandler识别和调度执行器;
+ -GLUE模式执行器:每个执行器对应一段代码,在线Web编辑和维护,动态编译生效,执行器负责加载GLUE代码和执行;
+
+### 7.4 版本 V1.3.1,新特性[2016-05-23]
+- 1、更新项目目录结构:
+ - /xxl-job-admin -------------------- 【调度中心】:负责管理调度信息,按照调度配置发出调度请求;
+ - /xxl-job-core ----------------------- 公共依赖
+ - /xxl-job-executor-example ------ 【执行器】:负责接收调度请求并执行任务逻辑;
+ - /db ---------------------------------- 建表脚本
+ - /doc --------------------------------- 用户手册
+- 2、在新的目录结构上,升级了用户手册;
+- 3、优化了一些交互和UI;
+
+### 7.5 版本 V1.3.2,新特性[2016-05-28]
+- 1、调度逻辑进行事务包裹;
+- 2、执行器异步回调执行日志;
+- 3、【重要】在 “调度中心” 支持HA的基础上,扩展执行器的Failover支持,支持配置多执行期地址;
+
+### 7.6 版本 V1.4.0 新特性[2016-07-24]
+- 1、任务依赖: 通过事件触发方式实现, 任务执行成功并回调时会主动触发一次子任务的调度, 多个子任务用逗号分隔;
+- 2、执行器底层实现代码进行重度重构, 优化底层建表脚本;
+- 3、执行器中任务线程分组逻辑优化: 之前根据执行器JobHandler进行线程分组,当多个任务复用Jobhanlder会导致相互阻塞。现改为根据调度中心任务进行任务线程分组,任务与任务执行相互隔离;
+- 4、执行器调度通讯方案优化, 通过Hex + HC实现建议RPC通讯协议, 优化了通讯参数的维护和解析流程;
+- 5、调度中心, 新建/编辑任务, 界面属性调整:
+ - 5.1、任务新增/编辑界面中去除 "任务名JobName"属性 ,该属性改为系统自动生成: 该字段之前主要用于在 "调度中心" 唯一标示一个任务, 现实意义不大, 因此计划淡化掉该字段,改为系统生成UUID,从而简化任务新建的操作;
+ - 5.2、任务新增/编辑界面中去除 "GLUE模式" 复选框位置调整, 改为贴近"JobHandler"输入框右侧;
+ - 5.3、任务新增/编辑界面中去除 "报警阈值" 属性;
+ - 5.4、任务新增/编辑界面中去除 "子任务Key" 属性, 每个任务全局任务Key可以从任务列表获取, 当本任务执行结束且成功后, 将会根据子任务Key匹配子任务并主动触发一次子任务执行;
+- 6、问题修复:
+ - 6.1、执行器jetty关闭优化,解决一处可能导致jetty无法关闭的问题;
+ - 6.2、执行器任务终止时,执行队列回调优化,解决一处导致任务无法回调的问题;
+ - 6.3、调度中心中列表分页参数优化,解决一处因服务器限制post长度而引起的问题;
+ - 6.4、执行器Jobhandler注解优化,解决一处因事务代理导致的容器无法加载JobHandler的问题;
+ - 6.5、远程调度优化,禁用retry策略,解决一处可能导致重复调用的问题;
+
+Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段, 地址见分支 [V1.3](https://github.com/xuxueli/xxl-job/tree/v1.3) 。新特性将会在master分支持续更新。
+
+### 7.7 版本 V1.4.1 新特性[2016-09-06]
+- 1、项目成功推送maven中央仓库, 中央仓库地址以及依赖如下:
+ ```
+
+
+ com.xuxueli
+ xxl-job-core
+ ${最新稳定版}
+
+ ```
+- 2、为适配中央仓库规则, 项目groupId从com.xxl改为com.xuxueli。
+- 3、系统版本不在维护在项目跟pom中,各个子模块单独配置版本配置,解决子模块无法单独编译的问题;
+- 4、底层RPC通讯,传输数据的字节长度统计规则优化,可节省50%数据传输量;
+- 5、IJobHandler取消任务返回值,原通过返回值判断执行状态,逻辑改为:默认任务执行成功,仅在捕获异常时认定任务执行失败。
+- 6、系统公共弹框功能,插件化;
+- 7、底层表结构,表明统一大写;
+- 8、调度中心,异常处理器JSON响应的ContentType修改,修复浏览器不识别的问题;
+
+### 7.8 版本 V1.4.2 新特性[2016-09-29]
+- 1、推送新版本 V1.4.2 至中央仓库, 大版本 V1.4 进入维护阶段;
+- 2、任务新增时,任务列表偏移问题修复;
+- 3、修复一处因bootstrap不支持模态框重叠而导致的样式错乱的问题, 在任务编辑时会出现该问题;
+- 4、调度超时和Handler匹配不到时,调度状态优化;
+- 5、因catch异常,导致任务不可终止的问题,给出解决方案, 见文档;
+
+### 7.9 版本 V1.5.0 特性[2016-11-13]
+- 1、任务注册: 执行器会周期性自动注册任务, 调度中心将会自动发现注册的任务并触发执行。
+- 2、"执行器" 新增参数 "AppName" : 是每个执行器集群的唯一标示AppName, 并周期性以AppName为对象进行自动注册。
+- 3、调度中心新增栏目 "执行器管理" : 管理在线的执行器, 通过属性AppName自动发现注册的执行器。只有被管理的执行器才允许被使用;
+- 4、"任务组"属性改为"执行器": 每个任务需要绑定指定的执行器, 调度地址通过绑定的执行器获取;
+- 5、抛弃"任务机器"属性: 通过任务绑定的执行器, 自动发现注册的远程执行器地址并触发调度请求。
+- 6、"公共依赖"中新增DBGlueLoader,基于原生jdbc实现GLUE源码的加载器,减少第三方依赖(mybatis,spring-orm等);精简和优化执行器测配置(针对GLUE任务),降低上手难度;
+- 7、表结构调整,底层重构优化;
+- 8、"调度中心"自动注册和发现,failover: 调度中心周期性自动注册, 任务回调时可以感知在线的所有调度中心地址, 通过failover的方式进行任务回调,避免回调单点风险。
+
+### 7.10 版本 V1.5.1 特性[2016-11-13]
+- 1、底层代码重构和逻辑优化,POM清理以及CleanCode;
+- 2、Servlet/JSP Spec设定为3.0/2.2
+- 3、Spring升级至3.2.17.RELEASE版本;
+- 4、Jetty升级版本至8.2.0.v20160908;
+- 5、已推送V1.5.0和V1.5.1至Maven中央仓库;
+
+### 7.11 版本 V1.5.2 特性[2017-02-28]
+- 1、IP工具类获取IP逻辑优化,IP静态缓存;
+- 2、执行器、调度中心,均支持自定义注册IP地址;解决机器多网卡时错误网卡注册的情况;
+- 3、任务跨天执行时生成多份日志文件的问题修复;
+- 4、底层日志底层日志调整,非敏感日志level调整为debug;
+- 5、升级数据库连接池c3p0版本;
+- 6、执行器log4j配置优化,去除无效属性;
+- 7、底层代码重构和逻辑优化以及CleanCode;
+- 8、GLUE依赖注入逻辑优化,支持别名注入;
+
+### 7.12 版本 V1.6.0 特性[2017-03-13]
+- 1、通讯方案升级,原基于HEX的通讯模型调整为基于HTTP的B-RPC的通讯模型;
+- 2、执行器支持手动设置执行地址列表,提供开关切换使用注册地址还是手动设置的地址;
+- 3、执行器路由规则:第一个、最后一个、轮询、随机、一致性HASH、最不经常使用、最近最久未使用、故障转移;
+- 4、规范线程模型统一,统一线程销毁方案(通过listener或stop方法,容器销毁时销毁线程;Daemon方式有时不太理想);
+- 5、规范系统配置数据,通过配置文件统一管理;
+- 6、CleanCode,清理无效的历史参数;
+- 7、底层扩展数据结构以及相关表结构调整;
+- 8、新建任务默认为非运行状态;
+- 9、GLUE模式任务实例更新逻辑优化,原根据超时时间更新改为根据版本号更新,源码变动版本号加一;
+
+### 7.13 版本 V1.6.1 特性[2017-03-25]
+- 1、Rolling日志;
+- 2、WebIDE交互重构;
+- 3、通讯增强校验,有效过滤非正常请求;
+- 4、权限增强校验,采用动态登录TOKEN(推荐接入内部SSO);
+- 5、数据库配置优化,解决乱码问题;
+
+### 7.14 版本 V1.6.2 特性[2017-04-25]
+- 1、运行报表:支持实时查看运行数据,如任务数量、调度次数、执行器数量等;以及调度报表,如调度日期分布图,调度成功分布图等;
+- 2、JobHandler支持设置任务返回值,在任务逻辑中可以方便的控制任务执行结果;
+- 3、资源路径包含空格或中文时资源文件无法加载时,无法准确查看异常信息的问题处理。
+- 4、路由策越优化:循环和LFU路由策略计数器自增无上限问题和首次路由压力集中在首台机器的问题修复;
+
+### 7.15 版本 V1.7.0 特性[2017-05-02]
+- 1、脚本任务:支持以GLUE模式开发和运行脚本任务,包括Shell、Python和Groovy等类型脚本;
+- 2、新增spring-boot类型执行器example项目;
+- 3、升级jetty版本至9.2;
+- 4、任务运行日志移除log4j组件依赖,改为底层自主实现,从而取消了对日志组件的依赖限制;
+- 5、执行器移除GlueLoader依赖,改为推送方式实现,从而GLUE源码加载不再依赖JDBC;
+- 6、登录拦截Redirect时获取项目名,解决非根据目录发布时跳转404问题;
+
+### 7.16 版本 V1.7.1 特性[2017-05-08]
+- 1、运行日志读写编码统一为UTF-8,解决windows环境下日志乱码问题;
+- 2、通讯超时时间限定为10s,避免异常情况下调度线程占用;
+- 3、执行器,server启动、销毁和注册逻辑调整;
+- 4、JettyServer关闭逻辑优化,修复执行器无法正常关闭导致端口占用和频繁打印c3p0日志的问题;
+- 5、JobHandler中开启子线程时,支持子线程输出执行日志并通过Rolling查看。
+- 6、任务日志清理功能;
+- 7、弹框组件统一替换为layer;
+- 8、升级quartz版本至2.3.0;
+
+### 7.17 版本 V1.7.2 特性[2017-05-17]
+- 1、阻塞处理策略:调度过于密集执行器来不及处理时的处理策略,策略包括:单机串行(默认)、丢弃后续调度、覆盖之前调度;
+- 2、失败处理策略;调度失败时的处理策略,策略包括:失败告警(默认)、失败重试;
+- 3、通讯时间戳超时时间调整为180s;
+- 4、执行器与数据库彻底解耦,但是执行器需要配置调度中心集群地址。调度中心提供API供执行器回调和心跳注册服务,取消调度中心内部jetty,心跳周期调整为30s,心跳失效为三倍心跳;
+- 5、执行参数编辑时丢失问题修复;
+- 6、新增任务测试Demo,方便在开发时进行任务逻辑测试;
+
+### 7.18 版本 V1.8.0 特性[2017-07-17]
+- 1、任务Cron更新逻辑优化,改为rescheduleJob,同时防止cron重复设置;
+- 2、API回调服务失败状态码优化,方便问题排查;
+- 3、XxlJobLogger的日志多参数支持;
+- 4、路由策略新增 "忙碌转移" 模式:按照顺序依次进行空闲检测,第一个空闲检测成功的机器选定为目标执行器并发起调度;
+- 5、路由策略代码重构;
+- 6、执行器重复注册问题修复;
+- 7、任务线程轮空30次后自动销毁,降低低频任务的无效线程消耗。
+- 8、执行器任务执行结果批量回调,降低回调频率提升执行器性能;
+- 9、springboot版本执行器,取消XML配置,改为类配置方式;
+- 10、执行日志,支持根据运行 "状态" 筛选日志;
+- 11、调度中心任务注册检测逻辑优化;
+
+### 7.19 版本 V1.8.1 特性[2017-07-30]
+- 1、分片广播任务:执行器集群部署时,任务路由策略选择"分片广播"情况下,一次任务调度将会广播触发集群中所有执行器执行一次任务,可根据分片参数处理分片任务;
+- 2、动态分片:分片广播任务以执行器为维度进行分片,支持动态扩容执行器集群从而动态增加分片数量,协同进行业务处理;在进行大数据量业务操作时可显著提升任务处理能力和速度。
+- 3、执行器JobHandler禁止命名冲突;
+- 4、执行器集群地址列表进行自然排序;
+- 5、调度中心,DAO层代码精简优化并且新增测试用例覆盖;
+- 6、调度中心API服务改为自研RPC形式,统一底层通讯模型;
+- 7、新增调度中心API服务测试Demo,方便在调度中心API扩展和测试;
+- 8、任务列表页交互优化,更换执行器分组时自动刷新任务列表,新建任务时默认定位在当前执行器位置;
+- 9、访问令牌(accessToken):为提升系统安全性,调度中心和执行器进行安全性校验,双方AccessToken匹配才允许通讯;
+- 10、springboot版本执行器,升级至1.5.6.RELEASE版本;
+- 11、统一maven依赖版本管理;
+
+### 7.20 版本 V1.8.2 特性[2017-09-04]
+- 1、项目主页搭建:提供中英文文档:https://www.xuxueli.com/xxl-job
+- 2、JFinal执行器Sample示例项目;
+- 3、事件触发:除了"Cron方式"和"任务依赖方式"触发任务执行之外,支持基于事件的触发任务方式。调度中心提供触发任务单次执行的API服务,可根据业务事件灵活触发。
+- 4、执行器摘除:执行器销毁时,主动通知调度中心并摘除对应执行器节点,提高执行器状态感知的时效性。
+- 5、执行器手动设置IP时将会绑定Host;
+- 6、规范项目目录,方便扩展多执行器;
+- 7、解决执行器回调URL不支持配置HTTPS时问题;
+- 8、执行器回调线程销毁前, 批量回调队列中数据,防止任务结果丢失;
+- 9、调度中心任务监控线程销毁时,批量对失败任务告警,防止告警信息丢失;
+- 10、任务日志文件路径时间戳格式化时SimpleDateFormat并发问题解决;
+
+### 7.21 版本 V1.9.0 特性[2017-12-29]
+- 1、新增Nutz执行器Sample示例项目;
+- 2、新增任务运行模式 "GLUE模式(NodeJS) ",支持NodeJS脚本任务;
+- 3、脚本任务Shell、Python和Nodejs等支持获取分片参数;
+- 4、失败重试,完整支持:调度中心调度失败且启用"失败重试"策略时,将会自动重试一次;执行器执行失败且回调失败重试状态(新增失败重试状态返回值)时,也将会自动重试一次;
+- 5、失败告警策略扩展:默认提供邮件失败告警,可扩展短信等,扩展代码位置为 "JobFailMonitorHelper.failAlarm";
+- 6、执行器端口支持自动生成(小于等于0时),避免端口定义冲突;
+- 7、调度报表优化,支持时间区间筛选;
+- 8、Log组件支持输出异常栈信息,底层实现优化;
+- 9、告警邮件样式优化,调整为表格形式,邮件组件调整为commons-email简化邮件操作;
+- 10、项目依赖全量升级至较新稳定版本,如spring、jackson等等;
+- 11、任务日志,记录发起调度的机器信息;
+- 12、交互优化,如登录注销;
+- 13、任务Cron长度扩展支持至128位,支持负责类型Cron设置;
+- 14、执行器地址录入交互优化,地址长度扩展支持至512位,支持大规模执行器集群配置;
+- 15、任务参数“IJobHandler.execute”入参改为“String params”,增强入参通用性。
+- 16、IJobHandler提供init/destroy方法,支持在相应任务线程初始化和销毁时进行附加操作;
+- 17、任务注解调整为 “@JobHandler”,与任务抽象接口统一;
+- 18、修复任务监控线程被耗时任务阻塞的问题;
+- 19、修复任务监控线程无法监控任务触发和执行状态均未0的问题;
+- 20、执行器动态代理对象,拦截非业务方法的执行;
+- 21、修复JobThread捕获Error错误不更新JobLog的问题;
+- 22、修复任务列表界面左侧菜单合并时样式错乱问题;
+- 23、调度中心项目日志配置改为xml文件格式;
+- 24、Log地址格式兼容,支持非"/"结尾路径配置;
+- 25、底层系统日志级别规范调整,清理遗留代码;
+- 26、建表SQL优化,支持同步创建制定编码的库和表;
+- 27、系统安全性优化,登录Token写Cookie时进行MD5加密,同时Cookie启用HttpOnly;
+- 28、新增"任务ID"属性,移除"JobKey"属性,前者承担所有功能,方便后续增强任务依赖功能。
+- 29、任务循环依赖问题修复,避免子任务与父任务重复导致的调度死循环;
+- 30、任务列表新增筛选条件 "任务描述",快速检索任务;
+- 31、执行器Log文件定期清理功能:执行器新增配置项("xxl.job.executor.logretentiondays")日志保存天数,日志文件过期自动删除。
+
+### 7.22 版本 V1.9.1 特性[2018-02-22]
+- 1、国际化:调度中心实现国际化,支持中文、英文两种语言,默认为中文。
+- 2、调度报表新增"运行中"中状态项;
+- 3、调度报表优化,报表SQL调优并且新增LocalCache缓存(缓存时间60s),提高大数据量下报表加载速度;
+- 4、修复打包部署时资源文件乱码问题;
+- 5、修复新版本chrome滚动到顶部失效问题;
+- 6、调度中心配置加载优化,取消对配置文件名的强依赖,支持加载磁盘配置;
+- 7、修复脚本任务Log文件未正常close的问题;
+- 8、项目依赖全量升级至较新稳定版本,如spring、jackson等等;
+
+### 7.23 版本 V1.9.2 特性[2018-10-05]
+- 1、任务超时控制:新增任务属性 "任务超时时间",并支持自定义,任务运行超时将会主动中断任务;
+- 2、任务失败重试次数:新增任务属性 "失败重试次数",并支持自定义,当任务失败时将会按照预设的失败重试次数主动进行重试;同时收敛废弃其他失败重试策略,如调度失败、执行失败、状态码失败等;
+- 3、新增任务运行模式 "GLUE模式(PHP) ",支持php脚本任务;
+- 4、新增任务运行模式 "GLUE模式(PowerShell) ",支持PowerShell脚本任务;
+- 5、调度全异步处理:任务触发之后,推送到调度队列,多线程并发处理调度请求,提高任务调度速率的同时,避免因网络问题导致quartz调度线程阻塞的问题;
+- 6、执行器任务结果落盘优化:执行器回调失败时将任务结果写磁盘,待重启或网络恢复时重试回调任务结果,防止任务执行结果丢失;
+- 7、任务日志查询速度大幅提升:百万级别数据量搜索速度提升1000倍;
+- 8、调度中心提供API服务,支持通过API服务对任务进行查询、新增、更新、启停等操作;
+- 9、底层自研Log组件参数占位符改为"{}",并修复打印有参日志时参数不匹配导致报错的问题;
+- 10、任务回调结果优化,支持展示在Rolling log中,方便问题排查;
+- 11、底层LocalCache组件兼容性优化,支持jdk9、jdk10及以上版本编译部署;
+- 12、告警邮件固定使用 UTF-8 编码格式,修复由机器编码导致的邮件乱码问题;
+- 13、告警邮件中展示失败告警信息;
+- 14、告警邮箱支持SSL配置;
+- 15、Window机器下File.separator不兼容问题修复;
+- 16、脚本任务异常Log输出优化;
+- 17、任务线程停止变量修饰符优化;
+- 18、脚本任务Log文件流关闭优化;
+- 19、任务报表成功、失败和进行中统计问题修复;
+- 20、核心依赖Core内部国际化处理;
+- 21、默认Quartz线程数调整为50;
+- 22、新增左侧菜单"运行报表";
+- 23、执行器手动设置IP时取消绑定Host的操作,该IP仅供执行器注册使用;修复指定外网IP时无法绑定执行器Host的问题;
+- 24、取消父子任务不可重复的限制,支持循环任务触发等特殊场景;
+- 25、任务调度备注中标注任务触发类型,如Cron触发、父任务触发、API触发等等,方便排查调度日志;
+- 26、底层日志组件SimpleDateFormat线程安全问题修复;
+- 27、执行器通讯线程优化,corePoolSize从256降低至32;
+- 28、任务日志表状态字段类型优化;
+- 29、GLUE脚本文件自动清理功能,及时清理过期脚本文件;
+- 30、执行器注册方式切换优化,切换自动注册时主动同步在线机器,避免执行器为空的问题;
+- 31、跨平台:除了提供Java、Python、PHP等十来种任务模式之外,新增提供基于HTTP的任务模式;
+- 32、底层RPC序列化协议调整为hessian2;
+- 33、修复表字段 “t.order”与数据库关键字冲突查询失败的问题,
+- 34、任务属性枚举 "任务模式、阻塞策略" 国际化优化;
+- 35、分片任务失败重试优化,仅重试当前失败的分片;
+- 36、任务触发时支持动态传参,调度中心与API服务均提供提供动态参数功能;
+- 37、任务执行日志、调度日志字段类型调整,改为text类型并取消字数限制;
+- 38、GLUE任务脚本字段类型调整,改为mediumtext类型,提高GLUE长度上限;
+- 39、任务监控线程Log输出优化,运行中任务的监控Log改为debug级别,减少非核心日志量;
+- 40、项目依赖全量升级至较新稳定版本,如spring、Jackson、groovy等等;
+- 41、docker支持:调度中心提供 Dockerfile 方便快速构建docker镜像;
+
+### 7.24 版本 V2.0.0 Release Notes[2018-11-04]
+- 1、调度中心迁移到 springboot;
+- 2、底层通讯组件迁移至 xxl-rpc;
+- 3、容器化:提供官方docker镜像,并实时更新推送dockerhub(docker pull xuxueli/xxl-job-admin),进一步实现产品开箱即用;
+- 4、新增无框架执行器Sample示例项目 "xxl-job-executor-sample-frameless"。不依赖第三方框架,只需main方法即可启动运行执行器;
+- 5、命令行任务:原生提供通用命令行任务Handler(Bean任务,"CommandJobHandler");业务方只需要提供命令行即可;
+- 6、任务状态优化,仅运行状态"NORMAL"任务关联至quartz,降低quartz底层数据存储与调度压力;
+- 7、任务状态规范:新增任务默认停止状态,任务更新时保持任务状态不变;
+- 8、IP获取逻辑优化,优先遍历网卡来获取可用IP;
+- 9、任务新增的API服务接口返回任务ID,方便调用方实用;
+- 10、组件化优化,移除对 spring 的依赖:非spring应用选用 "XxlJobExecutor" 、spring应用选用 "XxlJobSpringExecutor" 作为执行器组件;
+- 11、任务RollingLog展示逻辑优化,修复超时任务无法查看的问题;
+- 12、多项UI组件升级到最新版本,如:CodeMirror、Echarts、Jquery 等;
+- 13、项目依赖升级 groovy 至较新稳定版本;pom清理;
+- 14、子任务失败重试重试逻辑优化,子任务失败时将会按照其预设的失败重试次数主动进行重试
+
+### 7.25 版本 v2.0.1 Release Notes[2018-11-09]
+- 1、左侧菜单折叠动画问题修复;
+- 2、调度报表日期分布图默认值统一;
+- 3、freemarker对数字默认加千分位问题修复,解决日志ID被分隔导致查看日志失败问题;
+- 4、底层通讯组件升级,修复通讯异常时无效等待的问题;
+- 5、执行器启动之后jetty停止的问题修复;
+
+### 7.26 版本 v2.0.2 Release Notes[2019-04-20]
+- 1、底层通讯方案优化:升级较新版本xxl-rpc,由"JETTY"方案调整为"NETTY_HTTP"方案,执行器内嵌netty-http-server提供服务,调度中心复用容器端口提供服务;
+- 2、任务告警逻辑调整,改为通过扫描失败日志方式触发。一方面精确扫描失败任务,降低扫描范围;另一方面取消内存队列,降低线程内存消耗;
+- 3、Quartz触发线程池废弃并替换为 "XxlJobThreadPool",降低线程切换、内存占用带来的消耗,提高调度性能;
+- 4、调度线程池隔离,拆分为"Fast"和"Slow"两个线程池,1分钟窗口期内任务耗时达500ms超过10次,该窗口期内判定为慢任务,慢任务自动降级进入"Slow"线程池,避免耗尽调度线程,提高系统稳定性;
+- 5、执行器热部署时JobHandler重新初始化,修复由此导致的 "jobhandler naming conflicts." 问题;
+- 6、新增Class的加载缓存,解决频繁加载Class会使jvm的方法区空间不足导致OOM的问题;
+- 7、任务支持更换绑定执行器,方便任务分组转移和管理;
+- 8、调度中心告警邮件发送组件改为 “spring-boot-starter-mail”;
+- 9、记住密码功能优化,选中时永久记住;非选中时关闭浏览器即登出;
+- 10、项目依赖升级至较新稳定版本,如quartz、spring、jackson、groovy、xxl-rpc等等;
+- 11、精简项目,取消第三方依赖,如 commons-collections4、commons-lang3 ;
+- 12、执行器回调日志落盘方案复用RPC序列化方案,并移除Jackson依赖;
+- 13、底层Log调优,应用正常终止取消异常栈信息打印;
+- 14、交互优化,尽量避免新开页面窗口;仅WebIDE支持新开页,并提供窗口快速关闭按钮;任务启、停、删除、触发等轻操作提示改为toast方式,
+- 15、任务暂停、删除优化,避免quartz delete不完整导致任务脏数据;
+- 16、任务回调、心跳注册成功日志优化,非核心常规日志调整为debug级别,降低冗余日志输出;
+- 17、调整首页报表默认区间为本周,避免日志量太大查询缓慢;
+- 18、LRU路由更新不及时问题修复;
+- 19、任务失败告警邮件发送逻辑优化;
+- 20、调度日志排序逻辑调整为按照调度时间倒序,兼容TIDB等主键不连续日志存储组件;
+- 21、执行器优雅停机优化;
+- 22、连接池配置优化,增强连接有效性验证;
+- 23、JobHandler#msg长度限制,修复异常情况下日志超长导致内存溢出的问题;
+- 24、升级xxl-rpc至较新版本,修复springboot 2.x版本兼容性问题;
+
+### 7.27 版本 v2.1.0 Release Notes[2019-07-07]
+- 1、自研调度组件,移除quartz依赖:一方面是为了精简系统降低冗余依赖,另一方面是为了提供系统的可控度与稳定性;
+ - 触发:单节点周期性触发,运行事件如delayqueue;
+ - 调度:集群竞争,负载方式协同处理,锁竞争-更新触发信息-推送时间轮-锁释放-锁竞争;
+- 2、底层表结构重构:移除11张quartz相关表,并对现有表结构优化梳理;
+- 3、任务日志主键调整为long数据类型,防止海量日志情况下数据溢出;
+- 4、底层线程模型重构:移除Quartz线程池,降低系统线程与内存开销;
+- 5、用户管理:支持在线管理系统用户,存在管理员、普通用户两种角色;
+- 6、权限管理:执行器维度进行权限控制,管理员拥有全量权限,普通用户需要分配执行器权限后才允许相关操作;
+- 7、调度线程池参数调优;
+- 8、注册表索引优化,缓解锁表问题;
+- 9、新增Jboot执行器Sample示例项目;
+- 10、任务列表优化,支持根据 "任务状态"、"负责人" 属性筛选任务;
+- 11、任务日志列表交互优化,操作按钮合并为分割按钮;
+- 12、项目依赖升级至较新稳定版本,如spring、springboot、groovy、xxl-rpc等等;并清理冗余POM;
+- 13、升级xxl-rpc至较新版本,修复代理服务初始化时远程服务不可用导致长连冗余创建的问题;
+- 14、首页调度报表的日期排序在TIDB下乱序问题修复;
+- 15、调度中心与执行器双向通讯超时时间调整为3s;
+- 16、调度组件销毁流程优化,先停止调度线程,然后等待时间轮内存量任务处理完成,最终销毁时间轮线程;
+- 17、执行器回调线程优化,回调地址为空时销毁问题修复;
+- 18、HttpJobHandler优化,响应数据指定UTF-8格式,避免中文乱码;
+- 19、代码优化,ConcurrentHashMap变量类型改为ConcurrentMap,避免因不同版本实现不同导致的兼容性问题;
+
+### 7.28 版本 v2.1.1 Release Notes[2019-11-24]
+- 1、 调度中心日志自动清理功能(至此,调度中心/执行器均支持日志自动清理,过期天数均默认设置为30天):调度中心新增配置项("xxl.job.logretentiondays")日志保存天数,过期日志自动清理;解决海量日志情况下日志表慢SQL问题;限制大于等于7时生效,否则关闭清理功能,默认为30;
+- 2、 调度报表优化:新增日志报表的存储表,三天内的任务日志会以每分钟一次的频率异步同步至报表中;任务报表仅读取报表数据,极大提升加载速度;
+- 3、 Cron在线生成工具:任务新增、编辑框通过组件在线生成Cron表达式;
+- 4、 Cron下次执行时间查询:支持通过界面在线查看后续连续5次执行时间;
+- 5、 调度中心新增应用健康检查功能,借助“spring-boot-starter-actuator”,相对地址 “/actuator/health”;
+- 6、 DB脚本默认编码改为utf8mb4,修复字符乱码问题(建议Mysql版本5.7+);
+- 7、 调度中心任务平均分配,触发组件每次获取与线程池数量相关数量的任务,避免大量任务集中在单个调度中心集群节点;
+- 8、 任务触发组件优化,预加载频率正常1s一次,当预加载轮空时主动休眠一个加载周期,动态降低加载频率从而降低DB压力;
+- 9、 调度组件优化:针对永远不会触发的Cron禁止配置和启动;任务Cron最后一次触发后再也不会触发时,比如一次性任务,主动停止相关任务;
+- 10、DB重连优化,修复DB宕机重连后任务调度停止的问题,重连后自动加入调度集群触发任务调度;
+- 11、注册监控线程优化,降低死锁几率;
+- 12、调度中心日志删除优化,改为分页获取ID并根据ID删除的方式,避免批量删除海量日志导致死锁问题;
+- 13、任务重试时参数丢失的问题修复;
+- 14、调度中心移除SQL中的 "now()" 函数;集群部署时不再依赖DB时钟,仅需要保证调度中心应用节点时钟一致即可;
+- 15、任务触发组件加载顺序调整,避免小概率情况下组件随机加载顺序导致的I18N的NPE问题;
+- 16、JobThread自销毁优化,避免并发触发导致triggerQueue中任务丢失问题;
+- 17、调度中心密码限制18位,修复修改密码超过18位无法登录的问题;
+- 18、任务告警组件分页参数无效问题修复;
+- 19、升级xxl-rpc版本:服务端线程优化,降低线程内存开销;IpUtil优化:增加连通性校,过滤明确非法的网卡;
+- 20、调度中心回调API服务改为restful方式;
+- 21、UI优化,任务列表和日志列表数据表格宽度比例调整,避免数据换行提升体验;
+- 22、登录界面取消默认填写的登录账号密码;
+- 23、执行器表属性调整,"顺序" 属性调整为整型,解决执行器数据较多时无法正确排序的问题;
+- 24、任务列表交互优化,支持查看任务所属执行器的注册节点;
+- 25、项目依赖升级至较新稳定版本,如spring、spring-boot、mybatis、slf4j、groovy等等;
+- 26、日志组件优化:调度中心支持控制每次请求最大加载行数,日志量太大时分批请求,避免单次加载日志量太大阻塞页面;
+
+### 7.29 版本 v2.1.2 Release Notes[2019-12-12]
+- 1、方法任务支持:由原来基于JobHandler类任务开发方式,优化为支持基于方法的任务开发方式;因此,可以支持单个类中开发多个任务方法,进行类复用
+```
+@XxlJob("demoJobHandler")
+public ReturnT execute(String param) {
+ XxlJobLogger.log("hello world");
+ return ReturnT.SUCCESS;
+}
+```
+- 2、移除commons-exec,采用原生方式实现,降低第三方依赖;
+- 3、执行器回调乱码问题修复;
+- 4、调度中心dispatcher servlet加载顺序优化;
+- 5、执行器回调地址https兼容支持;
+- 6、多个项目依赖升级至较新稳定版本;
+- 注意:最新版本 "XxlJobSpringExecutor" 逻辑有调整,历史项目中该组件的配置方式请参考Sample示例项目进行调整,尤其注意需要移除组件的init和destroy方法;
+
+### 7.30 版本 v2.2.0 Release Notes[2020-04-14]
+- 1、RESTful API:调度中心与执行器提供语言无关的 RESTful API 服务,第三方任意语言可据此对接调度中心或者实现执行器。
+- 2、任务复制功能:点击复制是弹出新建任务弹框,并初始化被复制任务信息;
+- 3、任务手动执行一次的时候,支持指定本次执行的机器地址,为空则从执行器获取;
+- 4、任务结果丢失处理:调度记录停留在 "运行中" 状态超过10min,且对应执行器心跳注册失败不在线,则将本地调度主动标记失败;
+- 5、调度中心升级springboot2.x;因此,系统要求JDK8+;
+- 6、XxlJob注解扫描方式优化,支持查找父类以及接口和基于类代理等常见情况;修复任务为空时小概率NPE问题;
+- 7、移除旧类注解JobHandler,推荐使用基于方法注解 "@XxlJob" 的方式进行任务开发;(如需保留类注解JobHandler使用方式,可以参考旧版逻辑定制开发);
+- 8、任务告警组件模块化:如果需要新增一种告警方式,只需要新增一个实现 "com.xxl.job.admin.core.alarm.JobAlarm" 接口的告警实现即可,更加灵活、方便定制;
+- 9、调度中心国际化完善:新增 "中文繁体" 支持。默认为 "zh_CN"/中文简体, 可选范围为 "zh_CN"/中文简体, "zh_TC"/中文繁体 and "en"/英文;
+- 10、执行器注册逻辑优化:新增配置项 ”注册地址 / xxl.job.executor.address“,优先使用该配置作为注册地址,为空时使用内嵌服务 ”IP:PORT“ 作为注册地址。从而更灵活的支持容器类型执行器动态IP和动态映射端口问题。
+- 11、默认数据库连接池调整为hikari,移除tomcat-jdbc依赖;
+- 12、多个项目依赖升级至较新稳定版本,如mybatis、groovy和mysql驱动等;
+- 13、执行器优雅停机优化,修复任务线程中断未join导致回调丢失的问题;
+- 14、一致性哈希路由策略优化:默认虚拟节点数量调整为100,提高路由的均衡性;
+- 15、通用HTTP任务Handler(httpJobHandler)优化,扩展自定义参数信息,示例参数如下;
+```
+url: http://www.xxx.com
+method: get 或 post
+data: post-data
+```
+- 16、SQL脚本编码默认utf8mb4执行,避免小概率下容器环境中乱码问题;
+- 17、Web IDE交互问题修复:输入源码备注之后按回车跳转error问题处理;
+- 18、执行器初始化逻辑优化:修复懒加载的Bean被提前初始化问题;
+- 19、执行器注册默认值优化;
+- 20、修复bootstrap.min.css.map 404问题;
+- 21、执行器UI交互优化,移除冗余order属性;
+- 22、执行备注消息长度限制,修复数据超长无法存储导致导致回调失败的问题;
+注意:XxlJobSpringExecutor组件个别字段调整:“appName” 调整为 “appname” ,升级时该组件时需要注意;
+
+### 7.31 版本 v2.3.0 Release Notes[2021-02-09]
+- 1、【新增】调度过期策略:调度中心错过调度时间的补偿处理策略,包括:忽略、立即补偿触发一次等;
+- 2、【新增】触发策略:除了常规Cron、API、父子任务触发方式外,新增提供 "固定间隔触发、(固定延时触发,实验中)" 新触发方式;
+- 3、【新增】新增任务辅助工具 "XxlJobHelper":提供统一任务辅助能力,包括:任务上下文信息维护获取(任务参数、任务ID、分片参数)、日志输出、任务结果设置……等;
+ - 3.1、"ShardingUtil" 组件废弃:改用 "XxlJobHelper.getShardIndex()/getShardTotal();" 获取分片参数;
+ - 3.2、"XxlJobLogger" 组件废弃:改用 "XxlJobHelper.log" 进行日志输出;
+- 4、【优化】任务核心类 "IJobHandler" 的 "execute" 方法取消出入参设计。改为通过 "XxlJobHelper.getJobParam" 获取任务参数并替代方法入参,通过 "XxlJobHelper.handleSuccess/handleFail" 设置任务结果并替代方法出参,示例代码如下;
+```
+@XxlJob("demoJobHandler")
+public void execute() {
+ String param = XxlJobHelper.getJobParam(); // 获取参数
+ XxlJobHelper.handleSuccess(); // 设置任务结果
+}
+```
+- 5、【优化】Cron编辑器增强:Cron编辑器修改cron时可实时查看最近运行时间;
+- 6、【优化】执行器示例项目规范整理;
+- 7、【优化】任务调度生命周期重构:调度(schedule)、触发(trigger)、执行(handle)、回调(callback)、结束(complete);
+- 8、【优化】执行器注册组件优化:注册逻辑调整为异步方式,提高注册性能;
+- 9、【优化】执行器鉴权校验:执行器启动时主动校验accessToken,为空则主动Warn告警;(已规划安全强化:AccessToken动态生成、动态启停等)
+- 10、【优化】邮箱告警配置优化:将"spring.mail.from"与"spring.mail.username"属性拆分开,更加灵活的支持一些无密码邮箱服务;
+- 11、【优化】多个项目依赖升级至较新稳定版本,如netty、groovy、spring、springboot、mybatis等;
+- 12、【优化】UI组件常规升级,提升组件稳定性;
+- 13、【优化】调度中心页面交互优化:用户管理模块密码列取消;多处表达autocomplete取消;执行器管理模块XSS拦截校验等;
+- 14、【优化】调度中心任务状态探测慢SQL问题优化;
+- 15、【修复】GLUE-Java模式任务,init/destroy无法执行问题修复;
+- 16、【修复】Cron编辑器问题修复:修复小概率情况下cron单个字段修改时导致其他字段被重置问题;
+- 17、【修复】通用HTTP任务Handler(httpJobHandler)优化:修复 "setDoOutput(true)" 导致任务请求GetMethod失效问题;
+- 18、【修复】执行器Commandhandler示例任务优化,修复极端情况下脚本进程挂起问题;
+- 19、【修复】调度通讯组件优化,修复RestFul方式调用 DotNet 版本执行器时心跳检测失败问题;
+- 20、【修复】调度中心远程执行日志查询乱码问题修复;
+- 21、【修复】调度中心组件加载顺序优化,修复极端情况下调度组件初始慢导致的调度失败问题;
+- 22、【修复】执行器注册线程优化,修复极端情况下初始化失败时导致NPE问题;
+- 23、【修复】调度线程连接池优化,修复连接有效性校验超时问题;
+- 24、【修复】执行器注册表字段优化,解决执行器注册节点过多导致注册信息存储和更新失败的问题;
+- 25、【修复】轮训路由策略优化,修复小概率下并发问题;
+- 26、【修复】页面redirect跳转后https变为http问题修复;
+- 27、【修复】执行器日志清理优化,修复小概率下日志文件为空导致清理异常问题;
+
+### 7.32 版本 v2.3.1 Release Notes[2022-05-21]
+- 1、【修复】修复风险漏洞,升级问题低版本项目依赖:CVE-2021-2471、CVE-2022-22965等。
+- 2、【修复】修复故障告警逻辑,邮箱校验逻辑下放至EmailJobAlarm中,避免对其他告警方式的干扰。
+- 3、【优化】调度通讯默认启用accessToken,提升系统安全性(建议生产环境自定义accessToken)。
+- 4、【优化】合并多项PR,项目代码结构、健壮性优化:PR-2833、PR-2812、PR-2541、PR-2537、PR-2514、PR-2509、PR-2591。
+- 5、【优化】任务线程名优化,提升可读性与问题定位效率(ISSUE-2527)。
+
+### 7.33 版本 v2.4.0 Release Notes[2023-03-23]
+- 1、【优化】执行器任务Bean扫描逻辑优化:解决懒加载注解失效问题;
+- 2、【优化】多个项目依赖升级至较新稳定版本,涉及netty、groovy、spring、springboot、mybatis等;
+- 3、【修复】漏洞修复,包括:"CVE-2022-36157" 授权漏洞修复;"CVE-2022-43183" SSRF漏洞修复;
+
+### 7.34 版本 v2.4.1 Release Notes[2024-04-17]
+- 1、【优化】多个项目依赖升级至较新稳定版本,涉及netty、groovy、springboot、mybatis等;
+- 2、【优化】执行器注册节点显示交互调整,优化注册节点过多时展示不全体验;
+- 3、【修复】漏洞修复,包括:"CVE-2022-43402" groovy低版本漏洞修复;"CVE-2024-29025" netty低版本漏洞修复;"CVE-2024-3366" freemarker模板注入漏洞修复;"CVE-2022-43183" 越权漏洞增强修复;
+- 4、【修复】调度日志页面XSS问题修复(ISSUE-3360)。
+
+
+### 7.35 版本 v2.4.2 Release Notes[2024-11-16]
+- 1、【优化】调度中心任务Next计算逻辑调整,避免Cron解析失败导致重复执行问题。
+- 2、【优化】Cron解析组件代码重构微调,健壮性提升;
+- 3、【优化】修改密码交互调整,避免CSRF隐患;
+- 4、【优化】JdkSerializeTool流关闭逻辑优化;
+- 5、【优化】任务信息、执行日志API非功能设计完善,避免越权隐患;
+- 6、【修复】漏洞修复,包括 "CVE-2024-42681" 子任务越权漏洞修复、"CVE-2023-33779" 任务API越权问题修复;
+- 7、【升级】多个项目依赖升级至较新稳定版本,涉及netty、groovy、gson、springboot、mybatis等;
+
+**备注:**
+- a、“CVE-2024-38820”漏洞源自spring,当前使用spring5.x及springboot2.x软件普遍受该问题影响。 该问题修复需要升级至spring6.x与springboot3.x,同时需要升级JDK17,如有诉求可自行升级。计划下个大版本升级spring及jdk版本解决该问题。
+- b、本次升级数据模型及通讯协议向前兼容,v2.4.*可无缝升级。
+
+
+### 7.35 版本 v2.5.0 Release Notes[规划中]
+- 1、[规划中]升级springboot3.x,解决2.x老版本漏洞类问题。注意,springboot3.x依赖jdk17。
+- 2、[规划中]安全功能增强,通讯加密参数改用加密数据避免AccessToken明文, 降低token泄漏风险。
+- 3、[规划中]登陆态Token声称逻辑优化,混淆登陆时间属性,降低token泄漏风险。
+
+### TODO LIST
+- 1、调度隔离:调度中心针对不同执行器,各自维护不同的调度和远程触发组件。
+- 2、任务优先级:调度与执行阶段按照优先级分配资源。
+- 3、多数据库支持,DAO层通过JPA实现,不限制数据库类型。
+- 4、执行器Log清理功能:调度中心Log删除时同步删除执行器中的Log文件;
+- 5、性能优化:任务、执行器数据全量本地缓存;新增消息表广播通知;
+- 6、DAG流程任务
+ - 子任务:废弃
+ - DAG任务创建、管理,DAG任务日志查看、操作;
+ - 支持参数传递,共享数据;
+ - 分片任务:全部完成后才会出发后置节点;
+ - 配置并列的"a-b、b-c"路径列表,构成串行、并行、dag任务流程,"dagre-d3"绘图;任务依赖,流程图,子任务+会签任务,各节点日志;支持根据成功、失败选择分支;
+- 7、任务标签:方便搜索;
+- 8、告警增强:
+ - 邮件告警:支持自定义标题、模板格式;
+ - webhook告警:支持自定义告警URL、请求体格式;
+- 9、安全强化:AccessToken动态生成、动态启停;控制调度、回调;
+- 10、任务导入导出工具,灵活支持版本升级、迁移等场景。
+- 11、任务日志重构:一次调度只记录一条主任务,维护起止时间和状态。
+ - 普通任务:只记录一条主任务;
+ - 广播任务:记录一条主任务,每个分片任务记录一条次任务,关联在主任务上;
+ - 重试任务:失败时,新增主任务。所有调度记录,包括入口调度和重试调度,均挂载主任务上。
+- 12、分片任务:全部完成后才会出发后置节点;
+- 13、日期过滤:支持多个时间段排除;
+- 13、GLUE 模式 Web Ide 版本对比功能;
+- 14、提供执行器Docker镜像;
+- 15、脚本任务,支持数据参数,新版本仅支持单参数不支持需要兼容;
+- 17、批量调度:调度请求入queue,调度线程批量获取调度请求并发起远程调度;提高线程效率;
+- 18、执行器端口复用,复用容器端口提供通讯服务;
+- 19、自定义失败重试时间间隔;
+
+## 八、其他
+
+### 8.1 项目贡献
+欢迎参与项目贡献!比如提交PR修复一个bug,或者新建 [Issue](https://github.com/xuxueli/xxl-job/issues/) 讨论新特性或者变更。
+
+### 8.2 用户接入登记
+更多接入的公司,欢迎在 [登记地址](https://github.com/xuxueli/xxl-job/issues/1 ) 登记,登记仅仅为了产品推广。
+
+### 8.3 开源协议和版权
+产品开源免费,并且将持续提供免费的社区技术支持。个人或企业内部可自由的接入和使用。如有需要可邮件联系作者免费获取项目授权。
+
+- Licensed under the GNU General Public License (GPL) v3.
+- Copyright (c) 2015-present, xuxueli.
+
+---
+### 捐赠
+无论捐赠金额多少都足够表达您这份心意,非常感谢 :) [前往捐赠](https://www.xuxueli.com/page/donate.html )
diff --git a/doc/xxl-job/XXL-JOB架构图.key b/doc/xxl-job/XXL-JOB架构图.key
new file mode 100644
index 0000000..1607657
Binary files /dev/null and b/doc/xxl-job/XXL-JOB架构图.key differ
diff --git a/doc/xxl-job/images/cnblog-首页-每日一博-第一.png b/doc/xxl-job/images/cnblog-首页-每日一博-第一.png
new file mode 100644
index 0000000..f292d3e
Binary files /dev/null and b/doc/xxl-job/images/cnblog-首页-每日一博-第一.png differ
diff --git a/doc/xxl-job/images/cnblog-首页-热门动弹-第一.png b/doc/xxl-job/images/cnblog-首页-热门动弹-第一.png
new file mode 100644
index 0000000..a594c06
Binary files /dev/null and b/doc/xxl-job/images/cnblog-首页-热门动弹-第一.png differ
diff --git a/doc/xxl-job/images/donate-alipay.jpg b/doc/xxl-job/images/donate-alipay.jpg
new file mode 100644
index 0000000..78472ce
Binary files /dev/null and b/doc/xxl-job/images/donate-alipay.jpg differ
diff --git a/doc/xxl-job/images/donate-paypal.png b/doc/xxl-job/images/donate-paypal.png
new file mode 100644
index 0000000..24e78a4
Binary files /dev/null and b/doc/xxl-job/images/donate-paypal.png differ
diff --git a/doc/xxl-job/images/donate-wechat.png b/doc/xxl-job/images/donate-wechat.png
new file mode 100644
index 0000000..4d16dab
Binary files /dev/null and b/doc/xxl-job/images/donate-wechat.png differ
diff --git a/doc/xxl-job/images/gitcode-gstar.JPG b/doc/xxl-job/images/gitcode-gstar.JPG
new file mode 100644
index 0000000..79a95cc
Binary files /dev/null and b/doc/xxl-job/images/gitcode-gstar.JPG differ
diff --git a/doc/xxl-job/images/gitee-gvp.jpg b/doc/xxl-job/images/gitee-gvp.jpg
new file mode 100644
index 0000000..dcc195b
Binary files /dev/null and b/doc/xxl-job/images/gitee-gvp.jpg differ
diff --git a/doc/xxl-job/images/img_1001.png b/doc/xxl-job/images/img_1001.png
new file mode 100644
index 0000000..549880b
Binary files /dev/null and b/doc/xxl-job/images/img_1001.png differ
diff --git a/doc/xxl-job/images/img_1002.png b/doc/xxl-job/images/img_1002.png
new file mode 100644
index 0000000..411f8ec
Binary files /dev/null and b/doc/xxl-job/images/img_1002.png differ
diff --git a/doc/xxl-job/images/img_6yC0.png b/doc/xxl-job/images/img_6yC0.png
new file mode 100644
index 0000000..01bf573
Binary files /dev/null and b/doc/xxl-job/images/img_6yC0.png differ
diff --git a/doc/xxl-job/images/img_BPLG.png b/doc/xxl-job/images/img_BPLG.png
new file mode 100644
index 0000000..c928205
Binary files /dev/null and b/doc/xxl-job/images/img_BPLG.png differ
diff --git a/doc/xxl-job/images/img_EB65.png b/doc/xxl-job/images/img_EB65.png
new file mode 100644
index 0000000..ccf222d
Binary files /dev/null and b/doc/xxl-job/images/img_EB65.png differ
diff --git a/doc/xxl-job/images/img_Fgql.png b/doc/xxl-job/images/img_Fgql.png
new file mode 100644
index 0000000..f884051
Binary files /dev/null and b/doc/xxl-job/images/img_Fgql.png differ
diff --git a/doc/xxl-job/images/img_Hr2T.png b/doc/xxl-job/images/img_Hr2T.png
new file mode 100644
index 0000000..4b5a73c
Binary files /dev/null and b/doc/xxl-job/images/img_Hr2T.png differ
diff --git a/doc/xxl-job/images/img_Qohm.png b/doc/xxl-job/images/img_Qohm.png
new file mode 100644
index 0000000..4fb24e4
Binary files /dev/null and b/doc/xxl-job/images/img_Qohm.png differ
diff --git a/doc/xxl-job/images/img_UDSo.png b/doc/xxl-job/images/img_UDSo.png
new file mode 100644
index 0000000..a0b81a4
Binary files /dev/null and b/doc/xxl-job/images/img_UDSo.png differ
diff --git a/doc/xxl-job/images/img_V3vF.png b/doc/xxl-job/images/img_V3vF.png
new file mode 100644
index 0000000..4607c84
Binary files /dev/null and b/doc/xxl-job/images/img_V3vF.png differ
diff --git a/doc/xxl-job/images/img_Wb2o.png b/doc/xxl-job/images/img_Wb2o.png
new file mode 100644
index 0000000..fec8dca
Binary files /dev/null and b/doc/xxl-job/images/img_Wb2o.png differ
diff --git a/doc/xxl-job/images/img_Ypik.png b/doc/xxl-job/images/img_Ypik.png
new file mode 100644
index 0000000..6b4a2dd
Binary files /dev/null and b/doc/xxl-job/images/img_Ypik.png differ
diff --git a/doc/xxl-job/images/img_Z9Qr.png b/doc/xxl-job/images/img_Z9Qr.png
new file mode 100644
index 0000000..2bfb044
Binary files /dev/null and b/doc/xxl-job/images/img_Z9Qr.png differ
diff --git a/doc/xxl-job/images/img_ZAhX.png b/doc/xxl-job/images/img_ZAhX.png
new file mode 100644
index 0000000..4a6039a
Binary files /dev/null and b/doc/xxl-job/images/img_ZAhX.png differ
diff --git a/doc/xxl-job/images/img_ZAsz.png b/doc/xxl-job/images/img_ZAsz.png
new file mode 100644
index 0000000..bbb83ec
Binary files /dev/null and b/doc/xxl-job/images/img_ZAsz.png differ
diff --git a/doc/xxl-job/images/img_dNUJ.png b/doc/xxl-job/images/img_dNUJ.png
new file mode 100644
index 0000000..a1a57a0
Binary files /dev/null and b/doc/xxl-job/images/img_dNUJ.png differ
diff --git a/doc/xxl-job/images/img_eYrv.png b/doc/xxl-job/images/img_eYrv.png
new file mode 100644
index 0000000..3f9c5e9
Binary files /dev/null and b/doc/xxl-job/images/img_eYrv.png differ
diff --git a/doc/xxl-job/images/img_hIci.png b/doc/xxl-job/images/img_hIci.png
new file mode 100644
index 0000000..0529209
Binary files /dev/null and b/doc/xxl-job/images/img_hIci.png differ
diff --git a/doc/xxl-job/images/img_iUw0.png b/doc/xxl-job/images/img_iUw0.png
new file mode 100644
index 0000000..b746000
Binary files /dev/null and b/doc/xxl-job/images/img_iUw0.png differ
diff --git a/doc/xxl-job/images/img_inc8.png b/doc/xxl-job/images/img_inc8.png
new file mode 100644
index 0000000..e1d38d6
Binary files /dev/null and b/doc/xxl-job/images/img_inc8.png differ
diff --git a/doc/xxl-job/images/img_jOAU.png b/doc/xxl-job/images/img_jOAU.png
new file mode 100644
index 0000000..beddc97
Binary files /dev/null and b/doc/xxl-job/images/img_jOAU.png differ
diff --git a/doc/xxl-job/images/img_jrdI.png b/doc/xxl-job/images/img_jrdI.png
new file mode 100644
index 0000000..69b38c0
Binary files /dev/null and b/doc/xxl-job/images/img_jrdI.png differ
diff --git a/doc/xxl-job/images/img_o8HQ.png b/doc/xxl-job/images/img_o8HQ.png
new file mode 100644
index 0000000..46b5bd0
Binary files /dev/null and b/doc/xxl-job/images/img_o8HQ.png differ
diff --git a/doc/xxl-job/images/img_tJOq.png b/doc/xxl-job/images/img_tJOq.png
new file mode 100644
index 0000000..f3d0062
Binary files /dev/null and b/doc/xxl-job/images/img_tJOq.png differ
diff --git a/doc/xxl-job/images/img_tvGI.png b/doc/xxl-job/images/img_tvGI.png
new file mode 100644
index 0000000..4b2265a
Binary files /dev/null and b/doc/xxl-job/images/img_tvGI.png differ
diff --git a/doc/xxl-job/images/qq群-一个xxl同学进了58.png b/doc/xxl-job/images/qq群-一个xxl同学进了58.png
new file mode 100644
index 0000000..a525e0b
Binary files /dev/null and b/doc/xxl-job/images/qq群-一个xxl同学进了58.png differ
diff --git a/doc/xxl-job/images/xxl-logo.jpg b/doc/xxl-job/images/xxl-logo.jpg
new file mode 100644
index 0000000..0169cce
Binary files /dev/null and b/doc/xxl-job/images/xxl-logo.jpg differ
diff --git a/doc/xxl-job/images/xxl-logo.png b/doc/xxl-job/images/xxl-logo.png
new file mode 100644
index 0000000..045c006
Binary files /dev/null and b/doc/xxl-job/images/xxl-logo.png differ
diff --git a/init-file/nacos_config.zip b/init-file/config/nacos_config.zip
similarity index 100%
rename from init-file/nacos_config.zip
rename to init-file/config/nacos_config.zip
diff --git a/init-file/cloud-seata.sql b/init-file/sql/cloud-seata.sql
similarity index 100%
rename from init-file/cloud-seata.sql
rename to init-file/sql/cloud-seata.sql
diff --git a/init-file/cloud-system.sql b/init-file/sql/cloud-system.sql
similarity index 100%
rename from init-file/cloud-system.sql
rename to init-file/sql/cloud-system.sql
diff --git a/init-file/xxl-init.sql b/init-file/sql/xxl-init.sql
similarity index 100%
rename from init-file/xxl-init.sql
rename to init-file/sql/xxl-init.sql
diff --git a/xxl-job/pom.xml b/xxl-job/pom.xml
new file mode 100644
index 0000000..184f4d0
--- /dev/null
+++ b/xxl-job/pom.xml
@@ -0,0 +1,149 @@
+
+ 4.0.0
+ com.xuxueli
+ xxl-job
+ 2.5.0-SNAPSHOT
+ pom
+
+ ${project.artifactId}
+ A distributed task scheduling framework.
+ https://www.xuxueli.com/
+
+
+ xxl-job-core
+ xxl-job-admin
+
+
+
+ UTF-8
+ UTF-8
+ UTF-8
+ 1.8
+ 1.8
+ true
+
+ 4.1.115.Final
+ 2.11.0
+
+ 5.3.39
+ 2.7.18
+
+ 2.3.2
+ 9.1.0
+
+ 2.0.16
+ 5.11.3
+ 1.3.2
+
+ 4.0.24
+
+ 3.3.1
+ 3.11.1
+ 3.2.7
+
+
+
+
+
+
+
+
+
+
+ GNU General Public License version 3
+ https://opensource.org/licenses/GPL-3.0
+
+
+
+
+ master
+ https://github.com/xuxueli/xxl-job.git
+ scm:git:https://github.com/xuxueli/xxl-job.git
+ scm:git:git@github.com:xuxueli/xxl-job.git
+
+
+
+ XXL
+ xuxueli
+ 931591021@qq.com
+ https://github.com/xuxueli
+
+
+
+
+
+
+ release
+
+ true
+
+
+ xxl-job-core
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ ${maven-source-plugin.version}
+
+
+ package
+
+ jar-no-fork
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ ${maven-javadoc-plugin.version}
+
+
+ package
+
+ jar
+
+
+ none
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ ${maven-gpg-plugin.version}
+
+ false
+
+
+
+ verify
+
+ sign
+
+
+
+
+
+
+
+
+ oss
+ https://oss.sonatype.org/content/repositories/snapshots/
+
+
+ oss
+ https://oss.sonatype.org/service/local/staging/deploy/maven2/
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xxl-job/xxl-job-admin/Dockerfile b/xxl-job/xxl-job-admin/Dockerfile
new file mode 100644
index 0000000..dc19537
--- /dev/null
+++ b/xxl-job/xxl-job-admin/Dockerfile
@@ -0,0 +1,11 @@
+FROM openjdk:8-jre-slim
+MAINTAINER xuxueli
+
+ENV PARAMS=""
+
+ENV TZ=PRC
+RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
+
+ADD target/xxl-job-admin-*.jar /app.jar
+
+ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /app.jar $PARAMS"]
\ No newline at end of file
diff --git a/xxl-job/xxl-job-admin/pom.xml b/xxl-job/xxl-job-admin/pom.xml
new file mode 100644
index 0000000..c59aca2
--- /dev/null
+++ b/xxl-job/xxl-job-admin/pom.xml
@@ -0,0 +1,119 @@
+
+ 4.0.0
+
+ com.xuxueli
+ xxl-job
+ 2.5.0-SNAPSHOT
+
+ xxl-job-admin
+ jar
+
+
+ true
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ ${spring-boot.version}
+ pom
+ import
+
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-freemarker
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-mail
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ ${mybatis-spring-boot-starter.version}
+
+
+
+ com.mysql
+ mysql-connector-j
+ ${mysql-connector-j.version}
+
+
+
+
+ com.xuxueli
+ xxl-job-core
+ ${project.parent.version}
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot.version}
+
+
+
+ repackage
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/XxlJobAdminApplication.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/XxlJobAdminApplication.java
new file mode 100644
index 0000000..fce10a8
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/XxlJobAdminApplication.java
@@ -0,0 +1,16 @@
+package com.xxl.job.admin;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * @author xuxueli 2018-10-28 00:38:13
+ */
+@SpringBootApplication
+public class XxlJobAdminApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(XxlJobAdminApplication.class, args);
+ }
+
+}
\ No newline at end of file
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java
new file mode 100644
index 0000000..f791d68
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java
@@ -0,0 +1,96 @@
+package com.xxl.job.admin.controller;
+
+import com.xxl.job.admin.controller.annotation.PermissionLimit;
+import com.xxl.job.admin.service.impl.LoginService;
+import com.xxl.job.admin.service.XxlJobService;
+import com.xxl.job.core.biz.model.ReturnT;
+import org.springframework.beans.propertyeditors.CustomDateEditor;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.WebDataBinder;
+import org.springframework.web.bind.annotation.InitBinder;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.view.RedirectView;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * index controller
+ * @author xuxueli 2015-12-19 16:13:16
+ */
+@Controller
+public class IndexController {
+
+ @Resource
+ private XxlJobService xxlJobService;
+ @Resource
+ private LoginService loginService;
+
+
+ @RequestMapping("/")
+ public String index(Model model) {
+
+ Map dashboardMap = xxlJobService.dashboardInfo();
+ model.addAllAttributes(dashboardMap);
+
+ return "index";
+ }
+
+ @RequestMapping("/chartInfo")
+ @ResponseBody
+ public ReturnT
+ *
+ *
+ * @author Sharada Jambula, James House
+ * @author Contributions from Mads Henderson
+ * @author Refactoring from CronTrigger to CronExpression by Aaron Craven
+ *
+ * Borrowed from quartz v2.3.1
+ *
+ */
+public final class CronExpression implements Serializable, Cloneable {
+
+ private static final long serialVersionUID = 12423409423L;
+
+ protected static final int SECOND = 0;
+ protected static final int MINUTE = 1;
+ protected static final int HOUR = 2;
+ protected static final int DAY_OF_MONTH = 3;
+ protected static final int MONTH = 4;
+ protected static final int DAY_OF_WEEK = 5;
+ protected static final int YEAR = 6;
+ protected static final int ALL_SPEC_INT = 99; // '*'
+ protected static final int NO_SPEC_INT = 98; // '?'
+ protected static final Integer ALL_SPEC = ALL_SPEC_INT;
+ protected static final Integer NO_SPEC = NO_SPEC_INT;
+
+ protected static final Map monthMap = new HashMap(20);
+ protected static final Map dayMap = new HashMap(60);
+ static {
+ monthMap.put("JAN", 0);
+ monthMap.put("FEB", 1);
+ monthMap.put("MAR", 2);
+ monthMap.put("APR", 3);
+ monthMap.put("MAY", 4);
+ monthMap.put("JUN", 5);
+ monthMap.put("JUL", 6);
+ monthMap.put("AUG", 7);
+ monthMap.put("SEP", 8);
+ monthMap.put("OCT", 9);
+ monthMap.put("NOV", 10);
+ monthMap.put("DEC", 11);
+
+ dayMap.put("SUN", 1);
+ dayMap.put("MON", 2);
+ dayMap.put("TUE", 3);
+ dayMap.put("WED", 4);
+ dayMap.put("THU", 5);
+ dayMap.put("FRI", 6);
+ dayMap.put("SAT", 7);
+ }
+
+ private final String cronExpression;
+ private TimeZone timeZone = null;
+ protected transient TreeSet seconds;
+ protected transient TreeSet minutes;
+ protected transient TreeSet hours;
+ protected transient TreeSet daysOfMonth;
+ protected transient TreeSet months;
+ protected transient TreeSet daysOfWeek;
+ protected transient TreeSet years;
+
+ protected transient boolean lastdayOfWeek = false;
+ protected transient int nthdayOfWeek = 0;
+ protected transient boolean lastdayOfMonth = false;
+ protected transient boolean nearestWeekday = false;
+ protected transient int lastdayOffset = 0;
+ protected transient boolean expressionParsed = false;
+
+ public static final int MAX_YEAR = Calendar.getInstance().get(Calendar.YEAR) + 100;
+
+ /**
+ * Constructs a new CronExpression
based on the specified
+ * parameter.
+ *
+ * @param cronExpression String representation of the cron expression the
+ * new object should represent
+ * @throws java.text.ParseException
+ * if the string expression cannot be parsed into a valid
+ * CronExpression
+ */
+ public CronExpression(String cronExpression) throws ParseException {
+ if (cronExpression == null) {
+ throw new IllegalArgumentException("cronExpression cannot be null");
+ }
+
+ this.cronExpression = cronExpression.toUpperCase(Locale.US);
+
+ buildExpression(this.cronExpression);
+ }
+
+ /**
+ * Constructs a new {@code CronExpression} as a copy of an existing
+ * instance.
+ *
+ * @param expression
+ * The existing cron expression to be copied
+ */
+ public CronExpression(CronExpression expression) {
+ /*
+ * We don't call the other constructor here since we need to swallow the
+ * ParseException. We also elide some of the sanity checking as it is
+ * not logically trippable.
+ */
+ this.cronExpression = expression.getCronExpression();
+ try {
+ buildExpression(cronExpression);
+ } catch (ParseException ex) {
+ throw new AssertionError();
+ }
+ if (expression.getTimeZone() != null) {
+ setTimeZone((TimeZone) expression.getTimeZone().clone());
+ }
+ }
+
+ /**
+ * Indicates whether the given date satisfies the cron expression. Note that
+ * milliseconds are ignored, so two Dates falling on different milliseconds
+ * of the same second will always have the same result here.
+ *
+ * @param date the date to evaluate
+ * @return a boolean indicating whether the given date satisfies the cron
+ * expression
+ */
+ public boolean isSatisfiedBy(Date date) {
+ Calendar testDateCal = Calendar.getInstance(getTimeZone());
+ testDateCal.setTime(date);
+ testDateCal.set(Calendar.MILLISECOND, 0);
+ Date originalDate = testDateCal.getTime();
+
+ testDateCal.add(Calendar.SECOND, -1);
+
+ Date timeAfter = getTimeAfter(testDateCal.getTime());
+
+ return ((timeAfter != null) && (timeAfter.equals(originalDate)));
+ }
+
+ /**
+ * Returns the next date/time after the given date/time which
+ * satisfies the cron expression.
+ *
+ * @param date the date/time at which to begin the search for the next valid
+ * date/time
+ * @return the next valid date/time
+ */
+ public Date getNextValidTimeAfter(Date date) {
+ return getTimeAfter(date);
+ }
+
+ /**
+ * Returns the next date/time after the given date/time which does
+ * not satisfy the expression
+ *
+ * @param date the date/time at which to begin the search for the next
+ * invalid date/time
+ * @return the next valid date/time
+ */
+ public Date getNextInvalidTimeAfter(Date date) {
+ long difference = 1000;
+
+ //move back to the nearest second so differences will be accurate
+ Calendar adjustCal = Calendar.getInstance(getTimeZone());
+ adjustCal.setTime(date);
+ adjustCal.set(Calendar.MILLISECOND, 0);
+ Date lastDate = adjustCal.getTime();
+
+ Date newDate;
+
+ //FUTURE_TODO: (QUARTZ-481) IMPROVE THIS! The following is a BAD solution to this problem. Performance will be very bad here, depending on the cron expression. It is, however A solution.
+
+ //keep getting the next included time until it's farther than one second
+ // apart. At that point, lastDate is the last valid fire time. We return
+ // the second immediately following it.
+ while (difference == 1000) {
+ newDate = getTimeAfter(lastDate);
+ if(newDate == null) {
+ break;
+ }
+ difference = newDate.getTime() - lastDate.getTime();
+
+ if (difference == 1000) {
+ lastDate = newDate;
+ }
+ }
+
+ return new Date(lastDate.getTime() + 1000);
+ }
+
+ /**
+ * Returns the time zone for which this CronExpression
+ * will be resolved.
+ */
+ public TimeZone getTimeZone() {
+ if (timeZone == null) {
+ timeZone = TimeZone.getDefault();
+ }
+
+ return timeZone;
+ }
+
+ /**
+ * Sets the time zone for which this CronExpression
+ * will be resolved.
+ */
+ public void setTimeZone(TimeZone timeZone) {
+ this.timeZone = timeZone;
+ }
+
+ /**
+ * Returns the string representation of the CronExpression
+ *
+ * @return a string representation of the CronExpression
+ */
+ @Override
+ public String toString() {
+ return cronExpression;
+ }
+
+ /**
+ * Indicates whether the specified cron expression can be parsed into a
+ * valid cron expression
+ *
+ * @param cronExpression the expression to evaluate
+ * @return a boolean indicating whether the given expression is a valid cron
+ * expression
+ */
+ public static boolean isValidExpression(String cronExpression) {
+
+ try {
+ new CronExpression(cronExpression);
+ } catch (ParseException pe) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static void validateExpression(String cronExpression) throws ParseException {
+
+ new CronExpression(cronExpression);
+ }
+
+
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Expression Parsing Functions
+ //
+ ////////////////////////////////////////////////////////////////////////////
+
+ protected void buildExpression(String expression) throws ParseException {
+ expressionParsed = true;
+
+ try {
+
+ if (seconds == null) {
+ seconds = new TreeSet();
+ }
+ if (minutes == null) {
+ minutes = new TreeSet();
+ }
+ if (hours == null) {
+ hours = new TreeSet();
+ }
+ if (daysOfMonth == null) {
+ daysOfMonth = new TreeSet();
+ }
+ if (months == null) {
+ months = new TreeSet();
+ }
+ if (daysOfWeek == null) {
+ daysOfWeek = new TreeSet();
+ }
+ if (years == null) {
+ years = new TreeSet();
+ }
+
+ int exprOn = SECOND;
+
+ StringTokenizer exprsTok = new StringTokenizer(expression, " \t",
+ false);
+
+ while (exprsTok.hasMoreTokens() && exprOn <= YEAR) {
+ String expr = exprsTok.nextToken().trim();
+
+ // throw an exception if L is used with other days of the month
+ if(exprOn == DAY_OF_MONTH && expr.indexOf('L') != -1 && expr.length() > 1 && expr.contains(",")) {
+ throw new ParseException("Support for specifying 'L' and 'LW' with other days of the month is not implemented", -1);
+ }
+ // throw an exception if L is used with other days of the week
+ if(exprOn == DAY_OF_WEEK && expr.indexOf('L') != -1 && expr.length() > 1 && expr.contains(",")) {
+ throw new ParseException("Support for specifying 'L' with other days of the week is not implemented", -1);
+ }
+ if(exprOn == DAY_OF_WEEK && expr.indexOf('#') != -1 && expr.indexOf('#', expr.indexOf('#') +1) != -1) {
+ throw new ParseException("Support for specifying multiple \"nth\" days is not implemented.", -1);
+ }
+
+ StringTokenizer vTok = new StringTokenizer(expr, ",");
+ while (vTok.hasMoreTokens()) {
+ String v = vTok.nextToken();
+ storeExpressionVals(0, v, exprOn);
+ }
+
+ exprOn++;
+ }
+
+ if (exprOn <= DAY_OF_WEEK) {
+ throw new ParseException("Unexpected end of expression.",
+ expression.length());
+ }
+
+ if (exprOn <= YEAR) {
+ storeExpressionVals(0, "*", YEAR);
+ }
+
+ TreeSet dow = getSet(DAY_OF_WEEK);
+ TreeSet dom = getSet(DAY_OF_MONTH);
+
+ // Copying the logic from the UnsupportedOperationException below
+ boolean dayOfMSpec = !dom.contains(NO_SPEC);
+ boolean dayOfWSpec = !dow.contains(NO_SPEC);
+
+ if (!dayOfMSpec || dayOfWSpec) {
+ if (!dayOfWSpec || dayOfMSpec) {
+ throw new ParseException(
+ "Support for specifying both a day-of-week AND a day-of-month parameter is not implemented.", 0);
+ }
+ }
+ } catch (ParseException pe) {
+ throw pe;
+ } catch (Exception e) {
+ throw new ParseException("Illegal cron expression format ("
+ + e.toString() + ")", 0);
+ }
+ }
+
+ protected int storeExpressionVals(int pos, String s, int type)
+ throws ParseException {
+
+ int incr = 0;
+ int i = skipWhiteSpace(pos, s);
+ if (i >= s.length()) {
+ return i;
+ }
+ char c = s.charAt(i);
+ if ((c >= 'A') && (c <= 'Z') && (!s.equals("L")) && (!s.equals("LW")) && (!s.matches("^L-[0-9]*[W]?"))) {
+ String sub = s.substring(i, i + 3);
+ int sval = -1;
+ int eval = -1;
+ if (type == MONTH) {
+ sval = getMonthNumber(sub) + 1;
+ if (sval <= 0) {
+ throw new ParseException("Invalid Month value: '" + sub + "'", i);
+ }
+ if (s.length() > i + 3) {
+ c = s.charAt(i + 3);
+ if (c == '-') {
+ i += 4;
+ sub = s.substring(i, i + 3);
+ eval = getMonthNumber(sub) + 1;
+ if (eval <= 0) {
+ throw new ParseException("Invalid Month value: '" + sub + "'", i);
+ }
+ }
+ }
+ } else if (type == DAY_OF_WEEK) {
+ sval = getDayOfWeekNumber(sub);
+ if (sval < 0) {
+ throw new ParseException("Invalid Day-of-Week value: '"
+ + sub + "'", i);
+ }
+ if (s.length() > i + 3) {
+ c = s.charAt(i + 3);
+ if (c == '-') {
+ i += 4;
+ sub = s.substring(i, i + 3);
+ eval = getDayOfWeekNumber(sub);
+ if (eval < 0) {
+ throw new ParseException(
+ "Invalid Day-of-Week value: '" + sub
+ + "'", i);
+ }
+ } else if (c == '#') {
+ try {
+ i += 4;
+ nthdayOfWeek = Integer.parseInt(s.substring(i));
+ if (nthdayOfWeek < 1 || nthdayOfWeek > 5) {
+ throw new Exception();
+ }
+ } catch (Exception e) {
+ throw new ParseException(
+ "A numeric value between 1 and 5 must follow the '#' option",
+ i);
+ }
+ } else if (c == 'L') {
+ lastdayOfWeek = true;
+ i++;
+ }
+ }
+
+ } else {
+ throw new ParseException(
+ "Illegal characters for this position: '" + sub + "'",
+ i);
+ }
+ if (eval != -1) {
+ incr = 1;
+ }
+ addToSet(sval, eval, incr, type);
+ return (i + 3);
+ }
+
+ if (c == '?') {
+ i++;
+ if ((i + 1) < s.length()
+ && (s.charAt(i) != ' ' && s.charAt(i + 1) != '\t')) {
+ throw new ParseException("Illegal character after '?': "
+ + s.charAt(i), i);
+ }
+ if (type != DAY_OF_WEEK && type != DAY_OF_MONTH) {
+ throw new ParseException(
+ "'?' can only be specified for Day-of-Month or Day-of-Week.",
+ i);
+ }
+ if (type == DAY_OF_WEEK && !lastdayOfMonth) {
+ int val = daysOfMonth.last();
+ if (val == NO_SPEC_INT) {
+ throw new ParseException(
+ "'?' can only be specified for Day-of-Month -OR- Day-of-Week.",
+ i);
+ }
+ }
+
+ addToSet(NO_SPEC_INT, -1, 0, type);
+ return i;
+ }
+
+ if (c == '*' || c == '/') {
+ if (c == '*' && (i + 1) >= s.length()) {
+ addToSet(ALL_SPEC_INT, -1, incr, type);
+ return i + 1;
+ } else if (c == '/'
+ && ((i + 1) >= s.length() || s.charAt(i + 1) == ' ' || s
+ .charAt(i + 1) == '\t')) {
+ throw new ParseException("'/' must be followed by an integer.", i);
+ } else if (c == '*') {
+ i++;
+ }
+ c = s.charAt(i);
+ if (c == '/') { // is an increment specified?
+ i++;
+ if (i >= s.length()) {
+ throw new ParseException("Unexpected end of string.", i);
+ }
+
+ incr = getNumericValue(s, i);
+
+ i++;
+ if (incr > 10) {
+ i++;
+ }
+ checkIncrementRange(incr, type, i);
+ } else {
+ incr = 1;
+ }
+
+ addToSet(ALL_SPEC_INT, -1, incr, type);
+ return i;
+ } else if (c == 'L') {
+ i++;
+ if (type == DAY_OF_MONTH) {
+ lastdayOfMonth = true;
+ }
+ if (type == DAY_OF_WEEK) {
+ addToSet(7, 7, 0, type);
+ }
+ if(type == DAY_OF_MONTH && s.length() > i) {
+ c = s.charAt(i);
+ if(c == '-') {
+ ValueSet vs = getValue(0, s, i+1);
+ lastdayOffset = vs.value;
+ if(lastdayOffset > 30) {
+ throw new ParseException("Offset from last day must be <= 30", i + 1);
+ }
+ i = vs.pos;
+ }
+ if(s.length() > i) {
+ c = s.charAt(i);
+ if(c == 'W') {
+ nearestWeekday = true;
+ i++;
+ }
+ }
+ }
+ return i;
+ } else if (c >= '0' && c <= '9') {
+ int val = Integer.parseInt(String.valueOf(c));
+ i++;
+ if (i >= s.length()) {
+ addToSet(val, -1, -1, type);
+ } else {
+ c = s.charAt(i);
+ if (c >= '0' && c <= '9') {
+ ValueSet vs = getValue(val, s, i);
+ val = vs.value;
+ i = vs.pos;
+ }
+ i = checkNext(i, s, val, type);
+ return i;
+ }
+ } else {
+ throw new ParseException("Unexpected character: " + c, i);
+ }
+
+ return i;
+ }
+
+ private void checkIncrementRange(int incr, int type, int idxPos) throws ParseException {
+ if (incr > 59 && (type == SECOND || type == MINUTE)) {
+ throw new ParseException("Increment > 60 : " + incr, idxPos);
+ } else if (incr > 23 && (type == HOUR)) {
+ throw new ParseException("Increment > 24 : " + incr, idxPos);
+ } else if (incr > 31 && (type == DAY_OF_MONTH)) {
+ throw new ParseException("Increment > 31 : " + incr, idxPos);
+ } else if (incr > 7 && (type == DAY_OF_WEEK)) {
+ throw new ParseException("Increment > 7 : " + incr, idxPos);
+ } else if (incr > 12 && (type == MONTH)) {
+ throw new ParseException("Increment > 12 : " + incr, idxPos);
+ }
+ }
+
+ protected int checkNext(int pos, String s, int val, int type)
+ throws ParseException {
+
+ int end = -1;
+ int i = pos;
+
+ if (i >= s.length()) {
+ addToSet(val, end, -1, type);
+ return i;
+ }
+
+ char c = s.charAt(pos);
+
+ if (c == 'L') {
+ if (type == DAY_OF_WEEK) {
+ if(val < 1 || val > 7) {
+ throw new ParseException("Day-of-Week values must be between 1 and 7", -1);
+ }
+ lastdayOfWeek = true;
+ } else {
+ throw new ParseException("'L' option is not valid here. (pos=" + i + ")", i);
+ }
+ TreeSet set = getSet(type);
+ set.add(val);
+ i++;
+ return i;
+ }
+
+ if (c == 'W') {
+ if (type == DAY_OF_MONTH) {
+ nearestWeekday = true;
+ } else {
+ throw new ParseException("'W' option is not valid here. (pos=" + i + ")", i);
+ }
+ if(val > 31) {
+ throw new ParseException("The 'W' option does not make sense with values larger than 31 (max number of days in a month)", i);
+ }
+ TreeSet set = getSet(type);
+ set.add(val);
+ i++;
+ return i;
+ }
+
+ if (c == '#') {
+ if (type != DAY_OF_WEEK) {
+ throw new ParseException("'#' option is not valid here. (pos=" + i + ")", i);
+ }
+ i++;
+ try {
+ nthdayOfWeek = Integer.parseInt(s.substring(i));
+ if (nthdayOfWeek < 1 || nthdayOfWeek > 5) {
+ throw new Exception();
+ }
+ } catch (Exception e) {
+ throw new ParseException(
+ "A numeric value between 1 and 5 must follow the '#' option",
+ i);
+ }
+
+ TreeSet set = getSet(type);
+ set.add(val);
+ i++;
+ return i;
+ }
+
+ if (c == '-') {
+ i++;
+ c = s.charAt(i);
+ int v = Integer.parseInt(String.valueOf(c));
+ end = v;
+ i++;
+ if (i >= s.length()) {
+ addToSet(val, end, 1, type);
+ return i;
+ }
+ c = s.charAt(i);
+ if (c >= '0' && c <= '9') {
+ ValueSet vs = getValue(v, s, i);
+ end = vs.value;
+ i = vs.pos;
+ }
+ if (i < s.length() && ((c = s.charAt(i)) == '/')) {
+ i++;
+ c = s.charAt(i);
+ int v2 = Integer.parseInt(String.valueOf(c));
+ i++;
+ if (i >= s.length()) {
+ addToSet(val, end, v2, type);
+ return i;
+ }
+ c = s.charAt(i);
+ if (c >= '0' && c <= '9') {
+ ValueSet vs = getValue(v2, s, i);
+ int v3 = vs.value;
+ addToSet(val, end, v3, type);
+ i = vs.pos;
+ return i;
+ } else {
+ addToSet(val, end, v2, type);
+ return i;
+ }
+ } else {
+ addToSet(val, end, 1, type);
+ return i;
+ }
+ }
+
+ if (c == '/') {
+ if ((i + 1) >= s.length() || s.charAt(i + 1) == ' ' || s.charAt(i + 1) == '\t') {
+ throw new ParseException("'/' must be followed by an integer.", i);
+ }
+
+ i++;
+ c = s.charAt(i);
+ int v2 = Integer.parseInt(String.valueOf(c));
+ i++;
+ if (i >= s.length()) {
+ checkIncrementRange(v2, type, i);
+ addToSet(val, end, v2, type);
+ return i;
+ }
+ c = s.charAt(i);
+ if (c >= '0' && c <= '9') {
+ ValueSet vs = getValue(v2, s, i);
+ int v3 = vs.value;
+ checkIncrementRange(v3, type, i);
+ addToSet(val, end, v3, type);
+ i = vs.pos;
+ return i;
+ } else {
+ throw new ParseException("Unexpected character '" + c + "' after '/'", i);
+ }
+ }
+
+ addToSet(val, end, 0, type);
+ i++;
+ return i;
+ }
+
+ public String getCronExpression() {
+ return cronExpression;
+ }
+
+ public String getExpressionSummary() {
+ StringBuilder buf = new StringBuilder();
+
+ buf.append("seconds: ");
+ buf.append(getExpressionSetSummary(seconds));
+ buf.append("\n");
+ buf.append("minutes: ");
+ buf.append(getExpressionSetSummary(minutes));
+ buf.append("\n");
+ buf.append("hours: ");
+ buf.append(getExpressionSetSummary(hours));
+ buf.append("\n");
+ buf.append("daysOfMonth: ");
+ buf.append(getExpressionSetSummary(daysOfMonth));
+ buf.append("\n");
+ buf.append("months: ");
+ buf.append(getExpressionSetSummary(months));
+ buf.append("\n");
+ buf.append("daysOfWeek: ");
+ buf.append(getExpressionSetSummary(daysOfWeek));
+ buf.append("\n");
+ buf.append("lastdayOfWeek: ");
+ buf.append(lastdayOfWeek);
+ buf.append("\n");
+ buf.append("nearestWeekday: ");
+ buf.append(nearestWeekday);
+ buf.append("\n");
+ buf.append("NthDayOfWeek: ");
+ buf.append(nthdayOfWeek);
+ buf.append("\n");
+ buf.append("lastdayOfMonth: ");
+ buf.append(lastdayOfMonth);
+ buf.append("\n");
+ buf.append("years: ");
+ buf.append(getExpressionSetSummary(years));
+ buf.append("\n");
+
+ return buf.toString();
+ }
+
+ protected String getExpressionSetSummary(java.util.Set set) {
+
+ if (set.contains(NO_SPEC)) {
+ return "?";
+ }
+ if (set.contains(ALL_SPEC)) {
+ return "*";
+ }
+
+ StringBuilder buf = new StringBuilder();
+
+ Iterator itr = set.iterator();
+ boolean first = true;
+ while (itr.hasNext()) {
+ Integer iVal = itr.next();
+ String val = iVal.toString();
+ if (!first) {
+ buf.append(",");
+ }
+ buf.append(val);
+ first = false;
+ }
+
+ return buf.toString();
+ }
+
+ protected String getExpressionSetSummary(java.util.ArrayList list) {
+
+ if (list.contains(NO_SPEC)) {
+ return "?";
+ }
+ if (list.contains(ALL_SPEC)) {
+ return "*";
+ }
+
+ StringBuilder buf = new StringBuilder();
+
+ Iterator itr = list.iterator();
+ boolean first = true;
+ while (itr.hasNext()) {
+ Integer iVal = itr.next();
+ String val = iVal.toString();
+ if (!first) {
+ buf.append(",");
+ }
+ buf.append(val);
+ first = false;
+ }
+
+ return buf.toString();
+ }
+
+ protected int skipWhiteSpace(int i, String s) {
+ for (; i < s.length() && (s.charAt(i) == ' ' || s.charAt(i) == '\t'); i++) {
+ }
+
+ return i;
+ }
+
+ protected int findNextWhiteSpace(int i, String s) {
+ for (; i < s.length() && (s.charAt(i) != ' ' || s.charAt(i) != '\t'); i++) {
+ }
+
+ return i;
+ }
+
+ protected void addToSet(int val, int end, int incr, int type)
+ throws ParseException {
+
+ TreeSet set = getSet(type);
+
+ if (type == SECOND || type == MINUTE) {
+ if ((val < 0 || val > 59 || end > 59) && (val != ALL_SPEC_INT)) {
+ throw new ParseException(
+ "Minute and Second values must be between 0 and 59",
+ -1);
+ }
+ } else if (type == HOUR) {
+ if ((val < 0 || val > 23 || end > 23) && (val != ALL_SPEC_INT)) {
+ throw new ParseException(
+ "Hour values must be between 0 and 23", -1);
+ }
+ } else if (type == DAY_OF_MONTH) {
+ if ((val < 1 || val > 31 || end > 31) && (val != ALL_SPEC_INT)
+ && (val != NO_SPEC_INT)) {
+ throw new ParseException(
+ "Day of month values must be between 1 and 31", -1);
+ }
+ } else if (type == MONTH) {
+ if ((val < 1 || val > 12 || end > 12) && (val != ALL_SPEC_INT)) {
+ throw new ParseException(
+ "Month values must be between 1 and 12", -1);
+ }
+ } else if (type == DAY_OF_WEEK) {
+ if ((val == 0 || val > 7 || end > 7) && (val != ALL_SPEC_INT)
+ && (val != NO_SPEC_INT)) {
+ throw new ParseException(
+ "Day-of-Week values must be between 1 and 7", -1);
+ }
+ }
+
+ if ((incr == 0 || incr == -1) && val != ALL_SPEC_INT) {
+ if (val != -1) {
+ set.add(val);
+ } else {
+ set.add(NO_SPEC);
+ }
+
+ return;
+ }
+
+ int startAt = val;
+ int stopAt = end;
+
+ if (val == ALL_SPEC_INT && incr <= 0) {
+ incr = 1;
+ set.add(ALL_SPEC); // put in a marker, but also fill values
+ }
+
+ if (type == SECOND || type == MINUTE) {
+ if (stopAt == -1) {
+ stopAt = 59;
+ }
+ if (startAt == -1 || startAt == ALL_SPEC_INT) {
+ startAt = 0;
+ }
+ } else if (type == HOUR) {
+ if (stopAt == -1) {
+ stopAt = 23;
+ }
+ if (startAt == -1 || startAt == ALL_SPEC_INT) {
+ startAt = 0;
+ }
+ } else if (type == DAY_OF_MONTH) {
+ if (stopAt == -1) {
+ stopAt = 31;
+ }
+ if (startAt == -1 || startAt == ALL_SPEC_INT) {
+ startAt = 1;
+ }
+ } else if (type == MONTH) {
+ if (stopAt == -1) {
+ stopAt = 12;
+ }
+ if (startAt == -1 || startAt == ALL_SPEC_INT) {
+ startAt = 1;
+ }
+ } else if (type == DAY_OF_WEEK) {
+ if (stopAt == -1) {
+ stopAt = 7;
+ }
+ if (startAt == -1 || startAt == ALL_SPEC_INT) {
+ startAt = 1;
+ }
+ } else if (type == YEAR) {
+ if (stopAt == -1) {
+ stopAt = MAX_YEAR;
+ }
+ if (startAt == -1 || startAt == ALL_SPEC_INT) {
+ startAt = 1970;
+ }
+ }
+
+ // if the end of the range is before the start, then we need to overflow into
+ // the next day, month etc. This is done by adding the maximum amount for that
+ // type, and using modulus max to determine the value being added.
+ int max = -1;
+ if (stopAt < startAt) {
+ switch (type) {
+ case SECOND : max = 60; break;
+ case MINUTE : max = 60; break;
+ case HOUR : max = 24; break;
+ case MONTH : max = 12; break;
+ case DAY_OF_WEEK : max = 7; break;
+ case DAY_OF_MONTH : max = 31; break;
+ case YEAR : throw new IllegalArgumentException("Start year must be less than stop year");
+ default : throw new IllegalArgumentException("Unexpected type encountered");
+ }
+ stopAt += max;
+ }
+
+ for (int i = startAt; i <= stopAt; i += incr) {
+ if (max == -1) {
+ // ie: there's no max to overflow over
+ set.add(i);
+ } else {
+ // take the modulus to get the real value
+ int i2 = i % max;
+
+ // 1-indexed ranges should not include 0, and should include their max
+ if (i2 == 0 && (type == MONTH || type == DAY_OF_WEEK || type == DAY_OF_MONTH) ) {
+ i2 = max;
+ }
+
+ set.add(i2);
+ }
+ }
+ }
+
+ TreeSet getSet(int type) {
+ switch (type) {
+ case SECOND:
+ return seconds;
+ case MINUTE:
+ return minutes;
+ case HOUR:
+ return hours;
+ case DAY_OF_MONTH:
+ return daysOfMonth;
+ case MONTH:
+ return months;
+ case DAY_OF_WEEK:
+ return daysOfWeek;
+ case YEAR:
+ return years;
+ default:
+ return null;
+ }
+ }
+
+ protected ValueSet getValue(int v, String s, int i) {
+ char c = s.charAt(i);
+ StringBuilder s1 = new StringBuilder(String.valueOf(v));
+ while (c >= '0' && c <= '9') {
+ s1.append(c);
+ i++;
+ if (i >= s.length()) {
+ break;
+ }
+ c = s.charAt(i);
+ }
+ ValueSet val = new ValueSet();
+
+ val.pos = (i < s.length()) ? i : i + 1;
+ val.value = Integer.parseInt(s1.toString());
+ return val;
+ }
+
+ protected int getNumericValue(String s, int i) {
+ int endOfVal = findNextWhiteSpace(i, s);
+ String val = s.substring(i, endOfVal);
+ return Integer.parseInt(val);
+ }
+
+ protected int getMonthNumber(String s) {
+ Integer integer = monthMap.get(s);
+
+ if (integer == null) {
+ return -1;
+ }
+
+ return integer;
+ }
+
+ protected int getDayOfWeekNumber(String s) {
+ Integer integer = dayMap.get(s);
+
+ if (integer == null) {
+ return -1;
+ }
+
+ return integer;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Computation Functions
+ //
+ ////////////////////////////////////////////////////////////////////////////
+
+ public Date getTimeAfter(Date afterTime) {
+
+ // Computation is based on Gregorian year only.
+ Calendar cl = new java.util.GregorianCalendar(getTimeZone());
+
+ // move ahead one second, since we're computing the time *after* the
+ // given time
+ afterTime = new Date(afterTime.getTime() + 1000);
+ // CronTrigger does not deal with milliseconds
+ cl.setTime(afterTime);
+ cl.set(Calendar.MILLISECOND, 0);
+
+ boolean gotOne = false;
+ // loop until we've computed the next time, or we've past the endTime
+ while (!gotOne) {
+
+ //if (endTime != null && cl.getTime().after(endTime)) return null;
+ if(cl.get(Calendar.YEAR) > 2999) { // prevent endless loop...
+ return null;
+ }
+
+ SortedSet st = null;
+ int t = 0;
+
+ int sec = cl.get(Calendar.SECOND);
+ int min = cl.get(Calendar.MINUTE);
+
+ // get second.................................................
+ st = seconds.tailSet(sec);
+ if (st != null && st.size() != 0) {
+ sec = st.first();
+ } else {
+ sec = seconds.first();
+ min++;
+ cl.set(Calendar.MINUTE, min);
+ }
+ cl.set(Calendar.SECOND, sec);
+
+ min = cl.get(Calendar.MINUTE);
+ int hr = cl.get(Calendar.HOUR_OF_DAY);
+ t = -1;
+
+ // get minute.................................................
+ st = minutes.tailSet(min);
+ if (st != null && st.size() != 0) {
+ t = min;
+ min = st.first();
+ } else {
+ min = minutes.first();
+ hr++;
+ }
+ if (min != t) {
+ cl.set(Calendar.SECOND, 0);
+ cl.set(Calendar.MINUTE, min);
+ setCalendarHour(cl, hr);
+ continue;
+ }
+ cl.set(Calendar.MINUTE, min);
+
+ hr = cl.get(Calendar.HOUR_OF_DAY);
+ int day = cl.get(Calendar.DAY_OF_MONTH);
+ t = -1;
+
+ // get hour...................................................
+ st = hours.tailSet(hr);
+ if (st != null && st.size() != 0) {
+ t = hr;
+ hr = st.first();
+ } else {
+ hr = hours.first();
+ day++;
+ }
+ if (hr != t) {
+ cl.set(Calendar.SECOND, 0);
+ cl.set(Calendar.MINUTE, 0);
+ cl.set(Calendar.DAY_OF_MONTH, day);
+ setCalendarHour(cl, hr);
+ continue;
+ }
+ cl.set(Calendar.HOUR_OF_DAY, hr);
+
+ day = cl.get(Calendar.DAY_OF_MONTH);
+ int mon = cl.get(Calendar.MONTH) + 1;
+ // '+ 1' because calendar is 0-based for this field, and we are
+ // 1-based
+ t = -1;
+ int tmon = mon;
+
+ // get day...................................................
+ boolean dayOfMSpec = !daysOfMonth.contains(NO_SPEC);
+ boolean dayOfWSpec = !daysOfWeek.contains(NO_SPEC);
+ if (dayOfMSpec && !dayOfWSpec) { // get day by day of month rule
+ st = daysOfMonth.tailSet(day);
+ if (lastdayOfMonth) {
+ if(!nearestWeekday) {
+ t = day;
+ day = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
+ day -= lastdayOffset;
+ if(t > day) {
+ mon++;
+ if(mon > 12) {
+ mon = 1;
+ tmon = 3333; // ensure test of mon != tmon further below fails
+ cl.add(Calendar.YEAR, 1);
+ }
+ day = 1;
+ }
+ } else {
+ t = day;
+ day = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
+ day -= lastdayOffset;
+
+ java.util.Calendar tcal = java.util.Calendar.getInstance(getTimeZone());
+ tcal.set(Calendar.SECOND, 0);
+ tcal.set(Calendar.MINUTE, 0);
+ tcal.set(Calendar.HOUR_OF_DAY, 0);
+ tcal.set(Calendar.DAY_OF_MONTH, day);
+ tcal.set(Calendar.MONTH, mon - 1);
+ tcal.set(Calendar.YEAR, cl.get(Calendar.YEAR));
+
+ int ldom = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
+ int dow = tcal.get(Calendar.DAY_OF_WEEK);
+
+ if(dow == Calendar.SATURDAY && day == 1) {
+ day += 2;
+ } else if(dow == Calendar.SATURDAY) {
+ day -= 1;
+ } else if(dow == Calendar.SUNDAY && day == ldom) {
+ day -= 2;
+ } else if(dow == Calendar.SUNDAY) {
+ day += 1;
+ }
+
+ tcal.set(Calendar.SECOND, sec);
+ tcal.set(Calendar.MINUTE, min);
+ tcal.set(Calendar.HOUR_OF_DAY, hr);
+ tcal.set(Calendar.DAY_OF_MONTH, day);
+ tcal.set(Calendar.MONTH, mon - 1);
+ Date nTime = tcal.getTime();
+ if(nTime.before(afterTime)) {
+ day = 1;
+ mon++;
+ }
+ }
+ } else if(nearestWeekday) {
+ t = day;
+ day = daysOfMonth.first();
+
+ java.util.Calendar tcal = java.util.Calendar.getInstance(getTimeZone());
+ tcal.set(Calendar.SECOND, 0);
+ tcal.set(Calendar.MINUTE, 0);
+ tcal.set(Calendar.HOUR_OF_DAY, 0);
+ tcal.set(Calendar.DAY_OF_MONTH, day);
+ tcal.set(Calendar.MONTH, mon - 1);
+ tcal.set(Calendar.YEAR, cl.get(Calendar.YEAR));
+
+ int ldom = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
+ int dow = tcal.get(Calendar.DAY_OF_WEEK);
+
+ if(dow == Calendar.SATURDAY && day == 1) {
+ day += 2;
+ } else if(dow == Calendar.SATURDAY) {
+ day -= 1;
+ } else if(dow == Calendar.SUNDAY && day == ldom) {
+ day -= 2;
+ } else if(dow == Calendar.SUNDAY) {
+ day += 1;
+ }
+
+
+ tcal.set(Calendar.SECOND, sec);
+ tcal.set(Calendar.MINUTE, min);
+ tcal.set(Calendar.HOUR_OF_DAY, hr);
+ tcal.set(Calendar.DAY_OF_MONTH, day);
+ tcal.set(Calendar.MONTH, mon - 1);
+ Date nTime = tcal.getTime();
+ if(nTime.before(afterTime)) {
+ day = daysOfMonth.first();
+ mon++;
+ }
+ } else if (st != null && st.size() != 0) {
+ t = day;
+ day = st.first();
+ // make sure we don't over-run a short month, such as february
+ int lastDay = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
+ if (day > lastDay) {
+ day = daysOfMonth.first();
+ mon++;
+ }
+ } else {
+ day = daysOfMonth.first();
+ mon++;
+ }
+
+ if (day != t || mon != tmon) {
+ cl.set(Calendar.SECOND, 0);
+ cl.set(Calendar.MINUTE, 0);
+ cl.set(Calendar.HOUR_OF_DAY, 0);
+ cl.set(Calendar.DAY_OF_MONTH, day);
+ cl.set(Calendar.MONTH, mon - 1);
+ // '- 1' because calendar is 0-based for this field, and we
+ // are 1-based
+ continue;
+ }
+ } else if (dayOfWSpec && !dayOfMSpec) { // get day by day of week rule
+ if (lastdayOfWeek) { // are we looking for the last XXX day of
+ // the month?
+ int dow = daysOfWeek.first(); // desired
+ // d-o-w
+ int cDow = cl.get(Calendar.DAY_OF_WEEK); // current d-o-w
+ int daysToAdd = 0;
+ if (cDow < dow) {
+ daysToAdd = dow - cDow;
+ }
+ if (cDow > dow) {
+ daysToAdd = dow + (7 - cDow);
+ }
+
+ int lDay = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
+
+ if (day + daysToAdd > lDay) { // did we already miss the
+ // last one?
+ cl.set(Calendar.SECOND, 0);
+ cl.set(Calendar.MINUTE, 0);
+ cl.set(Calendar.HOUR_OF_DAY, 0);
+ cl.set(Calendar.DAY_OF_MONTH, 1);
+ cl.set(Calendar.MONTH, mon);
+ // no '- 1' here because we are promoting the month
+ continue;
+ }
+
+ // find date of last occurrence of this day in this month...
+ while ((day + daysToAdd + 7) <= lDay) {
+ daysToAdd += 7;
+ }
+
+ day += daysToAdd;
+
+ if (daysToAdd > 0) {
+ cl.set(Calendar.SECOND, 0);
+ cl.set(Calendar.MINUTE, 0);
+ cl.set(Calendar.HOUR_OF_DAY, 0);
+ cl.set(Calendar.DAY_OF_MONTH, day);
+ cl.set(Calendar.MONTH, mon - 1);
+ // '- 1' here because we are not promoting the month
+ continue;
+ }
+
+ } else if (nthdayOfWeek != 0) {
+ // are we looking for the Nth XXX day in the month?
+ int dow = daysOfWeek.first(); // desired
+ // d-o-w
+ int cDow = cl.get(Calendar.DAY_OF_WEEK); // current d-o-w
+ int daysToAdd = 0;
+ if (cDow < dow) {
+ daysToAdd = dow - cDow;
+ } else if (cDow > dow) {
+ daysToAdd = dow + (7 - cDow);
+ }
+
+ boolean dayShifted = false;
+ if (daysToAdd > 0) {
+ dayShifted = true;
+ }
+
+ day += daysToAdd;
+ int weekOfMonth = day / 7;
+ if (day % 7 > 0) {
+ weekOfMonth++;
+ }
+
+ daysToAdd = (nthdayOfWeek - weekOfMonth) * 7;
+ day += daysToAdd;
+ if (daysToAdd < 0
+ || day > getLastDayOfMonth(mon, cl
+ .get(Calendar.YEAR))) {
+ cl.set(Calendar.SECOND, 0);
+ cl.set(Calendar.MINUTE, 0);
+ cl.set(Calendar.HOUR_OF_DAY, 0);
+ cl.set(Calendar.DAY_OF_MONTH, 1);
+ cl.set(Calendar.MONTH, mon);
+ // no '- 1' here because we are promoting the month
+ continue;
+ } else if (daysToAdd > 0 || dayShifted) {
+ cl.set(Calendar.SECOND, 0);
+ cl.set(Calendar.MINUTE, 0);
+ cl.set(Calendar.HOUR_OF_DAY, 0);
+ cl.set(Calendar.DAY_OF_MONTH, day);
+ cl.set(Calendar.MONTH, mon - 1);
+ // '- 1' here because we are NOT promoting the month
+ continue;
+ }
+ } else {
+ int cDow = cl.get(Calendar.DAY_OF_WEEK); // current d-o-w
+ int dow = daysOfWeek.first(); // desired
+ // d-o-w
+ st = daysOfWeek.tailSet(cDow);
+ if (st != null && st.size() > 0) {
+ dow = st.first();
+ }
+
+ int daysToAdd = 0;
+ if (cDow < dow) {
+ daysToAdd = dow - cDow;
+ }
+ if (cDow > dow) {
+ daysToAdd = dow + (7 - cDow);
+ }
+
+ int lDay = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
+
+ if (day + daysToAdd > lDay) { // will we pass the end of
+ // the month?
+ cl.set(Calendar.SECOND, 0);
+ cl.set(Calendar.MINUTE, 0);
+ cl.set(Calendar.HOUR_OF_DAY, 0);
+ cl.set(Calendar.DAY_OF_MONTH, 1);
+ cl.set(Calendar.MONTH, mon);
+ // no '- 1' here because we are promoting the month
+ continue;
+ } else if (daysToAdd > 0) { // are we swithing days?
+ cl.set(Calendar.SECOND, 0);
+ cl.set(Calendar.MINUTE, 0);
+ cl.set(Calendar.HOUR_OF_DAY, 0);
+ cl.set(Calendar.DAY_OF_MONTH, day + daysToAdd);
+ cl.set(Calendar.MONTH, mon - 1);
+ // '- 1' because calendar is 0-based for this field,
+ // and we are 1-based
+ continue;
+ }
+ }
+ } else { // dayOfWSpec && !dayOfMSpec
+ throw new UnsupportedOperationException(
+ "Support for specifying both a day-of-week AND a day-of-month parameter is not implemented.");
+ }
+ cl.set(Calendar.DAY_OF_MONTH, day);
+
+ mon = cl.get(Calendar.MONTH) + 1;
+ // '+ 1' because calendar is 0-based for this field, and we are
+ // 1-based
+ int year = cl.get(Calendar.YEAR);
+ t = -1;
+
+ // test for expressions that never generate a valid fire date,
+ // but keep looping...
+ if (year > MAX_YEAR) {
+ return null;
+ }
+
+ // get month...................................................
+ st = months.tailSet(mon);
+ if (st != null && st.size() != 0) {
+ t = mon;
+ mon = st.first();
+ } else {
+ mon = months.first();
+ year++;
+ }
+ if (mon != t) {
+ cl.set(Calendar.SECOND, 0);
+ cl.set(Calendar.MINUTE, 0);
+ cl.set(Calendar.HOUR_OF_DAY, 0);
+ cl.set(Calendar.DAY_OF_MONTH, 1);
+ cl.set(Calendar.MONTH, mon - 1);
+ // '- 1' because calendar is 0-based for this field, and we are
+ // 1-based
+ cl.set(Calendar.YEAR, year);
+ continue;
+ }
+ cl.set(Calendar.MONTH, mon - 1);
+ // '- 1' because calendar is 0-based for this field, and we are
+ // 1-based
+
+ year = cl.get(Calendar.YEAR);
+ t = -1;
+
+ // get year...................................................
+ st = years.tailSet(year);
+ if (st != null && st.size() != 0) {
+ t = year;
+ year = st.first();
+ } else {
+ return null; // ran out of years...
+ }
+
+ if (year != t) {
+ cl.set(Calendar.SECOND, 0);
+ cl.set(Calendar.MINUTE, 0);
+ cl.set(Calendar.HOUR_OF_DAY, 0);
+ cl.set(Calendar.DAY_OF_MONTH, 1);
+ cl.set(Calendar.MONTH, 0);
+ // '- 1' because calendar is 0-based for this field, and we are
+ // 1-based
+ cl.set(Calendar.YEAR, year);
+ continue;
+ }
+ cl.set(Calendar.YEAR, year);
+
+ gotOne = true;
+ } // while( !done )
+
+ return cl.getTime();
+ }
+
+ /**
+ * Advance the calendar to the particular hour paying particular attention
+ * to daylight saving problems.
+ *
+ * @param cal the calendar to operate on
+ * @param hour the hour to set
+ */
+ protected void setCalendarHour(Calendar cal, int hour) {
+ cal.set(java.util.Calendar.HOUR_OF_DAY, hour);
+ if (cal.get(java.util.Calendar.HOUR_OF_DAY) != hour && hour != 24) {
+ cal.set(java.util.Calendar.HOUR_OF_DAY, hour + 1);
+ }
+ }
+
+ /**
+ * NOT YET IMPLEMENTED: Returns the time before the given time
+ * that the CronExpression
matches.
+ */
+ public Date getTimeBefore(Date endTime) {
+ // FUTURE_TODO: implement QUARTZ-423
+ return null;
+ }
+
+ /**
+ * NOT YET IMPLEMENTED: Returns the final time that the
+ * CronExpression
will match.
+ */
+ public Date getFinalFireTime() {
+ // FUTURE_TODO: implement QUARTZ-423
+ return null;
+ }
+
+ protected boolean isLeapYear(int year) {
+ return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0));
+ }
+
+ protected int getLastDayOfMonth(int monthNum, int year) {
+
+ switch (monthNum) {
+ case 1:
+ return 31;
+ case 2:
+ return (isLeapYear(year)) ? 29 : 28;
+ case 3:
+ return 31;
+ case 4:
+ return 30;
+ case 5:
+ return 31;
+ case 6:
+ return 30;
+ case 7:
+ return 31;
+ case 8:
+ return 31;
+ case 9:
+ return 30;
+ case 10:
+ return 31;
+ case 11:
+ return 30;
+ case 12:
+ return 31;
+ default:
+ throw new IllegalArgumentException("Illegal month number: "
+ + monthNum);
+ }
+ }
+
+
+ private void readObject(java.io.ObjectInputStream stream)
+ throws java.io.IOException, ClassNotFoundException {
+
+ stream.defaultReadObject();
+ try {
+ buildExpression(cronExpression);
+ } catch (Exception ignore) {
+ } // never happens
+ }
+
+ @Override
+ @Deprecated
+ public Object clone() {
+ return new CronExpression(this);
+ }
+}
+
+class ValueSet {
+ public int value;
+
+ public int pos;
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/exception/XxlJobException.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/exception/XxlJobException.java
new file mode 100644
index 0000000..faa6063
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/exception/XxlJobException.java
@@ -0,0 +1,14 @@
+package com.xxl.job.admin.core.exception;
+
+/**
+ * @author xuxueli 2019-05-04 23:19:29
+ */
+public class XxlJobException extends RuntimeException {
+
+ public XxlJobException() {
+ }
+ public XxlJobException(String message) {
+ super(message);
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobGroup.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobGroup.java
new file mode 100644
index 0000000..dde4b39
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobGroup.java
@@ -0,0 +1,77 @@
+package com.xxl.job.admin.core.model;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Created by xuxueli on 16/9/30.
+ */
+public class XxlJobGroup {
+
+ private int id;
+ private String appname;
+ private String title;
+ private int addressType; // 执行器地址类型:0=自动注册、1=手动录入
+ private String addressList; // 执行器地址列表,多地址逗号分隔(手动录入)
+ private Date updateTime;
+
+ // registry list
+ private List registryList; // 执行器地址列表(系统注册)
+ public List getRegistryList() {
+ if (addressList!=null && addressList.trim().length()>0) {
+ registryList = new ArrayList(Arrays.asList(addressList.split(",")));
+ }
+ return registryList;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getAppname() {
+ return appname;
+ }
+
+ public void setAppname(String appname) {
+ this.appname = appname;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public int getAddressType() {
+ return addressType;
+ }
+
+ public void setAddressType(int addressType) {
+ this.addressType = addressType;
+ }
+
+ public String getAddressList() {
+ return addressList;
+ }
+
+ public Date getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Date updateTime) {
+ this.updateTime = updateTime;
+ }
+
+ public void setAddressList(String addressList) {
+ this.addressList = addressList;
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobInfo.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobInfo.java
new file mode 100644
index 0000000..e47b6dc
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobInfo.java
@@ -0,0 +1,237 @@
+package com.xxl.job.admin.core.model;
+
+import java.util.Date;
+
+/**
+ * xxl-job info
+ *
+ * @author xuxueli 2016-1-12 18:25:49
+ */
+public class XxlJobInfo {
+
+ private int id; // 主键ID
+
+ private int jobGroup; // 执行器主键ID
+ private String jobDesc;
+
+ private Date addTime;
+ private Date updateTime;
+
+ private String author; // 负责人
+ private String alarmEmail; // 报警邮件
+
+ private String scheduleType; // 调度类型
+ private String scheduleConf; // 调度配置,值含义取决于调度类型
+ private String misfireStrategy; // 调度过期策略
+
+ private String executorRouteStrategy; // 执行器路由策略
+ private String executorHandler; // 执行器,任务Handler名称
+ private String executorParam; // 执行器,任务参数
+ private String executorBlockStrategy; // 阻塞处理策略
+ private int executorTimeout; // 任务执行超时时间,单位秒
+ private int executorFailRetryCount; // 失败重试次数
+
+ private String glueType; // GLUE类型 #com.xxl.job.core.glue.GlueTypeEnum
+ private String glueSource; // GLUE源代码
+ private String glueRemark; // GLUE备注
+ private Date glueUpdatetime; // GLUE更新时间
+
+ private String childJobId; // 子任务ID,多个逗号分隔
+
+ private int triggerStatus; // 调度状态:0-停止,1-运行
+ private long triggerLastTime; // 上次调度时间
+ private long triggerNextTime; // 下次调度时间
+
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public int getJobGroup() {
+ return jobGroup;
+ }
+
+ public void setJobGroup(int jobGroup) {
+ this.jobGroup = jobGroup;
+ }
+
+ public String getJobDesc() {
+ return jobDesc;
+ }
+
+ public void setJobDesc(String jobDesc) {
+ this.jobDesc = jobDesc;
+ }
+
+ public Date getAddTime() {
+ return addTime;
+ }
+
+ public void setAddTime(Date addTime) {
+ this.addTime = addTime;
+ }
+
+ public Date getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Date updateTime) {
+ this.updateTime = updateTime;
+ }
+
+ public String getAuthor() {
+ return author;
+ }
+
+ public void setAuthor(String author) {
+ this.author = author;
+ }
+
+ public String getAlarmEmail() {
+ return alarmEmail;
+ }
+
+ public void setAlarmEmail(String alarmEmail) {
+ this.alarmEmail = alarmEmail;
+ }
+
+ public String getScheduleType() {
+ return scheduleType;
+ }
+
+ public void setScheduleType(String scheduleType) {
+ this.scheduleType = scheduleType;
+ }
+
+ public String getScheduleConf() {
+ return scheduleConf;
+ }
+
+ public void setScheduleConf(String scheduleConf) {
+ this.scheduleConf = scheduleConf;
+ }
+
+ public String getMisfireStrategy() {
+ return misfireStrategy;
+ }
+
+ public void setMisfireStrategy(String misfireStrategy) {
+ this.misfireStrategy = misfireStrategy;
+ }
+
+ public String getExecutorRouteStrategy() {
+ return executorRouteStrategy;
+ }
+
+ public void setExecutorRouteStrategy(String executorRouteStrategy) {
+ this.executorRouteStrategy = executorRouteStrategy;
+ }
+
+ public String getExecutorHandler() {
+ return executorHandler;
+ }
+
+ public void setExecutorHandler(String executorHandler) {
+ this.executorHandler = executorHandler;
+ }
+
+ public String getExecutorParam() {
+ return executorParam;
+ }
+
+ public void setExecutorParam(String executorParam) {
+ this.executorParam = executorParam;
+ }
+
+ public String getExecutorBlockStrategy() {
+ return executorBlockStrategy;
+ }
+
+ public void setExecutorBlockStrategy(String executorBlockStrategy) {
+ this.executorBlockStrategy = executorBlockStrategy;
+ }
+
+ public int getExecutorTimeout() {
+ return executorTimeout;
+ }
+
+ public void setExecutorTimeout(int executorTimeout) {
+ this.executorTimeout = executorTimeout;
+ }
+
+ public int getExecutorFailRetryCount() {
+ return executorFailRetryCount;
+ }
+
+ public void setExecutorFailRetryCount(int executorFailRetryCount) {
+ this.executorFailRetryCount = executorFailRetryCount;
+ }
+
+ public String getGlueType() {
+ return glueType;
+ }
+
+ public void setGlueType(String glueType) {
+ this.glueType = glueType;
+ }
+
+ public String getGlueSource() {
+ return glueSource;
+ }
+
+ public void setGlueSource(String glueSource) {
+ this.glueSource = glueSource;
+ }
+
+ public String getGlueRemark() {
+ return glueRemark;
+ }
+
+ public void setGlueRemark(String glueRemark) {
+ this.glueRemark = glueRemark;
+ }
+
+ public Date getGlueUpdatetime() {
+ return glueUpdatetime;
+ }
+
+ public void setGlueUpdatetime(Date glueUpdatetime) {
+ this.glueUpdatetime = glueUpdatetime;
+ }
+
+ public String getChildJobId() {
+ return childJobId;
+ }
+
+ public void setChildJobId(String childJobId) {
+ this.childJobId = childJobId;
+ }
+
+ public int getTriggerStatus() {
+ return triggerStatus;
+ }
+
+ public void setTriggerStatus(int triggerStatus) {
+ this.triggerStatus = triggerStatus;
+ }
+
+ public long getTriggerLastTime() {
+ return triggerLastTime;
+ }
+
+ public void setTriggerLastTime(long triggerLastTime) {
+ this.triggerLastTime = triggerLastTime;
+ }
+
+ public long getTriggerNextTime() {
+ return triggerNextTime;
+ }
+
+ public void setTriggerNextTime(long triggerNextTime) {
+ this.triggerNextTime = triggerNextTime;
+ }
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLog.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLog.java
new file mode 100644
index 0000000..7d3072a
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLog.java
@@ -0,0 +1,157 @@
+package com.xxl.job.admin.core.model;
+
+import java.util.Date;
+
+/**
+ * xxl-job log, used to track trigger process
+ * @author xuxueli 2015-12-19 23:19:09
+ */
+public class XxlJobLog {
+
+ private long id;
+
+ // job info
+ private int jobGroup;
+ private int jobId;
+
+ // execute info
+ private String executorAddress;
+ private String executorHandler;
+ private String executorParam;
+ private String executorShardingParam;
+ private int executorFailRetryCount;
+
+ // trigger info
+ private Date triggerTime;
+ private int triggerCode;
+ private String triggerMsg;
+
+ // handle info
+ private Date handleTime;
+ private int handleCode;
+ private String handleMsg;
+
+ // alarm info
+ private int alarmStatus;
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public int getJobGroup() {
+ return jobGroup;
+ }
+
+ public void setJobGroup(int jobGroup) {
+ this.jobGroup = jobGroup;
+ }
+
+ public int getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(int jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getExecutorAddress() {
+ return executorAddress;
+ }
+
+ public void setExecutorAddress(String executorAddress) {
+ this.executorAddress = executorAddress;
+ }
+
+ public String getExecutorHandler() {
+ return executorHandler;
+ }
+
+ public void setExecutorHandler(String executorHandler) {
+ this.executorHandler = executorHandler;
+ }
+
+ public String getExecutorParam() {
+ return executorParam;
+ }
+
+ public void setExecutorParam(String executorParam) {
+ this.executorParam = executorParam;
+ }
+
+ public String getExecutorShardingParam() {
+ return executorShardingParam;
+ }
+
+ public void setExecutorShardingParam(String executorShardingParam) {
+ this.executorShardingParam = executorShardingParam;
+ }
+
+ public int getExecutorFailRetryCount() {
+ return executorFailRetryCount;
+ }
+
+ public void setExecutorFailRetryCount(int executorFailRetryCount) {
+ this.executorFailRetryCount = executorFailRetryCount;
+ }
+
+ public Date getTriggerTime() {
+ return triggerTime;
+ }
+
+ public void setTriggerTime(Date triggerTime) {
+ this.triggerTime = triggerTime;
+ }
+
+ public int getTriggerCode() {
+ return triggerCode;
+ }
+
+ public void setTriggerCode(int triggerCode) {
+ this.triggerCode = triggerCode;
+ }
+
+ public String getTriggerMsg() {
+ return triggerMsg;
+ }
+
+ public void setTriggerMsg(String triggerMsg) {
+ this.triggerMsg = triggerMsg;
+ }
+
+ public Date getHandleTime() {
+ return handleTime;
+ }
+
+ public void setHandleTime(Date handleTime) {
+ this.handleTime = handleTime;
+ }
+
+ public int getHandleCode() {
+ return handleCode;
+ }
+
+ public void setHandleCode(int handleCode) {
+ this.handleCode = handleCode;
+ }
+
+ public String getHandleMsg() {
+ return handleMsg;
+ }
+
+ public void setHandleMsg(String handleMsg) {
+ this.handleMsg = handleMsg;
+ }
+
+ public int getAlarmStatus() {
+ return alarmStatus;
+ }
+
+ public void setAlarmStatus(int alarmStatus) {
+ this.alarmStatus = alarmStatus;
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLogGlue.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLogGlue.java
new file mode 100644
index 0000000..2f59ffa
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLogGlue.java
@@ -0,0 +1,75 @@
+package com.xxl.job.admin.core.model;
+
+import java.util.Date;
+
+/**
+ * xxl-job log for glue, used to track job code process
+ * @author xuxueli 2016-5-19 17:57:46
+ */
+public class XxlJobLogGlue {
+
+ private int id;
+ private int jobId; // 任务主键ID
+ private String glueType; // GLUE类型 #com.xxl.job.core.glue.GlueTypeEnum
+ private String glueSource;
+ private String glueRemark;
+ private Date addTime;
+ private Date updateTime;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public int getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(int jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getGlueType() {
+ return glueType;
+ }
+
+ public void setGlueType(String glueType) {
+ this.glueType = glueType;
+ }
+
+ public String getGlueSource() {
+ return glueSource;
+ }
+
+ public void setGlueSource(String glueSource) {
+ this.glueSource = glueSource;
+ }
+
+ public String getGlueRemark() {
+ return glueRemark;
+ }
+
+ public void setGlueRemark(String glueRemark) {
+ this.glueRemark = glueRemark;
+ }
+
+ public Date getAddTime() {
+ return addTime;
+ }
+
+ public void setAddTime(Date addTime) {
+ this.addTime = addTime;
+ }
+
+ public Date getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Date updateTime) {
+ this.updateTime = updateTime;
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLogReport.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLogReport.java
new file mode 100644
index 0000000..e58ff1a
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLogReport.java
@@ -0,0 +1,54 @@
+package com.xxl.job.admin.core.model;
+
+import java.util.Date;
+
+public class XxlJobLogReport {
+
+ private int id;
+
+ private Date triggerDay;
+
+ private int runningCount;
+ private int sucCount;
+ private int failCount;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public Date getTriggerDay() {
+ return triggerDay;
+ }
+
+ public void setTriggerDay(Date triggerDay) {
+ this.triggerDay = triggerDay;
+ }
+
+ public int getRunningCount() {
+ return runningCount;
+ }
+
+ public void setRunningCount(int runningCount) {
+ this.runningCount = runningCount;
+ }
+
+ public int getSucCount() {
+ return sucCount;
+ }
+
+ public void setSucCount(int sucCount) {
+ this.sucCount = sucCount;
+ }
+
+ public int getFailCount() {
+ return failCount;
+ }
+
+ public void setFailCount(int failCount) {
+ this.failCount = failCount;
+ }
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobRegistry.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobRegistry.java
new file mode 100644
index 0000000..924d6d3
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobRegistry.java
@@ -0,0 +1,55 @@
+package com.xxl.job.admin.core.model;
+
+import java.util.Date;
+
+/**
+ * Created by xuxueli on 16/9/30.
+ */
+public class XxlJobRegistry {
+
+ private int id;
+ private String registryGroup;
+ private String registryKey;
+ private String registryValue;
+ private Date updateTime;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getRegistryGroup() {
+ return registryGroup;
+ }
+
+ public void setRegistryGroup(String registryGroup) {
+ this.registryGroup = registryGroup;
+ }
+
+ public String getRegistryKey() {
+ return registryKey;
+ }
+
+ public void setRegistryKey(String registryKey) {
+ this.registryKey = registryKey;
+ }
+
+ public String getRegistryValue() {
+ return registryValue;
+ }
+
+ public void setRegistryValue(String registryValue) {
+ this.registryValue = registryValue;
+ }
+
+ public Date getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(Date updateTime) {
+ this.updateTime = updateTime;
+ }
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobUser.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobUser.java
new file mode 100644
index 0000000..db17327
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobUser.java
@@ -0,0 +1,73 @@
+package com.xxl.job.admin.core.model;
+
+import org.springframework.util.StringUtils;
+
+/**
+ * @author xuxueli 2019-05-04 16:43:12
+ */
+public class XxlJobUser {
+
+ private int id;
+ private String username; // 账号
+ private String password; // 密码
+ private int role; // 角色:0-普通用户、1-管理员
+ private String permission; // 权限:执行器ID列表,多个逗号分割
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public int getRole() {
+ return role;
+ }
+
+ public void setRole(int role) {
+ this.role = role;
+ }
+
+ public String getPermission() {
+ return permission;
+ }
+
+ public void setPermission(String permission) {
+ this.permission = permission;
+ }
+
+ // plugin
+ public boolean validPermission(int jobGroup){
+ if (this.role == 1) {
+ return true;
+ } else {
+ if (StringUtils.hasText(this.permission)) {
+ for (String permissionItem : this.permission.split(",")) {
+ if (String.valueOf(jobGroup).equals(permissionItem)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/old/RemoteHttpJobBean.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/old/RemoteHttpJobBean.java
new file mode 100644
index 0000000..b2dd151
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/old/RemoteHttpJobBean.java
@@ -0,0 +1,32 @@
+//package com.xxl.job.admin.core.jobbean;
+//
+//import com.xxl.job.admin.core.thread.JobTriggerPoolHelper;
+//import com.xxl.job.admin.core.trigger.TriggerTypeEnum;
+//import org.quartz.JobExecutionContext;
+//import org.quartz.JobExecutionException;
+//import org.quartz.JobKey;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//import org.springframework.scheduling.quartz.QuartzJobBean;
+//
+///**
+// * http job bean
+// * “@DisallowConcurrentExecution” disable concurrent, thread size can not be only one, better given more
+// * @author xuxueli 2015-12-17 18:20:34
+// */
+////@DisallowConcurrentExecution
+//public class RemoteHttpJobBean extends QuartzJobBean {
+// private static Logger logger = LoggerFactory.getLogger(RemoteHttpJobBean.class);
+//
+// @Override
+// protected void executeInternal(JobExecutionContext context)
+// throws JobExecutionException {
+//
+// // load jobId
+// JobKey jobKey = context.getTrigger().getJobKey();
+// Integer jobId = Integer.valueOf(jobKey.getName());
+//
+//
+// }
+//
+//}
\ No newline at end of file
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/old/XxlJobDynamicScheduler.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/old/XxlJobDynamicScheduler.java
new file mode 100644
index 0000000..1e62aa1
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/old/XxlJobDynamicScheduler.java
@@ -0,0 +1,413 @@
+//package com.xxl.job.admin.core.schedule;
+//
+//import com.xxl.job.admin.core.conf.XxlJobAdminConfig;
+//import com.xxl.job.admin.core.jobbean.RemoteHttpJobBean;
+//import com.xxl.job.admin.core.model.XxlJobInfo;
+//import com.xxl.job.admin.core.thread.JobFailMonitorHelper;
+//import com.xxl.job.admin.core.thread.JobRegistryMonitorHelper;
+//import com.xxl.job.admin.core.thread.JobTriggerPoolHelper;
+//import com.xxl.job.admin.core.util.I18nUtil;
+//import com.xxl.job.core.biz.AdminBiz;
+//import com.xxl.job.core.biz.ExecutorBiz;
+//import com.xxl.job.core.enums.ExecutorBlockStrategyEnum;
+//import com.xxl.rpc.remoting.invoker.XxlRpcInvokerFactory;
+//import com.xxl.rpc.remoting.invoker.call.CallType;
+//import com.xxl.rpc.remoting.invoker.reference.XxlRpcReferenceBean;
+//import com.xxl.rpc.remoting.invoker.route.LoadBalance;
+//import com.xxl.rpc.remoting.net.NetEnum;
+//import com.xxl.rpc.remoting.net.impl.servlet.server.ServletServerHandler;
+//import com.xxl.rpc.remoting.provider.XxlRpcProviderFactory;
+//import com.xxl.rpc.serialize.Serializer;
+//import org.quartz.*;
+//import org.quartz.Trigger.TriggerState;
+//import org.quartz.impl.triggers.CronTriggerImpl;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//import org.springframework.util.Assert;
+//
+//import javax.servlet.ServletException;
+//import javax.servlet.http.HttpServletRequest;
+//import javax.servlet.http.HttpServletResponse;
+//import java.io.IOException;
+//import java.util.Date;
+//import java.util.concurrent.ConcurrentHashMap;
+//
+///**
+// * base quartz scheduler util
+// * @author xuxueli 2015-12-19 16:13:53
+// */
+//public final class XxlJobDynamicScheduler {
+// private static final Logger logger = LoggerFactory.getLogger(XxlJobDynamicScheduler_old.class);
+//
+// // ---------------------- param ----------------------
+//
+// // scheduler
+// private static Scheduler scheduler;
+// public void setScheduler(Scheduler scheduler) {
+// XxlJobDynamicScheduler_old.scheduler = scheduler;
+// }
+//
+//
+// // ---------------------- init + destroy ----------------------
+// public void start() throws Exception {
+// // valid
+// Assert.notNull(scheduler, "quartz scheduler is null");
+//
+// // init i18n
+// initI18n();
+//
+// // admin registry monitor run
+// JobRegistryMonitorHelper.getInstance().start();
+//
+// // admin monitor run
+// JobFailMonitorHelper.getInstance().start();
+//
+// // admin-server
+// initRpcProvider();
+//
+// logger.info(">>>>>>>>> init xxl-job admin success.");
+// }
+//
+//
+// public void destroy() throws Exception {
+// // admin trigger pool stop
+// JobTriggerPoolHelper.toStop();
+//
+// // admin registry stop
+// JobRegistryMonitorHelper.getInstance().toStop();
+//
+// // admin monitor stop
+// JobFailMonitorHelper.getInstance().toStop();
+//
+// // admin-server
+// stopRpcProvider();
+// }
+//
+//
+// // ---------------------- I18n ----------------------
+//
+// private void initI18n(){
+// for (ExecutorBlockStrategyEnum item:ExecutorBlockStrategyEnum.values()) {
+// item.setTitle(I18nUtil.getString("jobconf_block_".concat(item.name())));
+// }
+// }
+//
+//
+// // ---------------------- admin rpc provider (no server version) ----------------------
+// private static ServletServerHandler servletServerHandler;
+// private void initRpcProvider(){
+// // init
+// XxlRpcProviderFactory xxlRpcProviderFactory = new XxlRpcProviderFactory();
+// xxlRpcProviderFactory.initConfig(
+// NetEnum.NETTY_HTTP,
+// Serializer.SerializeEnum.HESSIAN.getSerializer(),
+// null,
+// 0,
+// XxlJobAdminConfig.getAdminConfig().getAccessToken(),
+// null,
+// null);
+//
+// // add services
+// xxlRpcProviderFactory.addService(AdminBiz.class.getName(), null, XxlJobAdminConfig.getAdminConfig().getAdminBiz());
+//
+// // servlet handler
+// servletServerHandler = new ServletServerHandler(xxlRpcProviderFactory);
+// }
+// private void stopRpcProvider() throws Exception {
+// XxlRpcInvokerFactory.getInstance().stop();
+// }
+// public static void invokeAdminService(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
+// servletServerHandler.handle(null, request, response);
+// }
+//
+//
+// // ---------------------- executor-client ----------------------
+// private static ConcurrentHashMap executorBizRepository = new ConcurrentHashMap();
+// public static ExecutorBiz getExecutorBiz(String address) throws Exception {
+// // valid
+// if (address==null || address.trim().length()==0) {
+// return null;
+// }
+//
+// // load-cache
+// address = address.trim();
+// ExecutorBiz executorBiz = executorBizRepository.get(address);
+// if (executorBiz != null) {
+// return executorBiz;
+// }
+//
+// // set-cache
+// executorBiz = (ExecutorBiz) new XxlRpcReferenceBean(
+// NetEnum.NETTY_HTTP,
+// Serializer.SerializeEnum.HESSIAN.getSerializer(),
+// CallType.SYNC,
+// LoadBalance.ROUND,
+// ExecutorBiz.class,
+// null,
+// 5000,
+// address,
+// XxlJobAdminConfig.getAdminConfig().getAccessToken(),
+// null,
+// null).getObject();
+//
+// executorBizRepository.put(address, executorBiz);
+// return executorBiz;
+// }
+//
+//
+// // ---------------------- schedule util ----------------------
+//
+// /**
+// * fill job info
+// *
+// * @param jobInfo
+// */
+// public static void fillJobInfo(XxlJobInfo jobInfo) {
+//
+// String name = String.valueOf(jobInfo.getId());
+//
+// // trigger key
+// TriggerKey triggerKey = TriggerKey.triggerKey(name);
+// try {
+//
+// // trigger cron
+// Trigger trigger = scheduler.getTrigger(triggerKey);
+// if (trigger!=null && trigger instanceof CronTriggerImpl) {
+// String cronExpression = ((CronTriggerImpl) trigger).getCronExpression();
+// jobInfo.setJobCron(cronExpression);
+// }
+//
+// // trigger state
+// TriggerState triggerState = scheduler.getTriggerState(triggerKey);
+// if (triggerState!=null) {
+// jobInfo.setJobStatus(triggerState.name());
+// }
+//
+// //JobKey jobKey = new JobKey(jobInfo.getJobName(), String.valueOf(jobInfo.getJobGroup()));
+// //JobDetail jobDetail = scheduler.getJobDetail(jobKey);
+// //String jobClass = jobDetail.getJobClass().getName();
+//
+// } catch (SchedulerException e) {
+// logger.error(e.getMessage(), e);
+// }
+// }
+//
+//
+// /**
+// * add trigger + job
+// *
+// * @param jobName
+// * @param cronExpression
+// * @return
+// * @throws SchedulerException
+// */
+// public static boolean addJob(String jobName, String cronExpression) throws SchedulerException {
+// // 1、job key
+// TriggerKey triggerKey = TriggerKey.triggerKey(jobName);
+// JobKey jobKey = new JobKey(jobName);
+//
+// // 2、valid
+// if (scheduler.checkExists(triggerKey)) {
+// return true; // PASS
+// }
+//
+// // 3、corn trigger
+// CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(cronExpression).withMisfireHandlingInstructionDoNothing(); // withMisfireHandlingInstructionDoNothing 忽略掉调度终止过程中忽略的调度
+// CronTrigger cronTrigger = TriggerBuilder.newTrigger().withIdentity(triggerKey).withSchedule(cronScheduleBuilder).build();
+//
+// // 4、job detail
+// Class extends Job> jobClass_ = RemoteHttpJobBean.class; // Class.forName(jobInfo.getJobClass());
+// JobDetail jobDetail = JobBuilder.newJob(jobClass_).withIdentity(jobKey).build();
+//
+// /*if (jobInfo.getJobData()!=null) {
+// JobDataMap jobDataMap = jobDetail.getJobDataMap();
+// jobDataMap.putAll(JacksonUtil.readValue(jobInfo.getJobData(), Map.class));
+// // JobExecutionContext context.getMergedJobDataMap().get("mailGuid");
+// }*/
+//
+// // 5、schedule job
+// Date date = scheduler.scheduleJob(jobDetail, cronTrigger);
+//
+// logger.info(">>>>>>>>>>> addJob success(quartz), jobDetail:{}, cronTrigger:{}, date:{}", jobDetail, cronTrigger, date);
+// return true;
+// }
+//
+//
+// /**
+// * remove trigger + job
+// *
+// * @param jobName
+// * @return
+// * @throws SchedulerException
+// */
+// public static boolean removeJob(String jobName) throws SchedulerException {
+//
+// JobKey jobKey = new JobKey(jobName);
+// scheduler.deleteJob(jobKey);
+//
+// /*TriggerKey triggerKey = TriggerKey.triggerKey(jobName);
+// if (scheduler.checkExists(triggerKey)) {
+// scheduler.unscheduleJob(triggerKey); // trigger + job
+// }*/
+//
+// logger.info(">>>>>>>>>>> removeJob success(quartz), jobKey:{}", jobKey);
+// return true;
+// }
+//
+//
+// /**
+// * updateJobCron
+// *
+// * @param jobName
+// * @param cronExpression
+// * @return
+// * @throws SchedulerException
+// */
+// public static boolean updateJobCron(String jobName, String cronExpression) throws SchedulerException {
+//
+// // 1、job key
+// TriggerKey triggerKey = TriggerKey.triggerKey(jobName);
+//
+// // 2、valid
+// if (!scheduler.checkExists(triggerKey)) {
+// return true; // PASS
+// }
+//
+// CronTrigger oldTrigger = (CronTrigger) scheduler.getTrigger(triggerKey);
+//
+// // 3、avoid repeat cron
+// String oldCron = oldTrigger.getCronExpression();
+// if (oldCron.equals(cronExpression)){
+// return true; // PASS
+// }
+//
+// // 4、new cron trigger
+// CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(cronExpression).withMisfireHandlingInstructionDoNothing();
+// oldTrigger = oldTrigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(cronScheduleBuilder).build();
+//
+// // 5、rescheduleJob
+// scheduler.rescheduleJob(triggerKey, oldTrigger);
+//
+// /*
+// JobKey jobKey = new JobKey(jobName);
+//
+// // old job detail
+// JobDetail jobDetail = scheduler.getJobDetail(jobKey);
+//
+// // new trigger
+// HashSet triggerSet = new HashSet();
+// triggerSet.add(cronTrigger);
+// // cover trigger of job detail
+// scheduler.scheduleJob(jobDetail, triggerSet, true);*/
+//
+// logger.info(">>>>>>>>>>> resumeJob success, JobName:{}", jobName);
+// return true;
+// }
+//
+//
+// /**
+// * pause
+// *
+// * @param jobName
+// * @return
+// * @throws SchedulerException
+// */
+// /*public static boolean pauseJob(String jobName) throws SchedulerException {
+//
+// TriggerKey triggerKey = TriggerKey.triggerKey(jobName);
+//
+// boolean result = false;
+// if (scheduler.checkExists(triggerKey)) {
+// scheduler.pauseTrigger(triggerKey);
+// result = true;
+// }
+//
+// logger.info(">>>>>>>>>>> pauseJob {}, triggerKey:{}", (result?"success":"fail"),triggerKey);
+// return result;
+// }*/
+//
+//
+// /**
+// * resume
+// *
+// * @param jobName
+// * @return
+// * @throws SchedulerException
+// */
+// /*public static boolean resumeJob(String jobName) throws SchedulerException {
+//
+// TriggerKey triggerKey = TriggerKey.triggerKey(jobName);
+//
+// boolean result = false;
+// if (scheduler.checkExists(triggerKey)) {
+// scheduler.resumeTrigger(triggerKey);
+// result = true;
+// }
+//
+// logger.info(">>>>>>>>>>> resumeJob {}, triggerKey:{}", (result?"success":"fail"), triggerKey);
+// return result;
+// }*/
+//
+//
+// /**
+// * run
+// *
+// * @param jobName
+// * @return
+// * @throws SchedulerException
+// */
+// /*public static boolean triggerJob(String jobName) throws SchedulerException {
+// // TriggerKey : name + group
+// JobKey jobKey = new JobKey(jobName);
+// TriggerKey triggerKey = TriggerKey.triggerKey(jobName);
+//
+// boolean result = false;
+// if (scheduler.checkExists(triggerKey)) {
+// scheduler.triggerJob(jobKey);
+// result = true;
+// logger.info(">>>>>>>>>>> runJob success, jobKey:{}", jobKey);
+// } else {
+// logger.info(">>>>>>>>>>> runJob fail, jobKey:{}", jobKey);
+// }
+// return result;
+// }*/
+//
+//
+// /**
+// * finaAllJobList
+// *
+// * @return
+// *//*
+// @Deprecated
+// public static List> finaAllJobList(){
+// List> jobList = new ArrayList>();
+//
+// try {
+// if (scheduler.getJobGroupNames()==null || scheduler.getJobGroupNames().size()==0) {
+// return null;
+// }
+// String groupName = scheduler.getJobGroupNames().get(0);
+// Set jobKeys = scheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName));
+// if (jobKeys!=null && jobKeys.size()>0) {
+// for (JobKey jobKey : jobKeys) {
+// TriggerKey triggerKey = TriggerKey.triggerKey(jobKey.getName(), Scheduler.DEFAULT_GROUP);
+// Trigger trigger = scheduler.getTrigger(triggerKey);
+// JobDetail jobDetail = scheduler.getJobDetail(jobKey);
+// TriggerState triggerState = scheduler.getTriggerState(triggerKey);
+// Map jobMap = new HashMap();
+// jobMap.put("TriggerKey", triggerKey);
+// jobMap.put("Trigger", trigger);
+// jobMap.put("JobDetail", jobDetail);
+// jobMap.put("TriggerState", triggerState);
+// jobList.add(jobMap);
+// }
+// }
+//
+// } catch (SchedulerException e) {
+// logger.error(e.getMessage(), e);
+// return null;
+// }
+// return jobList;
+// }*/
+//
+//}
\ No newline at end of file
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/old/XxlJobThreadPool.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/old/XxlJobThreadPool.java
new file mode 100644
index 0000000..ad07430
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/old/XxlJobThreadPool.java
@@ -0,0 +1,58 @@
+//package com.xxl.job.admin.core.quartz;
+//
+//import org.quartz.SchedulerConfigException;
+//import org.quartz.spi.ThreadPool;
+//
+///**
+// * single thread pool, for async trigger
+// *
+// * @author xuxueli 2019-03-06
+// */
+//public class XxlJobThreadPool implements ThreadPool {
+//
+// @Override
+// public boolean runInThread(Runnable runnable) {
+//
+// // async run
+// runnable.run();
+// return true;
+//
+// //return false;
+// }
+//
+// @Override
+// public int blockForAvailableThreads() {
+// return 1;
+// }
+//
+// @Override
+// public void initialize() throws SchedulerConfigException {
+//
+// }
+//
+// @Override
+// public void shutdown(boolean waitForJobsToComplete) {
+//
+// }
+//
+// @Override
+// public int getPoolSize() {
+// return 1;
+// }
+//
+// @Override
+// public void setInstanceId(String schedInstId) {
+//
+// }
+//
+// @Override
+// public void setInstanceName(String schedName) {
+//
+// }
+//
+// // support
+// public void setThreadCount(int count) {
+// //
+// }
+//
+//}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/ExecutorRouteStrategyEnum.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/ExecutorRouteStrategyEnum.java
new file mode 100644
index 0000000..7fff93a
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/ExecutorRouteStrategyEnum.java
@@ -0,0 +1,48 @@
+package com.xxl.job.admin.core.route;
+
+import com.xxl.job.admin.core.route.strategy.*;
+import com.xxl.job.admin.core.util.I18nUtil;
+
+/**
+ * Created by xuxueli on 17/3/10.
+ */
+public enum ExecutorRouteStrategyEnum {
+
+ FIRST(I18nUtil.getString("jobconf_route_first"), new ExecutorRouteFirst()),
+ LAST(I18nUtil.getString("jobconf_route_last"), new ExecutorRouteLast()),
+ ROUND(I18nUtil.getString("jobconf_route_round"), new ExecutorRouteRound()),
+ RANDOM(I18nUtil.getString("jobconf_route_random"), new ExecutorRouteRandom()),
+ CONSISTENT_HASH(I18nUtil.getString("jobconf_route_consistenthash"), new ExecutorRouteConsistentHash()),
+ LEAST_FREQUENTLY_USED(I18nUtil.getString("jobconf_route_lfu"), new ExecutorRouteLFU()),
+ LEAST_RECENTLY_USED(I18nUtil.getString("jobconf_route_lru"), new ExecutorRouteLRU()),
+ FAILOVER(I18nUtil.getString("jobconf_route_failover"), new ExecutorRouteFailover()),
+ BUSYOVER(I18nUtil.getString("jobconf_route_busyover"), new ExecutorRouteBusyover()),
+ SHARDING_BROADCAST(I18nUtil.getString("jobconf_route_shard"), null);
+
+ ExecutorRouteStrategyEnum(String title, ExecutorRouter router) {
+ this.title = title;
+ this.router = router;
+ }
+
+ private String title;
+ private ExecutorRouter router;
+
+ public String getTitle() {
+ return title;
+ }
+ public ExecutorRouter getRouter() {
+ return router;
+ }
+
+ public static ExecutorRouteStrategyEnum match(String name, ExecutorRouteStrategyEnum defaultItem){
+ if (name != null) {
+ for (ExecutorRouteStrategyEnum item: ExecutorRouteStrategyEnum.values()) {
+ if (item.name().equals(name)) {
+ return item;
+ }
+ }
+ }
+ return defaultItem;
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/ExecutorRouter.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/ExecutorRouter.java
new file mode 100644
index 0000000..5de9a1d
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/ExecutorRouter.java
@@ -0,0 +1,24 @@
+package com.xxl.job.admin.core.route;
+
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.biz.model.TriggerParam;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+/**
+ * Created by xuxueli on 17/3/10.
+ */
+public abstract class ExecutorRouter {
+ protected static Logger logger = LoggerFactory.getLogger(ExecutorRouter.class);
+
+ /**
+ * route address
+ *
+ * @param addressList
+ * @return ReturnT.content=address
+ */
+ public abstract ReturnT route(TriggerParam triggerParam, List addressList);
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteBusyover.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteBusyover.java
new file mode 100644
index 0000000..868560f
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteBusyover.java
@@ -0,0 +1,48 @@
+package com.xxl.job.admin.core.route.strategy;
+
+import com.xxl.job.admin.core.scheduler.XxlJobScheduler;
+import com.xxl.job.admin.core.route.ExecutorRouter;
+import com.xxl.job.admin.core.util.I18nUtil;
+import com.xxl.job.core.biz.ExecutorBiz;
+import com.xxl.job.core.biz.model.IdleBeatParam;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.biz.model.TriggerParam;
+
+import java.util.List;
+
+/**
+ * Created by xuxueli on 17/3/10.
+ */
+public class ExecutorRouteBusyover extends ExecutorRouter {
+
+ @Override
+ public ReturnT route(TriggerParam triggerParam, List addressList) {
+ StringBuffer idleBeatResultSB = new StringBuffer();
+ for (String address : addressList) {
+ // beat
+ ReturnT idleBeatResult = null;
+ try {
+ ExecutorBiz executorBiz = XxlJobScheduler.getExecutorBiz(address);
+ idleBeatResult = executorBiz.idleBeat(new IdleBeatParam(triggerParam.getJobId()));
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ idleBeatResult = new ReturnT(ReturnT.FAIL_CODE, ""+e );
+ }
+ idleBeatResultSB.append( (idleBeatResultSB.length()>0)?"
":"")
+ .append(I18nUtil.getString("jobconf_idleBeat") + ":")
+ .append("
address:").append(address)
+ .append("
code:").append(idleBeatResult.getCode())
+ .append("
msg:").append(idleBeatResult.getMsg());
+
+ // beat success
+ if (idleBeatResult.getCode() == ReturnT.SUCCESS_CODE) {
+ idleBeatResult.setMsg(idleBeatResultSB.toString());
+ idleBeatResult.setContent(address);
+ return idleBeatResult;
+ }
+ }
+
+ return new ReturnT(ReturnT.FAIL_CODE, idleBeatResultSB.toString());
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteConsistentHash.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteConsistentHash.java
new file mode 100644
index 0000000..41ac671
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteConsistentHash.java
@@ -0,0 +1,85 @@
+package com.xxl.job.admin.core.route.strategy;
+
+import com.xxl.job.admin.core.route.ExecutorRouter;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.biz.model.TriggerParam;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+/**
+ * 分组下机器地址相同,不同JOB均匀散列在不同机器上,保证分组下机器分配JOB平均;且每个JOB固定调度其中一台机器;
+ * a、virtual node:解决不均衡问题
+ * b、hash method replace hashCode:String的hashCode可能重复,需要进一步扩大hashCode的取值范围
+ * Created by xuxueli on 17/3/10.
+ */
+public class ExecutorRouteConsistentHash extends ExecutorRouter {
+
+ private static int VIRTUAL_NODE_NUM = 100;
+
+ /**
+ * get hash code on 2^32 ring (md5散列的方式计算hash值)
+ * @param key
+ * @return
+ */
+ private static long hash(String key) {
+
+ // md5 byte
+ MessageDigest md5;
+ try {
+ md5 = MessageDigest.getInstance("MD5");
+ } catch (NoSuchAlgorithmException e) {
+ throw new RuntimeException("MD5 not supported", e);
+ }
+ md5.reset();
+ byte[] keyBytes = null;
+ try {
+ keyBytes = key.getBytes("UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException("Unknown string :" + key, e);
+ }
+
+ md5.update(keyBytes);
+ byte[] digest = md5.digest();
+
+ // hash code, Truncate to 32-bits
+ long hashCode = ((long) (digest[3] & 0xFF) << 24)
+ | ((long) (digest[2] & 0xFF) << 16)
+ | ((long) (digest[1] & 0xFF) << 8)
+ | (digest[0] & 0xFF);
+
+ long truncateHashCode = hashCode & 0xffffffffL;
+ return truncateHashCode;
+ }
+
+ public String hashJob(int jobId, List addressList) {
+
+ // ------A1------A2-------A3------
+ // -----------J1------------------
+ TreeMap addressRing = new TreeMap();
+ for (String address: addressList) {
+ for (int i = 0; i < VIRTUAL_NODE_NUM; i++) {
+ long addressHash = hash("SHARD-" + address + "-NODE-" + i);
+ addressRing.put(addressHash, address);
+ }
+ }
+
+ long jobHash = hash(String.valueOf(jobId));
+ SortedMap lastRing = addressRing.tailMap(jobHash);
+ if (!lastRing.isEmpty()) {
+ return lastRing.get(lastRing.firstKey());
+ }
+ return addressRing.firstEntry().getValue();
+ }
+
+ @Override
+ public ReturnT route(TriggerParam triggerParam, List addressList) {
+ String address = hashJob(triggerParam.getJobId(), addressList);
+ return new ReturnT(address);
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFailover.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFailover.java
new file mode 100644
index 0000000..a2e4c90
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFailover.java
@@ -0,0 +1,48 @@
+package com.xxl.job.admin.core.route.strategy;
+
+import com.xxl.job.admin.core.scheduler.XxlJobScheduler;
+import com.xxl.job.admin.core.route.ExecutorRouter;
+import com.xxl.job.admin.core.util.I18nUtil;
+import com.xxl.job.core.biz.ExecutorBiz;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.biz.model.TriggerParam;
+
+import java.util.List;
+
+/**
+ * Created by xuxueli on 17/3/10.
+ */
+public class ExecutorRouteFailover extends ExecutorRouter {
+
+ @Override
+ public ReturnT route(TriggerParam triggerParam, List addressList) {
+
+ StringBuffer beatResultSB = new StringBuffer();
+ for (String address : addressList) {
+ // beat
+ ReturnT beatResult = null;
+ try {
+ ExecutorBiz executorBiz = XxlJobScheduler.getExecutorBiz(address);
+ beatResult = executorBiz.beat();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ beatResult = new ReturnT(ReturnT.FAIL_CODE, ""+e );
+ }
+ beatResultSB.append( (beatResultSB.length()>0)?"
":"")
+ .append(I18nUtil.getString("jobconf_beat") + ":")
+ .append("
address:").append(address)
+ .append("
code:").append(beatResult.getCode())
+ .append("
msg:").append(beatResult.getMsg());
+
+ // beat success
+ if (beatResult.getCode() == ReturnT.SUCCESS_CODE) {
+
+ beatResult.setMsg(beatResultSB.toString());
+ beatResult.setContent(address);
+ return beatResult;
+ }
+ }
+ return new ReturnT(ReturnT.FAIL_CODE, beatResultSB.toString());
+
+ }
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFirst.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFirst.java
new file mode 100644
index 0000000..de4d7af
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFirst.java
@@ -0,0 +1,19 @@
+package com.xxl.job.admin.core.route.strategy;
+
+import com.xxl.job.admin.core.route.ExecutorRouter;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.biz.model.TriggerParam;
+
+import java.util.List;
+
+/**
+ * Created by xuxueli on 17/3/10.
+ */
+public class ExecutorRouteFirst extends ExecutorRouter {
+
+ @Override
+ public ReturnT route(TriggerParam triggerParam, List addressList){
+ return new ReturnT(addressList.get(0));
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteLFU.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteLFU.java
new file mode 100644
index 0000000..9df1972
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteLFU.java
@@ -0,0 +1,79 @@
+package com.xxl.job.admin.core.route.strategy;
+
+import com.xxl.job.admin.core.route.ExecutorRouter;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.biz.model.TriggerParam;
+
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * 单个JOB对应的每个执行器,使用频率最低的优先被选举
+ * a(*)、LFU(Least Frequently Used):最不经常使用,频率/次数
+ * b、LRU(Least Recently Used):最近最久未使用,时间
+ *
+ * Created by xuxueli on 17/3/10.
+ */
+public class ExecutorRouteLFU extends ExecutorRouter {
+
+ private static ConcurrentMap> jobLfuMap = new ConcurrentHashMap>();
+ private static long CACHE_VALID_TIME = 0;
+
+ public String route(int jobId, List addressList) {
+
+ // cache clear
+ if (System.currentTimeMillis() > CACHE_VALID_TIME) {
+ jobLfuMap.clear();
+ CACHE_VALID_TIME = System.currentTimeMillis() + 1000*60*60*24;
+ }
+
+ // lfu item init
+ HashMap lfuItemMap = jobLfuMap.get(jobId); // Key排序可以用TreeMap+构造入参Compare;Value排序暂时只能通过ArrayList;
+ if (lfuItemMap == null) {
+ lfuItemMap = new HashMap();
+ jobLfuMap.putIfAbsent(jobId, lfuItemMap); // 避免重复覆盖
+ }
+
+ // put new
+ for (String address: addressList) {
+ if (!lfuItemMap.containsKey(address) || lfuItemMap.get(address) >1000000 ) {
+ lfuItemMap.put(address, new Random().nextInt(addressList.size())); // 初始化时主动Random一次,缓解首次压力
+ }
+ }
+ // remove old
+ List delKeys = new ArrayList<>();
+ for (String existKey: lfuItemMap.keySet()) {
+ if (!addressList.contains(existKey)) {
+ delKeys.add(existKey);
+ }
+ }
+ if (delKeys.size() > 0) {
+ for (String delKey: delKeys) {
+ lfuItemMap.remove(delKey);
+ }
+ }
+
+ // load least userd count address
+ List> lfuItemList = new ArrayList>(lfuItemMap.entrySet());
+ Collections.sort(lfuItemList, new Comparator>() {
+ @Override
+ public int compare(Map.Entry o1, Map.Entry o2) {
+ return o1.getValue().compareTo(o2.getValue());
+ }
+ });
+
+ Map.Entry addressItem = lfuItemList.get(0);
+ String minAddress = addressItem.getKey();
+ addressItem.setValue(addressItem.getValue() + 1);
+
+ return addressItem.getKey();
+ }
+
+ @Override
+ public ReturnT route(TriggerParam triggerParam, List addressList) {
+ String address = route(triggerParam.getJobId(), addressList);
+ return new ReturnT(address);
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteLRU.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteLRU.java
new file mode 100644
index 0000000..2d54006
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteLRU.java
@@ -0,0 +1,76 @@
+package com.xxl.job.admin.core.route.strategy;
+
+import com.xxl.job.admin.core.route.ExecutorRouter;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.biz.model.TriggerParam;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * 单个JOB对应的每个执行器,最久为使用的优先被选举
+ * a、LFU(Least Frequently Used):最不经常使用,频率/次数
+ * b(*)、LRU(Least Recently Used):最近最久未使用,时间
+ *
+ * Created by xuxueli on 17/3/10.
+ */
+public class ExecutorRouteLRU extends ExecutorRouter {
+
+ private static ConcurrentMap> jobLRUMap = new ConcurrentHashMap>();
+ private static long CACHE_VALID_TIME = 0;
+
+ public String route(int jobId, List addressList) {
+
+ // cache clear
+ if (System.currentTimeMillis() > CACHE_VALID_TIME) {
+ jobLRUMap.clear();
+ CACHE_VALID_TIME = System.currentTimeMillis() + 1000*60*60*24;
+ }
+
+ // init lru
+ LinkedHashMap lruItem = jobLRUMap.get(jobId);
+ if (lruItem == null) {
+ /**
+ * LinkedHashMap
+ * a、accessOrder:true=访问顺序排序(get/put时排序);false=插入顺序排期;
+ * b、removeEldestEntry:新增元素时将会调用,返回true时会删除最老元素;可封装LinkedHashMap并重写该方法,比如定义最大容量,超出是返回true即可实现固定长度的LRU算法;
+ */
+ lruItem = new LinkedHashMap(16, 0.75f, true);
+ jobLRUMap.putIfAbsent(jobId, lruItem);
+ }
+
+ // put new
+ for (String address: addressList) {
+ if (!lruItem.containsKey(address)) {
+ lruItem.put(address, address);
+ }
+ }
+ // remove old
+ List delKeys = new ArrayList<>();
+ for (String existKey: lruItem.keySet()) {
+ if (!addressList.contains(existKey)) {
+ delKeys.add(existKey);
+ }
+ }
+ if (delKeys.size() > 0) {
+ for (String delKey: delKeys) {
+ lruItem.remove(delKey);
+ }
+ }
+
+ // load
+ String eldestKey = lruItem.entrySet().iterator().next().getKey();
+ String eldestValue = lruItem.get(eldestKey);
+ return eldestValue;
+ }
+
+ @Override
+ public ReturnT route(TriggerParam triggerParam, List addressList) {
+ String address = route(triggerParam.getJobId(), addressList);
+ return new ReturnT(address);
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteLast.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteLast.java
new file mode 100644
index 0000000..4ff3cf6
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteLast.java
@@ -0,0 +1,19 @@
+package com.xxl.job.admin.core.route.strategy;
+
+import com.xxl.job.admin.core.route.ExecutorRouter;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.biz.model.TriggerParam;
+
+import java.util.List;
+
+/**
+ * Created by xuxueli on 17/3/10.
+ */
+public class ExecutorRouteLast extends ExecutorRouter {
+
+ @Override
+ public ReturnT route(TriggerParam triggerParam, List addressList) {
+ return new ReturnT(addressList.get(addressList.size()-1));
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteRandom.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteRandom.java
new file mode 100644
index 0000000..5ea4a38
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteRandom.java
@@ -0,0 +1,23 @@
+package com.xxl.job.admin.core.route.strategy;
+
+import com.xxl.job.admin.core.route.ExecutorRouter;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.biz.model.TriggerParam;
+
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Created by xuxueli on 17/3/10.
+ */
+public class ExecutorRouteRandom extends ExecutorRouter {
+
+ private static Random localRandom = new Random();
+
+ @Override
+ public ReturnT route(TriggerParam triggerParam, List addressList) {
+ String address = addressList.get(localRandom.nextInt(addressList.size()));
+ return new ReturnT(address);
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteRound.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteRound.java
new file mode 100644
index 0000000..d0ea2ba
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteRound.java
@@ -0,0 +1,46 @@
+package com.xxl.job.admin.core.route.strategy;
+
+import com.xxl.job.admin.core.route.ExecutorRouter;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.biz.model.TriggerParam;
+
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * Created by xuxueli on 17/3/10.
+ */
+public class ExecutorRouteRound extends ExecutorRouter {
+
+ private static ConcurrentMap routeCountEachJob = new ConcurrentHashMap<>();
+ private static long CACHE_VALID_TIME = 0;
+
+ private static int count(int jobId) {
+ // cache clear
+ if (System.currentTimeMillis() > CACHE_VALID_TIME) {
+ routeCountEachJob.clear();
+ CACHE_VALID_TIME = System.currentTimeMillis() + 1000*60*60*24;
+ }
+
+ AtomicInteger count = routeCountEachJob.get(jobId);
+ if (count == null || count.get() > 1000000) {
+ // 初始化时主动Random一次,缓解首次压力
+ count = new AtomicInteger(new Random().nextInt(100));
+ } else {
+ // count++
+ count.addAndGet(1);
+ }
+ routeCountEachJob.put(jobId, count);
+ return count.get();
+ }
+
+ @Override
+ public ReturnT route(TriggerParam triggerParam, List addressList) {
+ String address = addressList.get(count(triggerParam.getJobId())%addressList.size());
+ return new ReturnT(address);
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/scheduler/MisfireStrategyEnum.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/scheduler/MisfireStrategyEnum.java
new file mode 100644
index 0000000..0b9b4a9
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/scheduler/MisfireStrategyEnum.java
@@ -0,0 +1,39 @@
+package com.xxl.job.admin.core.scheduler;
+
+import com.xxl.job.admin.core.util.I18nUtil;
+
+/**
+ * @author xuxueli 2020-10-29 21:11:23
+ */
+public enum MisfireStrategyEnum {
+
+ /**
+ * do nothing
+ */
+ DO_NOTHING(I18nUtil.getString("misfire_strategy_do_nothing")),
+
+ /**
+ * fire once now
+ */
+ FIRE_ONCE_NOW(I18nUtil.getString("misfire_strategy_fire_once_now"));
+
+ private String title;
+
+ MisfireStrategyEnum(String title) {
+ this.title = title;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public static MisfireStrategyEnum match(String name, MisfireStrategyEnum defaultItem){
+ for (MisfireStrategyEnum item: MisfireStrategyEnum.values()) {
+ if (item.name().equals(name)) {
+ return item;
+ }
+ }
+ return defaultItem;
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/scheduler/ScheduleTypeEnum.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/scheduler/ScheduleTypeEnum.java
new file mode 100644
index 0000000..aa334fd
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/scheduler/ScheduleTypeEnum.java
@@ -0,0 +1,46 @@
+package com.xxl.job.admin.core.scheduler;
+
+import com.xxl.job.admin.core.util.I18nUtil;
+
+/**
+ * @author xuxueli 2020-10-29 21:11:23
+ */
+public enum ScheduleTypeEnum {
+
+ NONE(I18nUtil.getString("schedule_type_none")),
+
+ /**
+ * schedule by cron
+ */
+ CRON(I18nUtil.getString("schedule_type_cron")),
+
+ /**
+ * schedule by fixed rate (in seconds)
+ */
+ FIX_RATE(I18nUtil.getString("schedule_type_fix_rate")),
+
+ /**
+ * schedule by fix delay (in seconds), after the last time
+ */
+ /*FIX_DELAY(I18nUtil.getString("schedule_type_fix_delay"))*/;
+
+ private String title;
+
+ ScheduleTypeEnum(String title) {
+ this.title = title;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public static ScheduleTypeEnum match(String name, ScheduleTypeEnum defaultItem){
+ for (ScheduleTypeEnum item: ScheduleTypeEnum.values()) {
+ if (item.name().equals(name)) {
+ return item;
+ }
+ }
+ return defaultItem;
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/scheduler/XxlJobScheduler.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/scheduler/XxlJobScheduler.java
new file mode 100644
index 0000000..bb2cda8
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/scheduler/XxlJobScheduler.java
@@ -0,0 +1,101 @@
+package com.xxl.job.admin.core.scheduler;
+
+import com.xxl.job.admin.core.conf.XxlJobAdminConfig;
+import com.xxl.job.admin.core.thread.*;
+import com.xxl.job.admin.core.util.I18nUtil;
+import com.xxl.job.core.biz.ExecutorBiz;
+import com.xxl.job.core.biz.client.ExecutorBizClient;
+import com.xxl.job.core.enums.ExecutorBlockStrategyEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * @author xuxueli 2018-10-28 00:18:17
+ */
+
+public class XxlJobScheduler {
+ private static final Logger logger = LoggerFactory.getLogger(XxlJobScheduler.class);
+
+
+ public void init() throws Exception {
+ // init i18n
+ initI18n();
+
+ // admin trigger pool start
+ JobTriggerPoolHelper.toStart();
+
+ // admin registry monitor run
+ JobRegistryHelper.getInstance().start();
+
+ // admin fail-monitor run
+ JobFailMonitorHelper.getInstance().start();
+
+ // admin lose-monitor run ( depend on JobTriggerPoolHelper )
+ JobCompleteHelper.getInstance().start();
+
+ // admin log report start
+ JobLogReportHelper.getInstance().start();
+
+ // start-schedule ( depend on JobTriggerPoolHelper )
+ JobScheduleHelper.getInstance().start();
+
+ logger.info(">>>>>>>>> init xxl-job admin success.");
+ }
+
+
+ public void destroy() throws Exception {
+
+ // stop-schedule
+ JobScheduleHelper.getInstance().toStop();
+
+ // admin log report stop
+ JobLogReportHelper.getInstance().toStop();
+
+ // admin lose-monitor stop
+ JobCompleteHelper.getInstance().toStop();
+
+ // admin fail-monitor stop
+ JobFailMonitorHelper.getInstance().toStop();
+
+ // admin registry stop
+ JobRegistryHelper.getInstance().toStop();
+
+ // admin trigger pool stop
+ JobTriggerPoolHelper.toStop();
+
+ }
+
+ // ---------------------- I18n ----------------------
+
+ private void initI18n(){
+ for (ExecutorBlockStrategyEnum item:ExecutorBlockStrategyEnum.values()) {
+ item.setTitle(I18nUtil.getString("jobconf_block_".concat(item.name())));
+ }
+ }
+
+ // ---------------------- executor-client ----------------------
+ private static ConcurrentMap executorBizRepository = new ConcurrentHashMap();
+ public static ExecutorBiz getExecutorBiz(String address) throws Exception {
+ // valid
+ if (address==null || address.trim().length()==0) {
+ return null;
+ }
+
+ // load-cache
+ address = address.trim();
+ ExecutorBiz executorBiz = executorBizRepository.get(address);
+ if (executorBiz != null) {
+ return executorBiz;
+ }
+
+ // set-cache
+ executorBiz = new ExecutorBizClient(address, XxlJobAdminConfig.getAdminConfig().getAccessToken());
+
+ executorBizRepository.put(address, executorBiz);
+ return executorBiz;
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobCompleteHelper.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobCompleteHelper.java
new file mode 100644
index 0000000..5698926
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobCompleteHelper.java
@@ -0,0 +1,184 @@
+package com.xxl.job.admin.core.thread;
+
+import com.xxl.job.admin.core.complete.XxlJobCompleter;
+import com.xxl.job.admin.core.conf.XxlJobAdminConfig;
+import com.xxl.job.admin.core.model.XxlJobLog;
+import com.xxl.job.admin.core.util.I18nUtil;
+import com.xxl.job.core.biz.model.HandleCallbackParam;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.util.DateUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.*;
+
+/**
+ * job lose-monitor instance
+ *
+ * @author xuxueli 2015-9-1 18:05:56
+ */
+public class JobCompleteHelper {
+ private static Logger logger = LoggerFactory.getLogger(JobCompleteHelper.class);
+
+ private static JobCompleteHelper instance = new JobCompleteHelper();
+ public static JobCompleteHelper getInstance(){
+ return instance;
+ }
+
+ // ---------------------- monitor ----------------------
+
+ private ThreadPoolExecutor callbackThreadPool = null;
+ private Thread monitorThread;
+ private volatile boolean toStop = false;
+ public void start(){
+
+ // for callback
+ callbackThreadPool = new ThreadPoolExecutor(
+ 2,
+ 20,
+ 30L,
+ TimeUnit.SECONDS,
+ new LinkedBlockingQueue(3000),
+ new ThreadFactory() {
+ @Override
+ public Thread newThread(Runnable r) {
+ return new Thread(r, "xxl-job, admin JobLosedMonitorHelper-callbackThreadPool-" + r.hashCode());
+ }
+ },
+ new RejectedExecutionHandler() {
+ @Override
+ public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
+ r.run();
+ logger.warn(">>>>>>>>>>> xxl-job, callback too fast, match threadpool rejected handler(run now).");
+ }
+ });
+
+
+ // for monitor
+ monitorThread = new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+
+ // wait for JobTriggerPoolHelper-init
+ try {
+ TimeUnit.MILLISECONDS.sleep(50);
+ } catch (InterruptedException e) {
+ if (!toStop) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+ // monitor
+ while (!toStop) {
+ try {
+ // 任务结果丢失处理:调度记录停留在 "运行中" 状态超过10min,且对应执行器心跳注册失败不在线,则将本地调度主动标记失败;
+ Date losedTime = DateUtil.addMinutes(new Date(), -10);
+ List losedJobIds = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findLostJobIds(losedTime);
+
+ if (losedJobIds!=null && losedJobIds.size()>0) {
+ for (Long logId: losedJobIds) {
+
+ XxlJobLog jobLog = new XxlJobLog();
+ jobLog.setId(logId);
+
+ jobLog.setHandleTime(new Date());
+ jobLog.setHandleCode(ReturnT.FAIL_CODE);
+ jobLog.setHandleMsg( I18nUtil.getString("joblog_lost_fail") );
+
+ XxlJobCompleter.updateHandleInfoAndFinish(jobLog);
+ }
+
+ }
+ } catch (Exception e) {
+ if (!toStop) {
+ logger.error(">>>>>>>>>>> xxl-job, job fail monitor thread error:{}", e);
+ }
+ }
+
+ try {
+ TimeUnit.SECONDS.sleep(60);
+ } catch (Exception e) {
+ if (!toStop) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+ }
+
+ logger.info(">>>>>>>>>>> xxl-job, JobLosedMonitorHelper stop");
+
+ }
+ });
+ monitorThread.setDaemon(true);
+ monitorThread.setName("xxl-job, admin JobLosedMonitorHelper");
+ monitorThread.start();
+ }
+
+ public void toStop(){
+ toStop = true;
+
+ // stop registryOrRemoveThreadPool
+ callbackThreadPool.shutdownNow();
+
+ // stop monitorThread (interrupt and wait)
+ monitorThread.interrupt();
+ try {
+ monitorThread.join();
+ } catch (InterruptedException e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+
+ // ---------------------- helper ----------------------
+
+ public ReturnT callback(List callbackParamList) {
+
+ callbackThreadPool.execute(new Runnable() {
+ @Override
+ public void run() {
+ for (HandleCallbackParam handleCallbackParam: callbackParamList) {
+ ReturnT callbackResult = callback(handleCallbackParam);
+ logger.debug(">>>>>>>>> JobApiController.callback {}, handleCallbackParam={}, callbackResult={}",
+ (callbackResult.getCode()== ReturnT.SUCCESS_CODE?"success":"fail"), handleCallbackParam, callbackResult);
+ }
+ }
+ });
+
+ return ReturnT.SUCCESS;
+ }
+
+ private ReturnT callback(HandleCallbackParam handleCallbackParam) {
+ // valid log item
+ XxlJobLog log = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().load(handleCallbackParam.getLogId());
+ if (log == null) {
+ return new ReturnT(ReturnT.FAIL_CODE, "log item not found.");
+ }
+ if (log.getHandleCode() > 0) {
+ return new ReturnT(ReturnT.FAIL_CODE, "log repeate callback."); // avoid repeat callback, trigger child job etc
+ }
+
+ // handle msg
+ StringBuffer handleMsg = new StringBuffer();
+ if (log.getHandleMsg()!=null) {
+ handleMsg.append(log.getHandleMsg()).append("
");
+ }
+ if (handleCallbackParam.getHandleMsg() != null) {
+ handleMsg.append(handleCallbackParam.getHandleMsg());
+ }
+
+ // success, save log
+ log.setHandleTime(new Date());
+ log.setHandleCode(handleCallbackParam.getHandleCode());
+ log.setHandleMsg(handleMsg.toString());
+ XxlJobCompleter.updateHandleInfoAndFinish(log);
+
+ return ReturnT.SUCCESS;
+ }
+
+
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobFailMonitorHelper.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobFailMonitorHelper.java
new file mode 100644
index 0000000..8409d7b
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobFailMonitorHelper.java
@@ -0,0 +1,110 @@
+package com.xxl.job.admin.core.thread;
+
+import com.xxl.job.admin.core.conf.XxlJobAdminConfig;
+import com.xxl.job.admin.core.model.XxlJobInfo;
+import com.xxl.job.admin.core.model.XxlJobLog;
+import com.xxl.job.admin.core.trigger.TriggerTypeEnum;
+import com.xxl.job.admin.core.util.I18nUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * job monitor instance
+ *
+ * @author xuxueli 2015-9-1 18:05:56
+ */
+public class JobFailMonitorHelper {
+ private static Logger logger = LoggerFactory.getLogger(JobFailMonitorHelper.class);
+
+ private static JobFailMonitorHelper instance = new JobFailMonitorHelper();
+ public static JobFailMonitorHelper getInstance(){
+ return instance;
+ }
+
+ // ---------------------- monitor ----------------------
+
+ private Thread monitorThread;
+ private volatile boolean toStop = false;
+ public void start(){
+ monitorThread = new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+
+ // monitor
+ while (!toStop) {
+ try {
+
+ List failLogIds = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findFailJobLogIds(1000);
+ if (failLogIds!=null && !failLogIds.isEmpty()) {
+ for (long failLogId: failLogIds) {
+
+ // lock log
+ int lockRet = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateAlarmStatus(failLogId, 0, -1);
+ if (lockRet < 1) {
+ continue;
+ }
+ XxlJobLog log = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().load(failLogId);
+ XxlJobInfo info = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().loadById(log.getJobId());
+
+ // 1、fail retry monitor
+ if (log.getExecutorFailRetryCount() > 0) {
+ JobTriggerPoolHelper.trigger(log.getJobId(), TriggerTypeEnum.RETRY, (log.getExecutorFailRetryCount()-1), log.getExecutorShardingParam(), log.getExecutorParam(), null);
+ String retryMsg = "
>>>>>>>>>>>"+ I18nUtil.getString("jobconf_trigger_type_retry") +"<<<<<<<<<<<
";
+ log.setTriggerMsg(log.getTriggerMsg() + retryMsg);
+ XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateTriggerInfo(log);
+ }
+
+ // 2、fail alarm monitor
+ int newAlarmStatus = 0; // 告警状态:0-默认、-1=锁定状态、1-无需告警、2-告警成功、3-告警失败
+ if (info != null) {
+ boolean alarmResult = XxlJobAdminConfig.getAdminConfig().getJobAlarmer().alarm(info, log);
+ newAlarmStatus = alarmResult?2:3;
+ } else {
+ newAlarmStatus = 1;
+ }
+
+ XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateAlarmStatus(failLogId, -1, newAlarmStatus);
+ }
+ }
+
+ } catch (Exception e) {
+ if (!toStop) {
+ logger.error(">>>>>>>>>>> xxl-job, job fail monitor thread error:{}", e);
+ }
+ }
+
+ try {
+ TimeUnit.SECONDS.sleep(10);
+ } catch (Exception e) {
+ if (!toStop) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+ }
+
+ logger.info(">>>>>>>>>>> xxl-job, job fail monitor thread stop");
+
+ }
+ });
+ monitorThread.setDaemon(true);
+ monitorThread.setName("xxl-job, admin JobFailMonitorHelper");
+ monitorThread.start();
+ }
+
+ public void toStop(){
+ toStop = true;
+ // interrupt and wait
+ monitorThread.interrupt();
+ try {
+ monitorThread.join();
+ } catch (InterruptedException e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobLogReportHelper.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobLogReportHelper.java
new file mode 100644
index 0000000..2387a0c
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobLogReportHelper.java
@@ -0,0 +1,152 @@
+package com.xxl.job.admin.core.thread;
+
+import com.xxl.job.admin.core.conf.XxlJobAdminConfig;
+import com.xxl.job.admin.core.model.XxlJobLogReport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * job log report helper
+ *
+ * @author xuxueli 2019-11-22
+ */
+public class JobLogReportHelper {
+ private static Logger logger = LoggerFactory.getLogger(JobLogReportHelper.class);
+
+ private static JobLogReportHelper instance = new JobLogReportHelper();
+ public static JobLogReportHelper getInstance(){
+ return instance;
+ }
+
+
+ private Thread logrThread;
+ private volatile boolean toStop = false;
+ public void start(){
+ logrThread = new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+
+ // last clean log time
+ long lastCleanLogTime = 0;
+
+
+ while (!toStop) {
+
+ // 1、log-report refresh: refresh log report in 3 days
+ try {
+
+ for (int i = 0; i < 3; i++) {
+
+ // today
+ Calendar itemDay = Calendar.getInstance();
+ itemDay.add(Calendar.DAY_OF_MONTH, -i);
+ itemDay.set(Calendar.HOUR_OF_DAY, 0);
+ itemDay.set(Calendar.MINUTE, 0);
+ itemDay.set(Calendar.SECOND, 0);
+ itemDay.set(Calendar.MILLISECOND, 0);
+
+ Date todayFrom = itemDay.getTime();
+
+ itemDay.set(Calendar.HOUR_OF_DAY, 23);
+ itemDay.set(Calendar.MINUTE, 59);
+ itemDay.set(Calendar.SECOND, 59);
+ itemDay.set(Calendar.MILLISECOND, 999);
+
+ Date todayTo = itemDay.getTime();
+
+ // refresh log-report every minute
+ XxlJobLogReport xxlJobLogReport = new XxlJobLogReport();
+ xxlJobLogReport.setTriggerDay(todayFrom);
+ xxlJobLogReport.setRunningCount(0);
+ xxlJobLogReport.setSucCount(0);
+ xxlJobLogReport.setFailCount(0);
+
+ Map triggerCountMap = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findLogReport(todayFrom, todayTo);
+ if (triggerCountMap!=null && triggerCountMap.size()>0) {
+ int triggerDayCount = triggerCountMap.containsKey("triggerDayCount")?Integer.valueOf(String.valueOf(triggerCountMap.get("triggerDayCount"))):0;
+ int triggerDayCountRunning = triggerCountMap.containsKey("triggerDayCountRunning")?Integer.valueOf(String.valueOf(triggerCountMap.get("triggerDayCountRunning"))):0;
+ int triggerDayCountSuc = triggerCountMap.containsKey("triggerDayCountSuc")?Integer.valueOf(String.valueOf(triggerCountMap.get("triggerDayCountSuc"))):0;
+ int triggerDayCountFail = triggerDayCount - triggerDayCountRunning - triggerDayCountSuc;
+
+ xxlJobLogReport.setRunningCount(triggerDayCountRunning);
+ xxlJobLogReport.setSucCount(triggerDayCountSuc);
+ xxlJobLogReport.setFailCount(triggerDayCountFail);
+ }
+
+ // do refresh
+ int ret = XxlJobAdminConfig.getAdminConfig().getXxlJobLogReportDao().update(xxlJobLogReport);
+ if (ret < 1) {
+ XxlJobAdminConfig.getAdminConfig().getXxlJobLogReportDao().save(xxlJobLogReport);
+ }
+ }
+
+ } catch (Exception e) {
+ if (!toStop) {
+ logger.error(">>>>>>>>>>> xxl-job, job log report thread error:{}", e);
+ }
+ }
+
+ // 2、log-clean: switch open & once each day
+ if (XxlJobAdminConfig.getAdminConfig().getLogretentiondays()>0
+ && System.currentTimeMillis() - lastCleanLogTime > 24*60*60*1000) {
+
+ // expire-time
+ Calendar expiredDay = Calendar.getInstance();
+ expiredDay.add(Calendar.DAY_OF_MONTH, -1 * XxlJobAdminConfig.getAdminConfig().getLogretentiondays());
+ expiredDay.set(Calendar.HOUR_OF_DAY, 0);
+ expiredDay.set(Calendar.MINUTE, 0);
+ expiredDay.set(Calendar.SECOND, 0);
+ expiredDay.set(Calendar.MILLISECOND, 0);
+ Date clearBeforeTime = expiredDay.getTime();
+
+ // clean expired log
+ List logIds = null;
+ do {
+ logIds = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findClearLogIds(0, 0, clearBeforeTime, 0, 1000);
+ if (logIds!=null && logIds.size()>0) {
+ XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().clearLog(logIds);
+ }
+ } while (logIds!=null && logIds.size()>0);
+
+ // update clean time
+ lastCleanLogTime = System.currentTimeMillis();
+ }
+
+ try {
+ TimeUnit.MINUTES.sleep(1);
+ } catch (Exception e) {
+ if (!toStop) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+ }
+
+ logger.info(">>>>>>>>>>> xxl-job, job log report thread stop");
+
+ }
+ });
+ logrThread.setDaemon(true);
+ logrThread.setName("xxl-job, admin JobLogReportHelper");
+ logrThread.start();
+ }
+
+ public void toStop(){
+ toStop = true;
+ // interrupt and wait
+ logrThread.interrupt();
+ try {
+ logrThread.join();
+ } catch (InterruptedException e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobRegistryHelper.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobRegistryHelper.java
new file mode 100644
index 0000000..37edfd9
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobRegistryHelper.java
@@ -0,0 +1,204 @@
+package com.xxl.job.admin.core.thread;
+
+import com.xxl.job.admin.core.conf.XxlJobAdminConfig;
+import com.xxl.job.admin.core.model.XxlJobGroup;
+import com.xxl.job.admin.core.model.XxlJobRegistry;
+import com.xxl.job.core.biz.model.RegistryParam;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.enums.RegistryConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.util.StringUtils;
+
+import java.util.*;
+import java.util.concurrent.*;
+
+/**
+ * job registry instance
+ * @author xuxueli 2016-10-02 19:10:24
+ */
+public class JobRegistryHelper {
+ private static Logger logger = LoggerFactory.getLogger(JobRegistryHelper.class);
+
+ private static JobRegistryHelper instance = new JobRegistryHelper();
+ public static JobRegistryHelper getInstance(){
+ return instance;
+ }
+
+ private ThreadPoolExecutor registryOrRemoveThreadPool = null;
+ private Thread registryMonitorThread;
+ private volatile boolean toStop = false;
+
+ public void start(){
+
+ // for registry or remove
+ registryOrRemoveThreadPool = new ThreadPoolExecutor(
+ 2,
+ 10,
+ 30L,
+ TimeUnit.SECONDS,
+ new LinkedBlockingQueue(2000),
+ new ThreadFactory() {
+ @Override
+ public Thread newThread(Runnable r) {
+ return new Thread(r, "xxl-job, admin JobRegistryMonitorHelper-registryOrRemoveThreadPool-" + r.hashCode());
+ }
+ },
+ new RejectedExecutionHandler() {
+ @Override
+ public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
+ r.run();
+ logger.warn(">>>>>>>>>>> xxl-job, registry or remove too fast, match threadpool rejected handler(run now).");
+ }
+ });
+
+ // for monitor
+ registryMonitorThread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ while (!toStop) {
+ try {
+ // auto registry group
+ List groupList = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().findByAddressType(0);
+ if (groupList!=null && !groupList.isEmpty()) {
+
+ // remove dead address (admin/executor)
+ List ids = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().findDead(RegistryConfig.DEAD_TIMEOUT, new Date());
+ if (ids!=null && ids.size()>0) {
+ XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().removeDead(ids);
+ }
+
+ // fresh online address (admin/executor)
+ HashMap> appAddressMap = new HashMap>();
+ List list = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().findAll(RegistryConfig.DEAD_TIMEOUT, new Date());
+ if (list != null) {
+ for (XxlJobRegistry item: list) {
+ if (RegistryConfig.RegistType.EXECUTOR.name().equals(item.getRegistryGroup())) {
+ String appname = item.getRegistryKey();
+ List registryList = appAddressMap.get(appname);
+ if (registryList == null) {
+ registryList = new ArrayList();
+ }
+
+ if (!registryList.contains(item.getRegistryValue())) {
+ registryList.add(item.getRegistryValue());
+ }
+ appAddressMap.put(appname, registryList);
+ }
+ }
+ }
+
+ // fresh group address
+ for (XxlJobGroup group: groupList) {
+ List registryList = appAddressMap.get(group.getAppname());
+ String addressListStr = null;
+ if (registryList!=null && !registryList.isEmpty()) {
+ Collections.sort(registryList);
+ StringBuilder addressListSB = new StringBuilder();
+ for (String item:registryList) {
+ addressListSB.append(item).append(",");
+ }
+ addressListStr = addressListSB.toString();
+ addressListStr = addressListStr.substring(0, addressListStr.length()-1);
+ }
+ group.setAddressList(addressListStr);
+ group.setUpdateTime(new Date());
+
+ XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().update(group);
+ }
+ }
+ } catch (Exception e) {
+ if (!toStop) {
+ logger.error(">>>>>>>>>>> xxl-job, job registry monitor thread error:{}", e);
+ }
+ }
+ try {
+ TimeUnit.SECONDS.sleep(RegistryConfig.BEAT_TIMEOUT);
+ } catch (InterruptedException e) {
+ if (!toStop) {
+ logger.error(">>>>>>>>>>> xxl-job, job registry monitor thread error:{}", e);
+ }
+ }
+ }
+ logger.info(">>>>>>>>>>> xxl-job, job registry monitor thread stop");
+ }
+ });
+ registryMonitorThread.setDaemon(true);
+ registryMonitorThread.setName("xxl-job, admin JobRegistryMonitorHelper-registryMonitorThread");
+ registryMonitorThread.start();
+ }
+
+ public void toStop(){
+ toStop = true;
+
+ // stop registryOrRemoveThreadPool
+ registryOrRemoveThreadPool.shutdownNow();
+
+ // stop monitir (interrupt and wait)
+ registryMonitorThread.interrupt();
+ try {
+ registryMonitorThread.join();
+ } catch (InterruptedException e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+
+ // ---------------------- helper ----------------------
+
+ public ReturnT registry(RegistryParam registryParam) {
+
+ // valid
+ if (!StringUtils.hasText(registryParam.getRegistryGroup())
+ || !StringUtils.hasText(registryParam.getRegistryKey())
+ || !StringUtils.hasText(registryParam.getRegistryValue())) {
+ return new ReturnT(ReturnT.FAIL_CODE, "Illegal Argument.");
+ }
+
+ // async execute
+ registryOrRemoveThreadPool.execute(new Runnable() {
+ @Override
+ public void run() {
+ int ret = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().registryUpdate(registryParam.getRegistryGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue(), new Date());
+ if (ret < 1) {
+ XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().registrySave(registryParam.getRegistryGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue(), new Date());
+
+ // fresh
+ freshGroupRegistryInfo(registryParam);
+ }
+ }
+ });
+
+ return ReturnT.SUCCESS;
+ }
+
+ public ReturnT registryRemove(RegistryParam registryParam) {
+
+ // valid
+ if (!StringUtils.hasText(registryParam.getRegistryGroup())
+ || !StringUtils.hasText(registryParam.getRegistryKey())
+ || !StringUtils.hasText(registryParam.getRegistryValue())) {
+ return new ReturnT(ReturnT.FAIL_CODE, "Illegal Argument.");
+ }
+
+ // async execute
+ registryOrRemoveThreadPool.execute(new Runnable() {
+ @Override
+ public void run() {
+ int ret = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().registryDelete(registryParam.getRegistryGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue());
+ if (ret > 0) {
+ // fresh
+ freshGroupRegistryInfo(registryParam);
+ }
+ }
+ });
+
+ return ReturnT.SUCCESS;
+ }
+
+ private void freshGroupRegistryInfo(RegistryParam registryParam){
+ // Under consideration, prevent affecting core tables
+ }
+
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java
new file mode 100644
index 0000000..274ffee
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java
@@ -0,0 +1,380 @@
+package com.xxl.job.admin.core.thread;
+
+import com.xxl.job.admin.core.conf.XxlJobAdminConfig;
+import com.xxl.job.admin.core.cron.CronExpression;
+import com.xxl.job.admin.core.model.XxlJobInfo;
+import com.xxl.job.admin.core.scheduler.MisfireStrategyEnum;
+import com.xxl.job.admin.core.scheduler.ScheduleTypeEnum;
+import com.xxl.job.admin.core.trigger.TriggerTypeEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author xuxueli 2019-05-21
+ */
+public class JobScheduleHelper {
+ private static Logger logger = LoggerFactory.getLogger(JobScheduleHelper.class);
+
+ private static JobScheduleHelper instance = new JobScheduleHelper();
+ public static JobScheduleHelper getInstance(){
+ return instance;
+ }
+
+ public static final long PRE_READ_MS = 5000; // pre read
+
+ private Thread scheduleThread;
+ private Thread ringThread;
+ private volatile boolean scheduleThreadToStop = false;
+ private volatile boolean ringThreadToStop = false;
+ private volatile static Map> ringData = new ConcurrentHashMap<>();
+
+ public void start(){
+
+ // schedule thread
+ scheduleThread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+
+ try {
+ TimeUnit.MILLISECONDS.sleep(5000 - System.currentTimeMillis()%1000 );
+ } catch (InterruptedException e) {
+ if (!scheduleThreadToStop) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+ logger.info(">>>>>>>>> init xxl-job admin scheduler success.");
+
+ // pre-read count: treadpool-size * trigger-qps (each trigger cost 50ms, qps = 1000/50 = 20)
+ int preReadCount = (XxlJobAdminConfig.getAdminConfig().getTriggerPoolFastMax() + XxlJobAdminConfig.getAdminConfig().getTriggerPoolSlowMax()) * 20;
+
+ while (!scheduleThreadToStop) {
+
+ // Scan Job
+ long start = System.currentTimeMillis();
+
+ Connection conn = null;
+ Boolean connAutoCommit = null;
+ PreparedStatement preparedStatement = null;
+
+ boolean preReadSuc = true;
+ try {
+
+ conn = XxlJobAdminConfig.getAdminConfig().getDataSource().getConnection();
+ connAutoCommit = conn.getAutoCommit();
+ conn.setAutoCommit(false);
+
+ preparedStatement = conn.prepareStatement( "select * from xxl_job_lock where lock_name = 'schedule_lock' for update" );
+ preparedStatement.execute();
+
+ // tx start
+
+ // 1、pre read
+ long nowTime = System.currentTimeMillis();
+ List scheduleList = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().scheduleJobQuery(nowTime + PRE_READ_MS, preReadCount);
+ if (scheduleList!=null && scheduleList.size()>0) {
+ // 2、push time-ring
+ for (XxlJobInfo jobInfo: scheduleList) {
+
+ // time-ring jump
+ if (nowTime > jobInfo.getTriggerNextTime() + PRE_READ_MS) {
+ // 2.1、trigger-expire > 5s:pass && make next-trigger-time
+ logger.warn(">>>>>>>>>>> xxl-job, schedule misfire, jobId = " + jobInfo.getId());
+
+ // 1、misfire match
+ MisfireStrategyEnum misfireStrategyEnum = MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), MisfireStrategyEnum.DO_NOTHING);
+ if (MisfireStrategyEnum.FIRE_ONCE_NOW == misfireStrategyEnum) {
+ // FIRE_ONCE_NOW 》 trigger
+ JobTriggerPoolHelper.trigger(jobInfo.getId(), TriggerTypeEnum.MISFIRE, -1, null, null, null);
+ logger.debug(">>>>>>>>>>> xxl-job, schedule push trigger : jobId = " + jobInfo.getId() );
+ }
+
+ // 2、fresh next
+ refreshNextValidTime(jobInfo, new Date());
+
+ } else if (nowTime > jobInfo.getTriggerNextTime()) {
+ // 2.2、trigger-expire < 5s:direct-trigger && make next-trigger-time
+
+ // 1、trigger
+ JobTriggerPoolHelper.trigger(jobInfo.getId(), TriggerTypeEnum.CRON, -1, null, null, null);
+ logger.debug(">>>>>>>>>>> xxl-job, schedule push trigger : jobId = " + jobInfo.getId() );
+
+ // 2、fresh next
+ refreshNextValidTime(jobInfo, new Date());
+
+ // next-trigger-time in 5s, pre-read again
+ if (jobInfo.getTriggerStatus()==1 && nowTime + PRE_READ_MS > jobInfo.getTriggerNextTime()) {
+
+ // 1、make ring second
+ int ringSecond = (int)((jobInfo.getTriggerNextTime()/1000)%60);
+
+ // 2、push time ring
+ pushTimeRing(ringSecond, jobInfo.getId());
+
+ // 3、fresh next
+ refreshNextValidTime(jobInfo, new Date(jobInfo.getTriggerNextTime()));
+
+ }
+
+ } else {
+ // 2.3、trigger-pre-read:time-ring trigger && make next-trigger-time
+
+ // 1、make ring second
+ int ringSecond = (int)((jobInfo.getTriggerNextTime()/1000)%60);
+
+ // 2、push time ring
+ pushTimeRing(ringSecond, jobInfo.getId());
+
+ // 3、fresh next
+ refreshNextValidTime(jobInfo, new Date(jobInfo.getTriggerNextTime()));
+
+ }
+
+ }
+
+ // 3、update trigger info
+ for (XxlJobInfo jobInfo: scheduleList) {
+ XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().scheduleUpdate(jobInfo);
+ }
+
+ } else {
+ preReadSuc = false;
+ }
+
+ // tx stop
+
+
+ } catch (Exception e) {
+ if (!scheduleThreadToStop) {
+ logger.error(">>>>>>>>>>> xxl-job, JobScheduleHelper#scheduleThread error:{}", e);
+ }
+ } finally {
+
+ // commit
+ 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);
+ }
+ }
+ }
+
+ // close PreparedStatement
+ if (null != preparedStatement) {
+ try {
+ preparedStatement.close();
+ } catch (SQLException e) {
+ if (!scheduleThreadToStop) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+ }
+ }
+ long cost = System.currentTimeMillis()-start;
+
+
+ // Wait seconds, align second
+ if (cost < 1000) { // scan-overtime, not wait
+ try {
+ // pre-read period: success > scan each second; fail > skip this period;
+ TimeUnit.MILLISECONDS.sleep((preReadSuc?1000:PRE_READ_MS) - System.currentTimeMillis()%1000);
+ } catch (InterruptedException e) {
+ if (!scheduleThreadToStop) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+ }
+
+ }
+
+ logger.info(">>>>>>>>>>> xxl-job, JobScheduleHelper#scheduleThread stop");
+ }
+ });
+ scheduleThread.setDaemon(true);
+ scheduleThread.setName("xxl-job, admin JobScheduleHelper#scheduleThread");
+ scheduleThread.start();
+
+
+ // ring thread
+ ringThread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+
+ while (!ringThreadToStop) {
+
+ // align second
+ try {
+ TimeUnit.MILLISECONDS.sleep(1000 - System.currentTimeMillis() % 1000);
+ } catch (InterruptedException e) {
+ if (!ringThreadToStop) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+ try {
+ // second data
+ List ringItemData = new ArrayList<>();
+ int nowSecond = Calendar.getInstance().get(Calendar.SECOND); // 避免处理耗时太长,跨过刻度,向前校验一个刻度;
+ for (int i = 0; i < 2; i++) {
+ List tmpData = ringData.remove( (nowSecond+60-i)%60 );
+ if (tmpData != null) {
+ ringItemData.addAll(tmpData);
+ }
+ }
+
+ // ring trigger
+ logger.debug(">>>>>>>>>>> xxl-job, time-ring beat : " + nowSecond + " = " + Arrays.asList(ringItemData) );
+ if (ringItemData.size() > 0) {
+ // do trigger
+ for (int jobId: ringItemData) {
+ // do trigger
+ JobTriggerPoolHelper.trigger(jobId, TriggerTypeEnum.CRON, -1, null, null, null);
+ }
+ // clear
+ ringItemData.clear();
+ }
+ } catch (Exception e) {
+ if (!ringThreadToStop) {
+ logger.error(">>>>>>>>>>> xxl-job, JobScheduleHelper#ringThread error:{}", e);
+ }
+ }
+ }
+ logger.info(">>>>>>>>>>> xxl-job, JobScheduleHelper#ringThread stop");
+ }
+ });
+ ringThread.setDaemon(true);
+ ringThread.setName("xxl-job, admin JobScheduleHelper#ringThread");
+ ringThread.start();
+ }
+
+ private void refreshNextValidTime(XxlJobInfo jobInfo, Date fromTime) throws Exception {
+ try {
+ Date nextValidTime = generateNextValidTime(jobInfo, fromTime);
+ if (nextValidTime != null) {
+ jobInfo.setTriggerLastTime(jobInfo.getTriggerNextTime());
+ jobInfo.setTriggerNextTime(nextValidTime.getTime());
+ } else {
+ // generateNextValidTime fail, stop job
+ jobInfo.setTriggerStatus(0);
+ jobInfo.setTriggerLastTime(0);
+ jobInfo.setTriggerNextTime(0);
+ logger.error(">>>>>>>>>>> xxl-job, refreshNextValidTime fail for job: jobId={}, scheduleType={}, scheduleConf={}",
+ jobInfo.getId(), jobInfo.getScheduleType(), jobInfo.getScheduleConf());
+ }
+ } catch (Exception e) {
+ // generateNextValidTime error, stop job
+ jobInfo.setTriggerStatus(0);
+ jobInfo.setTriggerLastTime(0);
+ jobInfo.setTriggerNextTime(0);
+
+ logger.error(">>>>>>>>>>> xxl-job, refreshNextValidTime error for job: jobId={}, scheduleType={}, scheduleConf={}",
+ jobInfo.getId(), jobInfo.getScheduleType(), jobInfo.getScheduleConf(), e);
+ }
+ }
+
+ private void pushTimeRing(int ringSecond, int jobId){
+ // push async ring
+ List ringItemData = ringData.get(ringSecond);
+ if (ringItemData == null) {
+ ringItemData = new ArrayList();
+ ringData.put(ringSecond, ringItemData);
+ }
+ ringItemData.add(jobId);
+
+ logger.debug(">>>>>>>>>>> xxl-job, schedule push time-ring : " + ringSecond + " = " + Arrays.asList(ringItemData) );
+ }
+
+ public void toStop(){
+
+ // 1、stop schedule
+ scheduleThreadToStop = true;
+ try {
+ TimeUnit.SECONDS.sleep(1); // wait
+ } catch (InterruptedException e) {
+ logger.error(e.getMessage(), e);
+ }
+ if (scheduleThread.getState() != Thread.State.TERMINATED){
+ // interrupt and wait
+ scheduleThread.interrupt();
+ try {
+ scheduleThread.join();
+ } catch (InterruptedException e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+ // if has ring data
+ boolean hasRingData = false;
+ if (!ringData.isEmpty()) {
+ for (int second : ringData.keySet()) {
+ List tmpData = ringData.get(second);
+ if (tmpData!=null && tmpData.size()>0) {
+ hasRingData = true;
+ break;
+ }
+ }
+ }
+ if (hasRingData) {
+ try {
+ TimeUnit.SECONDS.sleep(8);
+ } catch (InterruptedException e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+ // stop ring (wait job-in-memory stop)
+ ringThreadToStop = true;
+ try {
+ TimeUnit.SECONDS.sleep(1);
+ } catch (InterruptedException e) {
+ logger.error(e.getMessage(), e);
+ }
+ if (ringThread.getState() != Thread.State.TERMINATED){
+ // interrupt and wait
+ ringThread.interrupt();
+ try {
+ ringThread.join();
+ } catch (InterruptedException e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
+
+ logger.info(">>>>>>>>>>> xxl-job, JobScheduleHelper stop");
+ }
+
+
+ // ---------------------- tools ----------------------
+ public static Date generateNextValidTime(XxlJobInfo jobInfo, Date fromTime) throws Exception {
+ ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(jobInfo.getScheduleType(), null);
+ if (ScheduleTypeEnum.CRON == scheduleTypeEnum) {
+ Date nextValidTime = new CronExpression(jobInfo.getScheduleConf()).getNextValidTimeAfter(fromTime);
+ return nextValidTime;
+ } else if (ScheduleTypeEnum.FIX_RATE == scheduleTypeEnum /*|| ScheduleTypeEnum.FIX_DELAY == scheduleTypeEnum*/) {
+ return new Date(fromTime.getTime() + Integer.valueOf(jobInfo.getScheduleConf())*1000 );
+ }
+ return null;
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobTriggerPoolHelper.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobTriggerPoolHelper.java
new file mode 100644
index 0000000..398713d
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobTriggerPoolHelper.java
@@ -0,0 +1,150 @@
+package com.xxl.job.admin.core.thread;
+
+import com.xxl.job.admin.core.conf.XxlJobAdminConfig;
+import com.xxl.job.admin.core.trigger.TriggerTypeEnum;
+import com.xxl.job.admin.core.trigger.XxlJobTrigger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * job trigger thread pool helper
+ *
+ * @author xuxueli 2018-07-03 21:08:07
+ */
+public class JobTriggerPoolHelper {
+ private static Logger logger = LoggerFactory.getLogger(JobTriggerPoolHelper.class);
+
+
+ // ---------------------- trigger pool ----------------------
+
+ // fast/slow thread pool
+ private ThreadPoolExecutor fastTriggerPool = null;
+ private ThreadPoolExecutor slowTriggerPool = null;
+
+ public void start(){
+ fastTriggerPool = new ThreadPoolExecutor(
+ 10,
+ XxlJobAdminConfig.getAdminConfig().getTriggerPoolFastMax(),
+ 60L,
+ TimeUnit.SECONDS,
+ new LinkedBlockingQueue(1000),
+ new ThreadFactory() {
+ @Override
+ public Thread newThread(Runnable r) {
+ return new Thread(r, "xxl-job, admin JobTriggerPoolHelper-fastTriggerPool-" + r.hashCode());
+ }
+ });
+
+ slowTriggerPool = new ThreadPoolExecutor(
+ 10,
+ XxlJobAdminConfig.getAdminConfig().getTriggerPoolSlowMax(),
+ 60L,
+ TimeUnit.SECONDS,
+ new LinkedBlockingQueue(2000),
+ new ThreadFactory() {
+ @Override
+ public Thread newThread(Runnable r) {
+ return new Thread(r, "xxl-job, admin JobTriggerPoolHelper-slowTriggerPool-" + r.hashCode());
+ }
+ });
+ }
+
+
+ public void stop() {
+ //triggerPool.shutdown();
+ fastTriggerPool.shutdownNow();
+ slowTriggerPool.shutdownNow();
+ logger.info(">>>>>>>>> xxl-job trigger thread pool shutdown success.");
+ }
+
+
+ // job timeout count
+ private volatile long minTim = System.currentTimeMillis()/60000; // ms > min
+ private volatile ConcurrentMap jobTimeoutCountMap = new ConcurrentHashMap<>();
+
+
+ /**
+ * add trigger
+ */
+ public void addTrigger(final int jobId,
+ final TriggerTypeEnum triggerType,
+ final int failRetryCount,
+ final String executorShardingParam,
+ final String executorParam,
+ final String addressList) {
+
+ // choose thread pool
+ ThreadPoolExecutor triggerPool_ = fastTriggerPool;
+ AtomicInteger jobTimeoutCount = jobTimeoutCountMap.get(jobId);
+ if (jobTimeoutCount!=null && jobTimeoutCount.get() > 10) { // job-timeout 10 times in 1 min
+ triggerPool_ = slowTriggerPool;
+ }
+
+ // trigger
+ triggerPool_.execute(new Runnable() {
+ @Override
+ public void run() {
+
+ long start = System.currentTimeMillis();
+
+ try {
+ // do trigger
+ XxlJobTrigger.trigger(jobId, triggerType, failRetryCount, executorShardingParam, executorParam, addressList);
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ } finally {
+
+ // check timeout-count-map
+ long minTim_now = System.currentTimeMillis()/60000;
+ if (minTim != minTim_now) {
+ minTim = minTim_now;
+ jobTimeoutCountMap.clear();
+ }
+
+ // incr timeout-count-map
+ long cost = System.currentTimeMillis()-start;
+ if (cost > 500) { // ob-timeout threshold 500ms
+ AtomicInteger timeoutCount = jobTimeoutCountMap.putIfAbsent(jobId, new AtomicInteger(1));
+ if (timeoutCount != null) {
+ timeoutCount.incrementAndGet();
+ }
+ }
+
+ }
+
+ }
+ });
+ }
+
+
+
+ // ---------------------- helper ----------------------
+
+ private static JobTriggerPoolHelper helper = new JobTriggerPoolHelper();
+
+ public static void toStart() {
+ helper.start();
+ }
+ public static void toStop() {
+ helper.stop();
+ }
+
+ /**
+ * @param jobId
+ * @param triggerType
+ * @param failRetryCount
+ * >=0: use this param
+ * <0: use param from job info config
+ * @param executorShardingParam
+ * @param executorParam
+ * null: use job param
+ * not null: cover job param
+ */
+ public static void trigger(int jobId, TriggerTypeEnum triggerType, int failRetryCount, String executorShardingParam, String executorParam, String addressList) {
+ helper.addTrigger(jobId, triggerType, failRetryCount, executorShardingParam, executorParam, addressList);
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/TriggerTypeEnum.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/TriggerTypeEnum.java
new file mode 100644
index 0000000..446c90e
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/TriggerTypeEnum.java
@@ -0,0 +1,27 @@
+package com.xxl.job.admin.core.trigger;
+
+import com.xxl.job.admin.core.util.I18nUtil;
+
+/**
+ * trigger type enum
+ *
+ * @author xuxueli 2018-09-16 04:56:41
+ */
+public enum TriggerTypeEnum {
+
+ MANUAL(I18nUtil.getString("jobconf_trigger_type_manual")),
+ CRON(I18nUtil.getString("jobconf_trigger_type_cron")),
+ RETRY(I18nUtil.getString("jobconf_trigger_type_retry")),
+ PARENT(I18nUtil.getString("jobconf_trigger_type_parent")),
+ API(I18nUtil.getString("jobconf_trigger_type_api")),
+ MISFIRE(I18nUtil.getString("jobconf_trigger_type_misfire"));
+
+ private TriggerTypeEnum(String title){
+ this.title = title;
+ }
+ private String title;
+ public String getTitle() {
+ return title;
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java
new file mode 100644
index 0000000..748befc
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java
@@ -0,0 +1,226 @@
+package com.xxl.job.admin.core.trigger;
+
+import com.xxl.job.admin.core.conf.XxlJobAdminConfig;
+import com.xxl.job.admin.core.model.XxlJobGroup;
+import com.xxl.job.admin.core.model.XxlJobInfo;
+import com.xxl.job.admin.core.model.XxlJobLog;
+import com.xxl.job.admin.core.route.ExecutorRouteStrategyEnum;
+import com.xxl.job.admin.core.scheduler.XxlJobScheduler;
+import com.xxl.job.admin.core.util.I18nUtil;
+import com.xxl.job.core.biz.ExecutorBiz;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.biz.model.TriggerParam;
+import com.xxl.job.core.enums.ExecutorBlockStrategyEnum;
+import com.xxl.job.core.util.IpUtil;
+import com.xxl.job.core.util.ThrowableUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+
+/**
+ * xxl-job trigger
+ * Created by xuxueli on 17/7/13.
+ */
+public class XxlJobTrigger {
+ private static Logger logger = LoggerFactory.getLogger(XxlJobTrigger.class);
+
+ /**
+ * trigger job
+ *
+ * @param jobId
+ * @param triggerType
+ * @param failRetryCount
+ * >=0: use this param
+ * <0: use param from job info config
+ * @param executorShardingParam
+ * @param executorParam
+ * null: use job param
+ * not null: cover job param
+ * @param addressList
+ * null: use executor addressList
+ * not null: cover
+ */
+ public static void trigger(int jobId,
+ TriggerTypeEnum triggerType,
+ int failRetryCount,
+ String executorShardingParam,
+ String executorParam,
+ String addressList) {
+
+ // load data
+ XxlJobInfo jobInfo = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().loadById(jobId);
+ if (jobInfo == null) {
+ logger.warn(">>>>>>>>>>>> trigger fail, jobId invalid,jobId={}", jobId);
+ return;
+ }
+ if (executorParam != null) {
+ jobInfo.setExecutorParam(executorParam);
+ }
+ int finalFailRetryCount = failRetryCount>=0?failRetryCount:jobInfo.getExecutorFailRetryCount();
+ XxlJobGroup group = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().load(jobInfo.getJobGroup());
+
+ // cover addressList
+ if (addressList!=null && addressList.trim().length()>0) {
+ group.setAddressType(1);
+ group.setAddressList(addressList.trim());
+ }
+
+ // sharding param
+ int[] shardingParam = null;
+ if (executorShardingParam!=null){
+ String[] shardingArr = executorShardingParam.split("/");
+ if (shardingArr.length==2 && isNumeric(shardingArr[0]) && isNumeric(shardingArr[1])) {
+ shardingParam = new int[2];
+ shardingParam[0] = Integer.valueOf(shardingArr[0]);
+ shardingParam[1] = Integer.valueOf(shardingArr[1]);
+ }
+ }
+ if (ExecutorRouteStrategyEnum.SHARDING_BROADCAST==ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null)
+ && group.getRegistryList()!=null && !group.getRegistryList().isEmpty()
+ && shardingParam==null) {
+ for (int i = 0; i < group.getRegistryList().size(); i++) {
+ processTrigger(group, jobInfo, finalFailRetryCount, triggerType, i, group.getRegistryList().size());
+ }
+ } else {
+ if (shardingParam == null) {
+ shardingParam = new int[]{0, 1};
+ }
+ processTrigger(group, jobInfo, finalFailRetryCount, triggerType, shardingParam[0], shardingParam[1]);
+ }
+
+ }
+
+ private static boolean isNumeric(String str){
+ try {
+ int result = Integer.valueOf(str);
+ return true;
+ } catch (NumberFormatException e) {
+ return false;
+ }
+ }
+
+ /**
+ * @param group job group, registry list may be empty
+ * @param jobInfo
+ * @param finalFailRetryCount
+ * @param triggerType
+ * @param index sharding index
+ * @param total sharding index
+ */
+ private static void processTrigger(XxlJobGroup group, XxlJobInfo jobInfo, int finalFailRetryCount, TriggerTypeEnum triggerType, int index, int total){
+
+ // param
+ ExecutorBlockStrategyEnum blockStrategy = ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), ExecutorBlockStrategyEnum.SERIAL_EXECUTION); // block strategy
+ ExecutorRouteStrategyEnum executorRouteStrategyEnum = ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null); // route strategy
+ String shardingParam = (ExecutorRouteStrategyEnum.SHARDING_BROADCAST==executorRouteStrategyEnum)?String.valueOf(index).concat("/").concat(String.valueOf(total)):null;
+
+ // 1、save log-id
+ XxlJobLog jobLog = new XxlJobLog();
+ jobLog.setJobGroup(jobInfo.getJobGroup());
+ jobLog.setJobId(jobInfo.getId());
+ jobLog.setTriggerTime(new Date());
+ XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().save(jobLog);
+ logger.debug(">>>>>>>>>>> xxl-job trigger start, jobId:{}", jobLog.getId());
+
+ // 2、init trigger-param
+ TriggerParam triggerParam = new TriggerParam();
+ triggerParam.setJobId(jobInfo.getId());
+ triggerParam.setExecutorHandler(jobInfo.getExecutorHandler());
+ triggerParam.setExecutorParams(jobInfo.getExecutorParam());
+ triggerParam.setExecutorBlockStrategy(jobInfo.getExecutorBlockStrategy());
+ triggerParam.setExecutorTimeout(jobInfo.getExecutorTimeout());
+ triggerParam.setLogId(jobLog.getId());
+ triggerParam.setLogDateTime(jobLog.getTriggerTime().getTime());
+ triggerParam.setGlueType(jobInfo.getGlueType());
+ triggerParam.setGlueSource(jobInfo.getGlueSource());
+ triggerParam.setGlueUpdatetime(jobInfo.getGlueUpdatetime().getTime());
+ triggerParam.setBroadcastIndex(index);
+ triggerParam.setBroadcastTotal(total);
+
+ // 3、init address
+ String address = null;
+ ReturnT routeAddressResult = null;
+ if (group.getRegistryList()!=null && !group.getRegistryList().isEmpty()) {
+ if (ExecutorRouteStrategyEnum.SHARDING_BROADCAST == executorRouteStrategyEnum) {
+ if (index < group.getRegistryList().size()) {
+ address = group.getRegistryList().get(index);
+ } else {
+ address = group.getRegistryList().get(0);
+ }
+ } else {
+ routeAddressResult = executorRouteStrategyEnum.getRouter().route(triggerParam, group.getRegistryList());
+ if (routeAddressResult.getCode() == ReturnT.SUCCESS_CODE) {
+ address = routeAddressResult.getContent();
+ }
+ }
+ } else {
+ routeAddressResult = new ReturnT(ReturnT.FAIL_CODE, I18nUtil.getString("jobconf_trigger_address_empty"));
+ }
+
+ // 4、trigger remote executor
+ ReturnT triggerResult = null;
+ if (address != null) {
+ triggerResult = runExecutor(triggerParam, address);
+ } else {
+ triggerResult = new ReturnT(ReturnT.FAIL_CODE, null);
+ }
+
+ // 5、collection trigger info
+ StringBuffer triggerMsgSb = new StringBuffer();
+ triggerMsgSb.append(I18nUtil.getString("jobconf_trigger_type")).append(":").append(triggerType.getTitle());
+ triggerMsgSb.append("
").append(I18nUtil.getString("jobconf_trigger_admin_adress")).append(":").append(IpUtil.getIp());
+ triggerMsgSb.append("
").append(I18nUtil.getString("jobconf_trigger_exe_regtype")).append(":")
+ .append( (group.getAddressType() == 0)?I18nUtil.getString("jobgroup_field_addressType_0"):I18nUtil.getString("jobgroup_field_addressType_1") );
+ triggerMsgSb.append("
").append(I18nUtil.getString("jobconf_trigger_exe_regaddress")).append(":").append(group.getRegistryList());
+ triggerMsgSb.append("
").append(I18nUtil.getString("jobinfo_field_executorRouteStrategy")).append(":").append(executorRouteStrategyEnum.getTitle());
+ if (shardingParam != null) {
+ triggerMsgSb.append("("+shardingParam+")");
+ }
+ triggerMsgSb.append("
").append(I18nUtil.getString("jobinfo_field_executorBlockStrategy")).append(":").append(blockStrategy.getTitle());
+ triggerMsgSb.append("
").append(I18nUtil.getString("jobinfo_field_timeout")).append(":").append(jobInfo.getExecutorTimeout());
+ triggerMsgSb.append("
").append(I18nUtil.getString("jobinfo_field_executorFailRetryCount")).append(":").append(finalFailRetryCount);
+
+ triggerMsgSb.append("
>>>>>>>>>>>"+ I18nUtil.getString("jobconf_trigger_run") +"<<<<<<<<<<<
")
+ .append((routeAddressResult!=null&&routeAddressResult.getMsg()!=null)?routeAddressResult.getMsg()+"
":"").append(triggerResult.getMsg()!=null?triggerResult.getMsg():"");
+
+ // 6、save log trigger-info
+ jobLog.setExecutorAddress(address);
+ jobLog.setExecutorHandler(jobInfo.getExecutorHandler());
+ jobLog.setExecutorParam(jobInfo.getExecutorParam());
+ jobLog.setExecutorShardingParam(shardingParam);
+ jobLog.setExecutorFailRetryCount(finalFailRetryCount);
+ //jobLog.setTriggerTime();
+ jobLog.setTriggerCode(triggerResult.getCode());
+ jobLog.setTriggerMsg(triggerMsgSb.toString());
+ XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateTriggerInfo(jobLog);
+
+ logger.debug(">>>>>>>>>>> xxl-job trigger end, jobId:{}", jobLog.getId());
+ }
+
+ /**
+ * run executor
+ * @param triggerParam
+ * @param address
+ * @return
+ */
+ public static ReturnT runExecutor(TriggerParam triggerParam, String address){
+ ReturnT runResult = null;
+ try {
+ ExecutorBiz executorBiz = XxlJobScheduler.getExecutorBiz(address);
+ runResult = executorBiz.run(triggerParam);
+ } catch (Exception e) {
+ logger.error(">>>>>>>>>>> xxl-job trigger error, please check if the executor[{}] is running.", address, e);
+ runResult = new ReturnT(ReturnT.FAIL_CODE, ThrowableUtil.toString(e));
+ }
+
+ StringBuffer runResultSB = new StringBuffer(I18nUtil.getString("jobconf_trigger_run") + ":");
+ runResultSB.append("
address:").append(address);
+ runResultSB.append("
code:").append(runResult.getCode());
+ runResultSB.append("
msg:").append(runResult.getMsg());
+
+ runResult.setMsg(runResultSB.toString());
+ return runResult;
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/CookieUtil.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/CookieUtil.java
new file mode 100644
index 0000000..a1523aa
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/CookieUtil.java
@@ -0,0 +1,98 @@
+package com.xxl.job.admin.core.util;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Cookie.Util
+ *
+ * @author xuxueli 2015-12-12 18:01:06
+ */
+public class CookieUtil {
+
+ // 默认缓存时间,单位/秒, 2H
+ private static final int COOKIE_MAX_AGE = Integer.MAX_VALUE;
+ // 保存路径,根路径
+ private static final String COOKIE_PATH = "/";
+
+ /**
+ * 保存
+ *
+ * @param response
+ * @param key
+ * @param value
+ * @param ifRemember
+ */
+ public static void set(HttpServletResponse response, String key, String value, boolean ifRemember) {
+ int age = ifRemember?COOKIE_MAX_AGE:-1;
+ set(response, key, value, null, COOKIE_PATH, age, true);
+ }
+
+ /**
+ * 保存
+ *
+ * @param response
+ * @param key
+ * @param value
+ * @param maxAge
+ */
+ private static void set(HttpServletResponse response, String key, String value, String domain, String path, int maxAge, boolean isHttpOnly) {
+ Cookie cookie = new Cookie(key, value);
+ if (domain != null) {
+ cookie.setDomain(domain);
+ }
+ cookie.setPath(path);
+ cookie.setMaxAge(maxAge);
+ cookie.setHttpOnly(isHttpOnly);
+ response.addCookie(cookie);
+ }
+
+ /**
+ * 查询value
+ *
+ * @param request
+ * @param key
+ * @return
+ */
+ public static String getValue(HttpServletRequest request, String key) {
+ Cookie cookie = get(request, key);
+ if (cookie != null) {
+ return cookie.getValue();
+ }
+ return null;
+ }
+
+ /**
+ * 查询Cookie
+ *
+ * @param request
+ * @param key
+ */
+ private static Cookie get(HttpServletRequest request, String key) {
+ Cookie[] arr_cookie = request.getCookies();
+ if (arr_cookie != null && arr_cookie.length > 0) {
+ for (Cookie cookie : arr_cookie) {
+ if (cookie.getName().equals(key)) {
+ return cookie;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * 删除Cookie
+ *
+ * @param request
+ * @param response
+ * @param key
+ */
+ public static void remove(HttpServletRequest request, HttpServletResponse response, String key) {
+ Cookie cookie = get(request, key);
+ if (cookie != null) {
+ set(response, key, "", null, COOKIE_PATH, 0, true);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/FtlUtil.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/FtlUtil.java
new file mode 100644
index 0000000..e90af43
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/FtlUtil.java
@@ -0,0 +1,31 @@
+package com.xxl.job.admin.core.util;
+
+import freemarker.ext.beans.BeansWrapper;
+import freemarker.ext.beans.BeansWrapperBuilder;
+import freemarker.template.Configuration;
+import freemarker.template.TemplateHashModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * ftl util
+ *
+ * @author xuxueli 2018-01-17 20:37:48
+ */
+public class FtlUtil {
+ private static Logger logger = LoggerFactory.getLogger(FtlUtil.class);
+
+ private static BeansWrapper wrapper = new BeansWrapperBuilder(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS).build(); //BeansWrapper.getDefaultInstance();
+
+ public static TemplateHashModel generateStaticModel(String packageName) {
+ try {
+ TemplateHashModel staticModels = wrapper.getStaticModels();
+ TemplateHashModel fileStatics = (TemplateHashModel) staticModels.get(packageName);
+ return fileStatics;
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ }
+ return null;
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/I18nUtil.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/I18nUtil.java
new file mode 100644
index 0000000..772a96e
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/I18nUtil.java
@@ -0,0 +1,79 @@
+package com.xxl.job.admin.core.util;
+
+import com.xxl.job.admin.core.conf.XxlJobAdminConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.EncodedResource;
+import org.springframework.core.io.support.PropertiesLoaderUtils;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * i18n util
+ *
+ * @author xuxueli 2018-01-17 20:39:06
+ */
+public class I18nUtil {
+ private static Logger logger = LoggerFactory.getLogger(I18nUtil.class);
+
+ private static Properties prop = null;
+ public static Properties loadI18nProp(){
+ if (prop != null) {
+ return prop;
+ }
+ try {
+ // build i18n prop
+ String i18n = XxlJobAdminConfig.getAdminConfig().getI18n();
+ String i18nFile = MessageFormat.format("i18n/message_{0}.properties", i18n);
+
+ // load prop
+ Resource resource = new ClassPathResource(i18nFile);
+ EncodedResource encodedResource = new EncodedResource(resource,"UTF-8");
+ prop = PropertiesLoaderUtils.loadProperties(encodedResource);
+ } catch (IOException e) {
+ logger.error(e.getMessage(), e);
+ }
+ return prop;
+ }
+
+ /**
+ * get val of i18n key
+ *
+ * @param key
+ * @return
+ */
+ public static String getString(String key) {
+ return loadI18nProp().getProperty(key);
+ }
+
+ /**
+ * get mult val of i18n mult key, as json
+ *
+ * @param keys
+ * @return
+ */
+ public static String getMultString(String... keys) {
+ Map map = new HashMap();
+
+ Properties prop = loadI18nProp();
+ if (keys!=null && keys.length>0) {
+ for (String key: keys) {
+ map.put(key, prop.getProperty(key));
+ }
+ } else {
+ for (String key: prop.stringPropertyNames()) {
+ map.put(key, prop.getProperty(key));
+ }
+ }
+
+ String json = JacksonUtil.writeValueAsString(map);
+ return json;
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/JacksonUtil.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/JacksonUtil.java
new file mode 100644
index 0000000..4f4ea3c
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/JacksonUtil.java
@@ -0,0 +1,92 @@
+package com.xxl.job.admin.core.util;
+
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+/**
+ * Jackson util
+ *
+ * 1、obj need private and set/get;
+ * 2、do not support inner class;
+ *
+ * @author xuxueli 2015-9-25 18:02:56
+ */
+public class JacksonUtil {
+ private static Logger logger = LoggerFactory.getLogger(JacksonUtil.class);
+
+ private final static ObjectMapper objectMapper = new ObjectMapper();
+ public static ObjectMapper getInstance() {
+ return objectMapper;
+ }
+
+ /**
+ * bean、array、List、Map --> json
+ *
+ * @param obj
+ * @return json string
+ * @throws Exception
+ */
+ public static String writeValueAsString(Object obj) {
+ try {
+ return getInstance().writeValueAsString(obj);
+ } catch (JsonGenerationException e) {
+ logger.error(e.getMessage(), e);
+ } catch (JsonMappingException e) {
+ logger.error(e.getMessage(), e);
+ } catch (IOException e) {
+ logger.error(e.getMessage(), e);
+ }
+ return null;
+ }
+
+ /**
+ * string --> bean、Map、List(array)
+ *
+ * @param jsonStr
+ * @param clazz
+ * @return obj
+ * @throws Exception
+ */
+ public static T readValue(String jsonStr, Class clazz) {
+ try {
+ return getInstance().readValue(jsonStr, clazz);
+ } catch (JsonParseException e) {
+ logger.error(e.getMessage(), e);
+ } catch (JsonMappingException e) {
+ logger.error(e.getMessage(), e);
+ } catch (IOException e) {
+ logger.error(e.getMessage(), e);
+ }
+ return null;
+ }
+
+ /**
+ * string --> List...
+ *
+ * @param jsonStr
+ * @param parametrized
+ * @param parameterClasses
+ * @param
+ * @return
+ */
+ public static T readValue(String jsonStr, Class> parametrized, Class>... parameterClasses) {
+ try {
+ JavaType javaType = getInstance().getTypeFactory().constructParametricType(parametrized, parameterClasses);
+ return getInstance().readValue(jsonStr, javaType);
+ } catch (JsonParseException e) {
+ logger.error(e.getMessage(), e);
+ } catch (JsonMappingException e) {
+ logger.error(e.getMessage(), e);
+ } catch (IOException e) {
+ logger.error(e.getMessage(), e);
+ }
+ return null;
+ }
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/LocalCacheUtil.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/LocalCacheUtil.java
new file mode 100644
index 0000000..fbab061
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/LocalCacheUtil.java
@@ -0,0 +1,133 @@
+package com.xxl.job.admin.core.util;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * local cache tool
+ *
+ * @author xuxueli 2018-01-22 21:37:34
+ */
+public class LocalCacheUtil {
+
+ private static ConcurrentMap cacheRepository = new ConcurrentHashMap(); // 类型建议用抽象父类,兼容性更好;
+ private static class LocalCacheData{
+ private String key;
+ private Object val;
+ private long timeoutTime;
+
+ public LocalCacheData() {
+ }
+
+ public LocalCacheData(String key, Object val, long timeoutTime) {
+ this.key = key;
+ this.val = val;
+ this.timeoutTime = timeoutTime;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ public Object getVal() {
+ return val;
+ }
+
+ public void setVal(Object val) {
+ this.val = val;
+ }
+
+ public long getTimeoutTime() {
+ return timeoutTime;
+ }
+
+ public void setTimeoutTime(long timeoutTime) {
+ this.timeoutTime = timeoutTime;
+ }
+ }
+
+
+ /**
+ * set cache
+ *
+ * @param key
+ * @param val
+ * @param cacheTime
+ * @return
+ */
+ public static boolean set(String key, Object val, long cacheTime){
+
+ // clean timeout cache, before set new cache (avoid cache too much)
+ cleanTimeoutCache();
+
+ // set new cache
+ if (key==null || key.trim().length()==0) {
+ return false;
+ }
+ if (val == null) {
+ remove(key);
+ }
+ if (cacheTime <= 0) {
+ remove(key);
+ }
+ long timeoutTime = System.currentTimeMillis() + cacheTime;
+ LocalCacheData localCacheData = new LocalCacheData(key, val, timeoutTime);
+ cacheRepository.put(localCacheData.getKey(), localCacheData);
+ return true;
+ }
+
+ /**
+ * remove cache
+ *
+ * @param key
+ * @return
+ */
+ public static boolean remove(String key){
+ if (key==null || key.trim().length()==0) {
+ return false;
+ }
+ cacheRepository.remove(key);
+ return true;
+ }
+
+ /**
+ * get cache
+ *
+ * @param key
+ * @return
+ */
+ public static Object get(String key){
+ if (key==null || key.trim().length()==0) {
+ return null;
+ }
+ LocalCacheData localCacheData = cacheRepository.get(key);
+ if (localCacheData!=null && System.currentTimeMillis()=localCacheData.getTimeoutTime()) {
+ cacheRepository.remove(key);
+ }
+ }
+ }
+ return true;
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobGroupDao.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobGroupDao.java
new file mode 100644
index 0000000..b608d9f
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobGroupDao.java
@@ -0,0 +1,37 @@
+package com.xxl.job.admin.dao;
+
+import com.xxl.job.admin.core.model.XxlJobGroup;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * Created by xuxueli on 16/9/30.
+ */
+@Mapper
+public interface XxlJobGroupDao {
+
+ public List findAll();
+
+ public List findByAddressType(@Param("addressType") int addressType);
+
+ public int save(XxlJobGroup xxlJobGroup);
+
+ public int update(XxlJobGroup xxlJobGroup);
+
+ public int remove(@Param("id") int id);
+
+ public XxlJobGroup load(@Param("id") int id);
+
+ public List pageList(@Param("offset") int offset,
+ @Param("pagesize") int pagesize,
+ @Param("appname") String appname,
+ @Param("title") String title);
+
+ public int pageListCount(@Param("offset") int offset,
+ @Param("pagesize") int pagesize,
+ @Param("appname") String appname,
+ @Param("title") String title);
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobInfoDao.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobInfoDao.java
new file mode 100644
index 0000000..d640eff
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobInfoDao.java
@@ -0,0 +1,49 @@
+package com.xxl.job.admin.dao;
+
+import com.xxl.job.admin.core.model.XxlJobInfo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+/**
+ * job info
+ * @author xuxueli 2016-1-12 18:03:45
+ */
+@Mapper
+public interface XxlJobInfoDao {
+
+ public List pageList(@Param("offset") int offset,
+ @Param("pagesize") int pagesize,
+ @Param("jobGroup") int jobGroup,
+ @Param("triggerStatus") int triggerStatus,
+ @Param("jobDesc") String jobDesc,
+ @Param("executorHandler") String executorHandler,
+ @Param("author") String author);
+ public int pageListCount(@Param("offset") int offset,
+ @Param("pagesize") int pagesize,
+ @Param("jobGroup") int jobGroup,
+ @Param("triggerStatus") int triggerStatus,
+ @Param("jobDesc") String jobDesc,
+ @Param("executorHandler") String executorHandler,
+ @Param("author") String author);
+
+ public int save(XxlJobInfo info);
+
+ public XxlJobInfo loadById(@Param("id") int id);
+
+ public int update(XxlJobInfo xxlJobInfo);
+
+ public int delete(@Param("id") long id);
+
+ public List getJobsByGroup(@Param("jobGroup") int jobGroup);
+
+ public int findAllCount();
+
+ public List scheduleJobQuery(@Param("maxNextTime") long maxNextTime, @Param("pagesize") int pagesize );
+
+ public int scheduleUpdate(XxlJobInfo xxlJobInfo);
+
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogDao.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogDao.java
new file mode 100644
index 0000000..62fa3b4
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogDao.java
@@ -0,0 +1,62 @@
+package com.xxl.job.admin.dao;
+
+import com.xxl.job.admin.core.model.XxlJobLog;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * job log
+ * @author xuxueli 2016-1-12 18:03:06
+ */
+@Mapper
+public interface XxlJobLogDao {
+
+ // exist jobId not use jobGroup, not exist use jobGroup
+ public List pageList(@Param("offset") int offset,
+ @Param("pagesize") int pagesize,
+ @Param("jobGroup") int jobGroup,
+ @Param("jobId") int jobId,
+ @Param("triggerTimeStart") Date triggerTimeStart,
+ @Param("triggerTimeEnd") Date triggerTimeEnd,
+ @Param("logStatus") int logStatus);
+ public int pageListCount(@Param("offset") int offset,
+ @Param("pagesize") int pagesize,
+ @Param("jobGroup") int jobGroup,
+ @Param("jobId") int jobId,
+ @Param("triggerTimeStart") Date triggerTimeStart,
+ @Param("triggerTimeEnd") Date triggerTimeEnd,
+ @Param("logStatus") int logStatus);
+
+ public XxlJobLog load(@Param("id") long id);
+
+ public long save(XxlJobLog xxlJobLog);
+
+ public int updateTriggerInfo(XxlJobLog xxlJobLog);
+
+ public int updateHandleInfo(XxlJobLog xxlJobLog);
+
+ public int delete(@Param("jobId") int jobId);
+
+ public Map findLogReport(@Param("from") Date from,
+ @Param("to") Date to);
+
+ public List findClearLogIds(@Param("jobGroup") int jobGroup,
+ @Param("jobId") int jobId,
+ @Param("clearBeforeTime") Date clearBeforeTime,
+ @Param("clearBeforeNum") int clearBeforeNum,
+ @Param("pagesize") int pagesize);
+ public int clearLog(@Param("logIds") List logIds);
+
+ public List findFailJobLogIds(@Param("pagesize") int pagesize);
+
+ public int updateAlarmStatus(@Param("logId") long logId,
+ @Param("oldAlarmStatus") int oldAlarmStatus,
+ @Param("newAlarmStatus") int newAlarmStatus);
+
+ public List findLostJobIds(@Param("losedTime") Date losedTime);
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogGlueDao.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogGlueDao.java
new file mode 100644
index 0000000..3028aed
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogGlueDao.java
@@ -0,0 +1,24 @@
+package com.xxl.job.admin.dao;
+
+import com.xxl.job.admin.core.model.XxlJobLogGlue;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * job log for glue
+ * @author xuxueli 2016-5-19 18:04:56
+ */
+@Mapper
+public interface XxlJobLogGlueDao {
+
+ public int save(XxlJobLogGlue xxlJobLogGlue);
+
+ public List findByJobId(@Param("jobId") int jobId);
+
+ public int removeOld(@Param("jobId") int jobId, @Param("limit") int limit);
+
+ public int deleteByJobId(@Param("jobId") int jobId);
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogReportDao.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogReportDao.java
new file mode 100644
index 0000000..f4b3dc8
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogReportDao.java
@@ -0,0 +1,26 @@
+package com.xxl.job.admin.dao;
+
+import com.xxl.job.admin.core.model.XxlJobLogReport;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * job log
+ * @author xuxueli 2019-11-22
+ */
+@Mapper
+public interface XxlJobLogReportDao {
+
+ public int save(XxlJobLogReport xxlJobLogReport);
+
+ public int update(XxlJobLogReport xxlJobLogReport);
+
+ public List queryLogReport(@Param("triggerDayFrom") Date triggerDayFrom,
+ @Param("triggerDayTo") Date triggerDayTo);
+
+ public XxlJobLogReport queryLogReportTotal();
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobRegistryDao.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobRegistryDao.java
new file mode 100644
index 0000000..1005c46
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobRegistryDao.java
@@ -0,0 +1,38 @@
+package com.xxl.job.admin.dao;
+
+import com.xxl.job.admin.core.model.XxlJobRegistry;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Created by xuxueli on 16/9/30.
+ */
+@Mapper
+public interface XxlJobRegistryDao {
+
+ public List findDead(@Param("timeout") int timeout,
+ @Param("nowTime") Date nowTime);
+
+ public int removeDead(@Param("ids") List ids);
+
+ public List findAll(@Param("timeout") int timeout,
+ @Param("nowTime") Date nowTime);
+
+ public int registryUpdate(@Param("registryGroup") String registryGroup,
+ @Param("registryKey") String registryKey,
+ @Param("registryValue") String registryValue,
+ @Param("updateTime") Date updateTime);
+
+ public int registrySave(@Param("registryGroup") String registryGroup,
+ @Param("registryKey") String registryKey,
+ @Param("registryValue") String registryValue,
+ @Param("updateTime") Date updateTime);
+
+ public int registryDelete(@Param("registryGroup") String registryGroup,
+ @Param("registryKey") String registryKey,
+ @Param("registryValue") String registryValue);
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobUserDao.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobUserDao.java
new file mode 100644
index 0000000..e840494
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobUserDao.java
@@ -0,0 +1,31 @@
+package com.xxl.job.admin.dao;
+
+import com.xxl.job.admin.core.model.XxlJobUser;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import java.util.List;
+
+/**
+ * @author xuxueli 2019-05-04 16:44:59
+ */
+@Mapper
+public interface XxlJobUserDao {
+
+ public List pageList(@Param("offset") int offset,
+ @Param("pagesize") int pagesize,
+ @Param("username") String username,
+ @Param("role") int role);
+ public int pageListCount(@Param("offset") int offset,
+ @Param("pagesize") int pagesize,
+ @Param("username") String username,
+ @Param("role") int role);
+
+ public XxlJobUser loadByUserName(@Param("username") String username);
+
+ public int save(XxlJobUser xxlJobUser);
+
+ public int update(XxlJobUser xxlJobUser);
+
+ public int delete(@Param("id") int id);
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/service/XxlJobService.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/service/XxlJobService.java
new file mode 100644
index 0000000..12297f4
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/service/XxlJobService.java
@@ -0,0 +1,98 @@
+package com.xxl.job.admin.service;
+
+
+import com.xxl.job.admin.core.model.XxlJobInfo;
+import com.xxl.job.admin.core.model.XxlJobUser;
+import com.xxl.job.core.biz.model.ReturnT;
+
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * core job action for xxl-job
+ *
+ * @author xuxueli 2016-5-28 15:30:33
+ */
+public interface XxlJobService {
+
+ /**
+ * page list
+ *
+ * @param start
+ * @param length
+ * @param jobGroup
+ * @param jobDesc
+ * @param executorHandler
+ * @param author
+ * @return
+ */
+ public Map pageList(int start, int length, int jobGroup, int triggerStatus, String jobDesc, String executorHandler, String author);
+
+ /**
+ * add job
+ *
+ * @param jobInfo
+ * @return
+ */
+ public ReturnT add(XxlJobInfo jobInfo, XxlJobUser loginUser);
+
+ /**
+ * update job
+ *
+ * @param jobInfo
+ * @return
+ */
+ public ReturnT update(XxlJobInfo jobInfo, XxlJobUser loginUser);
+
+ /**
+ * remove job
+ * *
+ * @param id
+ * @return
+ */
+ public ReturnT remove(int id);
+
+ /**
+ * start job
+ *
+ * @param id
+ * @return
+ */
+ public ReturnT start(int id);
+
+ /**
+ * stop job
+ *
+ * @param id
+ * @return
+ */
+ public ReturnT stop(int id);
+
+ /**
+ * trigger
+ *
+ * @param loginUser
+ * @param jobId
+ * @param executorParam
+ * @param addressList
+ * @return
+ */
+ public ReturnT trigger(XxlJobUser loginUser, int jobId, String executorParam, String addressList);
+
+ /**
+ * dashboard info
+ *
+ * @return
+ */
+ public Map dashboardInfo();
+
+ /**
+ * chart info
+ *
+ * @param startDate
+ * @param endDate
+ * @return
+ */
+ public ReturnT> chartInfo(Date startDate, Date endDate);
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/AdminBizImpl.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/AdminBizImpl.java
new file mode 100644
index 0000000..3c01e94
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/AdminBizImpl.java
@@ -0,0 +1,35 @@
+package com.xxl.job.admin.service.impl;
+
+import com.xxl.job.admin.core.thread.JobCompleteHelper;
+import com.xxl.job.admin.core.thread.JobRegistryHelper;
+import com.xxl.job.core.biz.AdminBiz;
+import com.xxl.job.core.biz.model.HandleCallbackParam;
+import com.xxl.job.core.biz.model.RegistryParam;
+import com.xxl.job.core.biz.model.ReturnT;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author xuxueli 2017-07-27 21:54:20
+ */
+@Service
+public class AdminBizImpl implements AdminBiz {
+
+
+ @Override
+ public ReturnT callback(List callbackParamList) {
+ return JobCompleteHelper.getInstance().callback(callbackParamList);
+ }
+
+ @Override
+ public ReturnT registry(RegistryParam registryParam) {
+ return JobRegistryHelper.getInstance().registry(registryParam);
+ }
+
+ @Override
+ public ReturnT registryRemove(RegistryParam registryParam) {
+ return JobRegistryHelper.getInstance().registryRemove(registryParam);
+ }
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/LoginService.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/LoginService.java
new file mode 100644
index 0000000..49d799b
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/LoginService.java
@@ -0,0 +1,111 @@
+package com.xxl.job.admin.service.impl;
+
+import com.xxl.job.admin.core.model.XxlJobUser;
+import com.xxl.job.admin.core.util.CookieUtil;
+import com.xxl.job.admin.core.util.I18nUtil;
+import com.xxl.job.admin.core.util.JacksonUtil;
+import com.xxl.job.admin.dao.XxlJobUserDao;
+import com.xxl.job.core.biz.model.ReturnT;
+import org.springframework.stereotype.Service;
+import org.springframework.util.DigestUtils;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.math.BigInteger;
+
+/**
+ * @author xuxueli 2019-05-04 22:13:264
+ */
+@Service
+public class LoginService {
+
+ public static final String LOGIN_IDENTITY_KEY = "XXL_JOB_LOGIN_IDENTITY";
+
+ @Resource
+ private XxlJobUserDao xxlJobUserDao;
+
+
+ // ---------------------- token tool ----------------------
+
+ private String makeToken(XxlJobUser xxlJobUser){
+ String tokenJson = JacksonUtil.writeValueAsString(xxlJobUser);
+ String tokenHex = new BigInteger(tokenJson.getBytes()).toString(16);
+ return tokenHex;
+ }
+ private XxlJobUser parseToken(String tokenHex){
+ XxlJobUser xxlJobUser = null;
+ if (tokenHex != null) {
+ String tokenJson = new String(new BigInteger(tokenHex, 16).toByteArray()); // username_password(md5)
+ xxlJobUser = JacksonUtil.readValue(tokenJson, XxlJobUser.class);
+ }
+ return xxlJobUser;
+ }
+
+
+ // ---------------------- login tool, with cookie and db ----------------------
+
+ public ReturnT login(HttpServletRequest request, HttpServletResponse response, String username, String password, boolean ifRemember){
+
+ // param
+ if (username==null || username.trim().length()==0 || password==null || password.trim().length()==0){
+ return new ReturnT(500, I18nUtil.getString("login_param_empty"));
+ }
+
+ // valid passowrd
+ XxlJobUser xxlJobUser = xxlJobUserDao.loadByUserName(username);
+ if (xxlJobUser == null) {
+ return new ReturnT(500, I18nUtil.getString("login_param_unvalid"));
+ }
+ String passwordMd5 = DigestUtils.md5DigestAsHex(password.getBytes());
+ if (!passwordMd5.equals(xxlJobUser.getPassword())) {
+ return new ReturnT(500, I18nUtil.getString("login_param_unvalid"));
+ }
+
+ String loginToken = makeToken(xxlJobUser);
+
+ // do login
+ CookieUtil.set(response, LOGIN_IDENTITY_KEY, loginToken, ifRemember);
+ return ReturnT.SUCCESS;
+ }
+
+ /**
+ * logout
+ *
+ * @param request
+ * @param response
+ */
+ public ReturnT logout(HttpServletRequest request, HttpServletResponse response){
+ CookieUtil.remove(request, response, LOGIN_IDENTITY_KEY);
+ return ReturnT.SUCCESS;
+ }
+
+ /**
+ * logout
+ *
+ * @param request
+ * @return
+ */
+ public XxlJobUser ifLogin(HttpServletRequest request, HttpServletResponse response){
+ String cookieToken = CookieUtil.getValue(request, LOGIN_IDENTITY_KEY);
+ if (cookieToken != null) {
+ XxlJobUser cookieUser = null;
+ try {
+ cookieUser = parseToken(cookieToken);
+ } catch (Exception e) {
+ logout(request, response);
+ }
+ if (cookieUser != null) {
+ XxlJobUser dbUser = xxlJobUserDao.loadByUserName(cookieUser.getUsername());
+ if (dbUser != null) {
+ if (cookieUser.getPassword().equals(dbUser.getPassword())) {
+ return dbUser;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+
+}
diff --git a/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java
new file mode 100644
index 0000000..2c1a0ac
--- /dev/null
+++ b/xxl-job/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java
@@ -0,0 +1,481 @@
+package com.xxl.job.admin.service.impl;
+
+import com.xxl.job.admin.core.cron.CronExpression;
+import com.xxl.job.admin.core.model.XxlJobGroup;
+import com.xxl.job.admin.core.model.XxlJobInfo;
+import com.xxl.job.admin.core.model.XxlJobLogReport;
+import com.xxl.job.admin.core.model.XxlJobUser;
+import com.xxl.job.admin.core.route.ExecutorRouteStrategyEnum;
+import com.xxl.job.admin.core.scheduler.MisfireStrategyEnum;
+import com.xxl.job.admin.core.scheduler.ScheduleTypeEnum;
+import com.xxl.job.admin.core.thread.JobScheduleHelper;
+import com.xxl.job.admin.core.thread.JobTriggerPoolHelper;
+import com.xxl.job.admin.core.trigger.TriggerTypeEnum;
+import com.xxl.job.admin.core.util.I18nUtil;
+import com.xxl.job.admin.dao.*;
+import com.xxl.job.admin.service.XxlJobService;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.enums.ExecutorBlockStrategyEnum;
+import com.xxl.job.core.glue.GlueTypeEnum;
+import com.xxl.job.core.util.DateUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.text.MessageFormat;
+import java.util.*;
+
+/**
+ * core job action for xxl-job
+ * @author xuxueli 2016-5-28 15:30:33
+ */
+@Service
+public class XxlJobServiceImpl implements XxlJobService {
+ private static Logger logger = LoggerFactory.getLogger(XxlJobServiceImpl.class);
+
+ @Resource
+ private XxlJobGroupDao xxlJobGroupDao;
+ @Resource
+ private XxlJobInfoDao xxlJobInfoDao;
+ @Resource
+ public XxlJobLogDao xxlJobLogDao;
+ @Resource
+ private XxlJobLogGlueDao xxlJobLogGlueDao;
+ @Resource
+ private XxlJobLogReportDao xxlJobLogReportDao;
+
+ @Override
+ public Map pageList(int start, int length, int jobGroup, int triggerStatus, String jobDesc, String executorHandler, String author) {
+
+ // page list
+ List list = xxlJobInfoDao.pageList(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
+ int list_count = xxlJobInfoDao.pageListCount(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
+
+ // package result
+ Map maps = new HashMap();
+ maps.put("recordsTotal", list_count); // 总记录数
+ maps.put("recordsFiltered", list_count); // 过滤后的总记录数
+ maps.put("data", list); // 分页列表
+ return maps;
+ }
+
+ @Override
+ public ReturnT add(XxlJobInfo jobInfo, XxlJobUser loginUser) {
+
+ // valid base
+ XxlJobGroup group = xxlJobGroupDao.load(jobInfo.getJobGroup());
+ if (group == null) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_choose")+I18nUtil.getString("jobinfo_field_jobgroup")) );
+ }
+ if (jobInfo.getJobDesc()==null || jobInfo.getJobDesc().trim().length()==0) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+I18nUtil.getString("jobinfo_field_jobdesc")) );
+ }
+ if (jobInfo.getAuthor()==null || jobInfo.getAuthor().trim().length()==0) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+I18nUtil.getString("jobinfo_field_author")) );
+ }
+
+ // valid trigger
+ ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(jobInfo.getScheduleType(), null);
+ if (scheduleTypeEnum == null) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
+ }
+ if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
+ if (jobInfo.getScheduleConf()==null || !CronExpression.isValidExpression(jobInfo.getScheduleConf())) {
+ return new ReturnT(ReturnT.FAIL_CODE, "Cron"+I18nUtil.getString("system_unvalid"));
+ }
+ } else if (scheduleTypeEnum == ScheduleTypeEnum.FIX_RATE/* || scheduleTypeEnum == ScheduleTypeEnum.FIX_DELAY*/) {
+ if (jobInfo.getScheduleConf() == null) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")) );
+ }
+ try {
+ int fixSecond = Integer.valueOf(jobInfo.getScheduleConf());
+ if (fixSecond < 1) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
+ }
+ } catch (Exception e) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
+ }
+ }
+
+ // valid job
+ if (GlueTypeEnum.match(jobInfo.getGlueType()) == null) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_gluetype")+I18nUtil.getString("system_unvalid")) );
+ }
+ if (GlueTypeEnum.BEAN==GlueTypeEnum.match(jobInfo.getGlueType()) && (jobInfo.getExecutorHandler()==null || jobInfo.getExecutorHandler().trim().length()==0) ) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+"JobHandler") );
+ }
+ // 》fix "\r" in shell
+ if (GlueTypeEnum.GLUE_SHELL==GlueTypeEnum.match(jobInfo.getGlueType()) && jobInfo.getGlueSource()!=null) {
+ jobInfo.setGlueSource(jobInfo.getGlueSource().replaceAll("\r", ""));
+ }
+
+ // valid advanced
+ if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy")+I18nUtil.getString("system_unvalid")) );
+ }
+ if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("misfire_strategy")+I18nUtil.getString("system_unvalid")) );
+ }
+ if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy")+I18nUtil.getString("system_unvalid")) );
+ }
+
+ // 》ChildJobId valid
+ if (jobInfo.getChildJobId()!=null && jobInfo.getChildJobId().trim().length()>0) {
+ String[] childJobIds = jobInfo.getChildJobId().split(",");
+ for (String childJobIdItem: childJobIds) {
+ if (childJobIdItem!=null && childJobIdItem.trim().length()>0 && isNumeric(childJobIdItem)) {
+ XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.parseInt(childJobIdItem));
+ if (childJobInfo==null) {
+ return new ReturnT(ReturnT.FAIL_CODE,
+ MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_not_found")), childJobIdItem));
+ }
+ if (!loginUser.validPermission(childJobInfo.getJobGroup())) {
+ return new ReturnT(ReturnT.FAIL_CODE,
+ MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_permission_limit")), childJobIdItem));
+ }
+ } else {
+ return new ReturnT(ReturnT.FAIL_CODE,
+ MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_unvalid")), childJobIdItem));
+ }
+ }
+
+ // join , avoid "xxx,,"
+ String temp = "";
+ for (String item:childJobIds) {
+ temp += item + ",";
+ }
+ temp = temp.substring(0, temp.length()-1);
+
+ jobInfo.setChildJobId(temp);
+ }
+
+ // add in db
+ jobInfo.setAddTime(new Date());
+ jobInfo.setUpdateTime(new Date());
+ jobInfo.setGlueUpdatetime(new Date());
+ xxlJobInfoDao.save(jobInfo);
+ if (jobInfo.getId() < 1) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_add")+I18nUtil.getString("system_fail")) );
+ }
+
+ return new ReturnT(String.valueOf(jobInfo.getId()));
+ }
+
+ private boolean isNumeric(String str){
+ try {
+ int result = Integer.valueOf(str);
+ return true;
+ } catch (NumberFormatException e) {
+ return false;
+ }
+ }
+
+ @Override
+ public ReturnT update(XxlJobInfo jobInfo, XxlJobUser loginUser) {
+
+ // valid base
+ if (jobInfo.getJobDesc()==null || jobInfo.getJobDesc().trim().length()==0) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+I18nUtil.getString("jobinfo_field_jobdesc")) );
+ }
+ if (jobInfo.getAuthor()==null || jobInfo.getAuthor().trim().length()==0) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("system_please_input")+I18nUtil.getString("jobinfo_field_author")) );
+ }
+
+ // valid trigger
+ ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(jobInfo.getScheduleType(), null);
+ if (scheduleTypeEnum == null) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
+ }
+ if (scheduleTypeEnum == ScheduleTypeEnum.CRON) {
+ if (jobInfo.getScheduleConf()==null || !CronExpression.isValidExpression(jobInfo.getScheduleConf())) {
+ return new ReturnT(ReturnT.FAIL_CODE, "Cron"+I18nUtil.getString("system_unvalid") );
+ }
+ } else if (scheduleTypeEnum == ScheduleTypeEnum.FIX_RATE /*|| scheduleTypeEnum == ScheduleTypeEnum.FIX_DELAY*/) {
+ if (jobInfo.getScheduleConf() == null) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
+ }
+ try {
+ int fixSecond = Integer.valueOf(jobInfo.getScheduleConf());
+ if (fixSecond < 1) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
+ }
+ } catch (Exception e) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
+ }
+ }
+
+ // valid advanced
+ if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorRouteStrategy")+I18nUtil.getString("system_unvalid")) );
+ }
+ if (MisfireStrategyEnum.match(jobInfo.getMisfireStrategy(), null) == null) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("misfire_strategy")+I18nUtil.getString("system_unvalid")) );
+ }
+ if (ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), null) == null) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_executorBlockStrategy")+I18nUtil.getString("system_unvalid")) );
+ }
+
+ // 》ChildJobId valid
+ if (jobInfo.getChildJobId()!=null && jobInfo.getChildJobId().trim().length()>0) {
+ String[] childJobIds = jobInfo.getChildJobId().split(",");
+ for (String childJobIdItem: childJobIds) {
+ if (childJobIdItem!=null && childJobIdItem.trim().length()>0 && isNumeric(childJobIdItem)) {
+ XxlJobInfo childJobInfo = xxlJobInfoDao.loadById(Integer.parseInt(childJobIdItem));
+ if (childJobInfo==null) {
+ return new ReturnT(ReturnT.FAIL_CODE,
+ MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_not_found")), childJobIdItem));
+ }
+ if (!loginUser.validPermission(childJobInfo.getJobGroup())) {
+ return new ReturnT(ReturnT.FAIL_CODE,
+ MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_permission_limit")), childJobIdItem));
+ }
+ } else {
+ return new ReturnT(ReturnT.FAIL_CODE,
+ MessageFormat.format((I18nUtil.getString("jobinfo_field_childJobId")+"({0})"+I18nUtil.getString("system_unvalid")), childJobIdItem));
+ }
+ }
+
+ // join , avoid "xxx,,"
+ String temp = "";
+ for (String item:childJobIds) {
+ temp += item + ",";
+ }
+ temp = temp.substring(0, temp.length()-1);
+
+ jobInfo.setChildJobId(temp);
+ }
+
+ // group valid
+ XxlJobGroup jobGroup = xxlJobGroupDao.load(jobInfo.getJobGroup());
+ if (jobGroup == null) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_jobgroup")+I18nUtil.getString("system_unvalid")) );
+ }
+
+ // stage job info
+ XxlJobInfo exists_jobInfo = xxlJobInfoDao.loadById(jobInfo.getId());
+ if (exists_jobInfo == null) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("jobinfo_field_id")+I18nUtil.getString("system_not_found")) );
+ }
+
+ // next trigger time (5s后生效,避开预读周期)
+ long nextTriggerTime = exists_jobInfo.getTriggerNextTime();
+ boolean scheduleDataNotChanged = jobInfo.getScheduleType().equals(exists_jobInfo.getScheduleType()) && jobInfo.getScheduleConf().equals(exists_jobInfo.getScheduleConf());
+ if (exists_jobInfo.getTriggerStatus() == 1 && !scheduleDataNotChanged) {
+ try {
+ Date nextValidTime = JobScheduleHelper.generateNextValidTime(jobInfo, new Date(System.currentTimeMillis() + JobScheduleHelper.PRE_READ_MS));
+ if (nextValidTime == null) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
+ }
+ nextTriggerTime = nextValidTime.getTime();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
+ }
+ }
+
+ exists_jobInfo.setJobGroup(jobInfo.getJobGroup());
+ exists_jobInfo.setJobDesc(jobInfo.getJobDesc());
+ exists_jobInfo.setAuthor(jobInfo.getAuthor());
+ exists_jobInfo.setAlarmEmail(jobInfo.getAlarmEmail());
+ exists_jobInfo.setScheduleType(jobInfo.getScheduleType());
+ exists_jobInfo.setScheduleConf(jobInfo.getScheduleConf());
+ exists_jobInfo.setMisfireStrategy(jobInfo.getMisfireStrategy());
+ exists_jobInfo.setExecutorRouteStrategy(jobInfo.getExecutorRouteStrategy());
+ exists_jobInfo.setExecutorHandler(jobInfo.getExecutorHandler());
+ exists_jobInfo.setExecutorParam(jobInfo.getExecutorParam());
+ exists_jobInfo.setExecutorBlockStrategy(jobInfo.getExecutorBlockStrategy());
+ exists_jobInfo.setExecutorTimeout(jobInfo.getExecutorTimeout());
+ exists_jobInfo.setExecutorFailRetryCount(jobInfo.getExecutorFailRetryCount());
+ exists_jobInfo.setChildJobId(jobInfo.getChildJobId());
+ exists_jobInfo.setTriggerNextTime(nextTriggerTime);
+
+ exists_jobInfo.setUpdateTime(new Date());
+ xxlJobInfoDao.update(exists_jobInfo);
+
+
+ return ReturnT.SUCCESS;
+ }
+
+ @Override
+ public ReturnT remove(int id) {
+ XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
+ if (xxlJobInfo == null) {
+ return ReturnT.SUCCESS;
+ }
+
+ xxlJobInfoDao.delete(id);
+ xxlJobLogDao.delete(id);
+ xxlJobLogGlueDao.deleteByJobId(id);
+ return ReturnT.SUCCESS;
+ }
+
+ @Override
+ public ReturnT start(int id) {
+ XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
+
+ // valid
+ ScheduleTypeEnum scheduleTypeEnum = ScheduleTypeEnum.match(xxlJobInfo.getScheduleType(), ScheduleTypeEnum.NONE);
+ if (ScheduleTypeEnum.NONE == scheduleTypeEnum) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type_none_limit_start")) );
+ }
+
+ // next trigger time (5s后生效,避开预读周期)
+ long nextTriggerTime = 0;
+ try {
+ Date nextValidTime = JobScheduleHelper.generateNextValidTime(xxlJobInfo, new Date(System.currentTimeMillis() + JobScheduleHelper.PRE_READ_MS));
+ if (nextValidTime == null) {
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
+ }
+ nextTriggerTime = nextValidTime.getTime();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ return new ReturnT(ReturnT.FAIL_CODE, (I18nUtil.getString("schedule_type")+I18nUtil.getString("system_unvalid")) );
+ }
+
+ xxlJobInfo.setTriggerStatus(1);
+ xxlJobInfo.setTriggerLastTime(0);
+ xxlJobInfo.setTriggerNextTime(nextTriggerTime);
+
+ xxlJobInfo.setUpdateTime(new Date());
+ xxlJobInfoDao.update(xxlJobInfo);
+ return ReturnT.SUCCESS;
+ }
+
+ @Override
+ public ReturnT stop(int id) {
+ XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
+
+ xxlJobInfo.setTriggerStatus(0);
+ xxlJobInfo.setTriggerLastTime(0);
+ xxlJobInfo.setTriggerNextTime(0);
+
+ xxlJobInfo.setUpdateTime(new Date());
+ xxlJobInfoDao.update(xxlJobInfo);
+ return ReturnT.SUCCESS;
+ }
+
+
+
+ @Override
+ public ReturnT trigger(XxlJobUser loginUser, int jobId, String executorParam, String addressList) {
+ // permission
+ if (loginUser == null) {
+ return new ReturnT(ReturnT.FAIL.getCode(), I18nUtil.getString("system_permission_limit"));
+ }
+ XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(jobId);
+ if (xxlJobInfo == null) {
+ return new ReturnT(ReturnT.FAIL.getCode(), I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
+ }
+ if (!hasPermission(loginUser, xxlJobInfo.getJobGroup())) {
+ return new ReturnT(ReturnT.FAIL.getCode(), I18nUtil.getString("system_permission_limit"));
+ }
+
+ // force cover job param
+ if (executorParam == null) {
+ executorParam = "";
+ }
+
+ JobTriggerPoolHelper.trigger(jobId, TriggerTypeEnum.MANUAL, -1, null, executorParam, addressList);
+ return ReturnT.SUCCESS;
+ }
+
+ private boolean hasPermission(XxlJobUser loginUser, int jobGroup){
+ if (loginUser.getRole() == 1) {
+ return true;
+ }
+ List groupIdStrs = new ArrayList<>();
+ if (loginUser.getPermission()!=null && loginUser.getPermission().trim().length()>0) {
+ groupIdStrs = Arrays.asList(loginUser.getPermission().trim().split(","));
+ }
+ return groupIdStrs.contains(String.valueOf(jobGroup));
+ }
+
+ @Override
+ public Map dashboardInfo() {
+
+ int jobInfoCount = xxlJobInfoDao.findAllCount();
+ int jobLogCount = 0;
+ int jobLogSuccessCount = 0;
+ XxlJobLogReport xxlJobLogReport = xxlJobLogReportDao.queryLogReportTotal();
+ if (xxlJobLogReport != null) {
+ jobLogCount = xxlJobLogReport.getRunningCount() + xxlJobLogReport.getSucCount() + xxlJobLogReport.getFailCount();
+ jobLogSuccessCount = xxlJobLogReport.getSucCount();
+ }
+
+ // executor count
+ Set executorAddressSet = new HashSet();
+ List groupList = xxlJobGroupDao.findAll();
+
+ if (groupList!=null && !groupList.isEmpty()) {
+ for (XxlJobGroup group: groupList) {
+ if (group.getRegistryList()!=null && !group.getRegistryList().isEmpty()) {
+ executorAddressSet.addAll(group.getRegistryList());
+ }
+ }
+ }
+
+ int executorCount = executorAddressSet.size();
+
+ Map dashboardMap = new HashMap();
+ dashboardMap.put("jobInfoCount", jobInfoCount);
+ dashboardMap.put("jobLogCount", jobLogCount);
+ dashboardMap.put("jobLogSuccessCount", jobLogSuccessCount);
+ dashboardMap.put("executorCount", executorCount);
+ return dashboardMap;
+ }
+
+ @Override
+ public ReturnT> chartInfo(Date startDate, Date endDate) {
+
+ // process
+ List triggerDayList = new ArrayList();
+ List triggerDayCountRunningList = new ArrayList();
+ List triggerDayCountSucList = new ArrayList();
+ List