You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/07/11 06:06:47 UTC

[GitHub] [shardingsphere-elasticjob] TeslaCN commented on a diff in pull request #2103: Support annotation job

TeslaCN commented on code in PR #2103:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/2103#discussion_r917565943


##########
elasticjob-lite/elasticjob-lite-spring/elasticjob-lite-spring-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/core/scanner/JobScannerConfiguration.java:
##########
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.lite.spring.core.scanner;
+
+import lombok.Getter;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
+import org.springframework.util.Assert;
+
+/**
+ * BeanDefinitionRegistryPostProcessor that searches recursively starting from a base package for interfaces.
+ *
+ */
+@Getter
+public class JobScannerConfiguration implements BeanDefinitionRegistryPostProcessor, InitializingBean {
+
+    private final String[] basePackages;
+
+    public JobScannerConfiguration(final String[] basePackages) {
+        this.basePackages = basePackages;
+    }
+
+    /**

Review Comment:
   Could we remove the inheritDoc?



##########
elasticjob-lite/elasticjob-lite-spring/elasticjob-lite-spring-namespace/src/main/resources/META-INF/namespace/elasticjob.xsd:
##########
@@ -21,76 +21,92 @@
             xmlns:beans="http://www.springframework.org/schema/beans"
             targetNamespace="http://shardingsphere.apache.org/schema/elasticjob"
             elementFormDefault="qualified">
-    <xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd" />
-    
+    <xsd:import namespace="http://www.springframework.org/schema/beans"
+                schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd"/>
+
+    <xsd:element name="job-scanner">
+        <xsd:complexType>
+            <xsd:complexContent>
+                <xsd:extension base="beans:identifiedType">
+<!--                    <xsd:attribute name="id" type="xsd:ID">-->
+<!--                        <xsd:annotation>-->
+<!--                            <xsd:documentation><![CDATA[ The unique identifier for a bean. ]]></xsd:documentation>-->
+<!--                        </xsd:annotation>-->
+<!--                    </xsd:attribute>-->
+                    <xsd:attribute name="base-package" type="xsd:string" use="required"/>
+                </xsd:extension>
+            </xsd:complexContent>
+        </xsd:complexType>
+    </xsd:element>
+
     <xsd:element name="job">
         <xsd:complexType>
             <xsd:complexContent>
                 <xsd:extension base="beans:identifiedType">
                     <xsd:all>
-                        <xsd:element ref="beans:props" minOccurs="0" />
+                        <xsd:element ref="beans:props" minOccurs="0"/>

Review Comment:
   Please keep the origin code style here and below.



##########
elasticjob-lite/elasticjob-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/annotation/JobAnnotationBuilder.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.lite.internal.annotation;
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+import java.util.Optional;
+import org.apache.shardingsphere.elasticjob.annotation.ElasticJobConfiguration;
+import org.apache.shardingsphere.elasticjob.annotation.ElasticJobProp;
+import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
+import org.apache.shardingsphere.elasticjob.api.JobExtraConfiguration;
+import org.apache.shardingsphere.elasticjob.api.JobExtraConfigurationFactory;
+import org.apache.shardingsphere.elasticjob.infra.exception.JobConfigurationException;
+
+public class JobAnnotationBuilder {
+    
+    /**
+     * generate JobConfiguration from @ElasticJobConfiguration.
+     * @param type The job of @ElasticJobConfiguration annotation class
+     * @return JobConfiguration
+     */
+    public static JobConfiguration generateJobConfiguration(final Class<?> type) {
+        ElasticJobConfiguration annotation = type.getAnnotation(ElasticJobConfiguration.class);
+        Preconditions.checkArgument(null != annotation, "@ElasticJobConfiguration not found by class '%s'.", type);
+        Preconditions.checkArgument(!Strings.isNullOrEmpty(annotation.jobName()), "@ElasticJobConfiguration jobName not be empty by class '%s'.", type);

Review Comment:
   Maybe `could not be empty`?



##########
elasticjob-lite/elasticjob-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/fixture/job/AnnotationUnShardingJob.java:
##########
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.lite.fixture.job;
+
+import lombok.Getter;
+import org.apache.shardingsphere.elasticjob.annotation.ElasticJobConfiguration;
+import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
+
+@Getter
+@ElasticJobConfiguration(
+    jobName = "AnnotationUnShardingJob",
+    description = "desc",
+    shardingTotalCount = 1
+)
+public class AnnotationUnShardingJob implements SimpleJob {

Review Comment:
   Please add final modifier.



##########
elasticjob-api/src/test/java/org/apache/shardingsphere/elasticjob/annotation/job/impl/SimpleTestJob.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.annotation.job.impl;
+
+import org.apache.shardingsphere.elasticjob.annotation.ElasticJobConfiguration;
+import org.apache.shardingsphere.elasticjob.annotation.ElasticJobProp;
+import org.apache.shardingsphere.elasticjob.annotation.SimpleTracingConfigurationFactory;
+import org.apache.shardingsphere.elasticjob.annotation.job.CustomJob;
+import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+
+@ElasticJobConfiguration(
+    cron = "0/5 * * * * ?",
+    jobName = "SimpleTestJob",
+    shardingTotalCount = 3,
+    shardingItemParameters = "0=Beijing,1=Shanghai,2=Guangzhou",
+    jobListenerTypes = {"NOOP", "LOG"},
+    extraConfigurations = {SimpleTracingConfigurationFactory.class},
+    props = {
+        @ElasticJobProp(key = "print.title", value = "test title"),
+        @ElasticJobProp(key = "print.content", value = "test content")
+    }
+)
+public class SimpleTestJob implements CustomJob {

Review Comment:
   Please add final modifier.



##########
elasticjob-lite/elasticjob-lite-spring/elasticjob-lite-spring-namespace/src/main/resources/META-INF/namespace/elasticjob.xsd:
##########
@@ -21,76 +21,92 @@
             xmlns:beans="http://www.springframework.org/schema/beans"
             targetNamespace="http://shardingsphere.apache.org/schema/elasticjob"
             elementFormDefault="qualified">
-    <xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd" />
-    
+    <xsd:import namespace="http://www.springframework.org/schema/beans"
+                schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd"/>
+
+    <xsd:element name="job-scanner">
+        <xsd:complexType>
+            <xsd:complexContent>
+                <xsd:extension base="beans:identifiedType">
+<!--                    <xsd:attribute name="id" type="xsd:ID">-->
+<!--                        <xsd:annotation>-->
+<!--                            <xsd:documentation><![CDATA[ The unique identifier for a bean. ]]></xsd:documentation>-->
+<!--                        </xsd:annotation>-->
+<!--                    </xsd:attribute>-->

Review Comment:
   What's this for?



##########
elasticjob-lite/elasticjob-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/annotation/JobAnnotationBuilder.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.lite.internal.annotation;
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+import java.util.Optional;
+import org.apache.shardingsphere.elasticjob.annotation.ElasticJobConfiguration;
+import org.apache.shardingsphere.elasticjob.annotation.ElasticJobProp;
+import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
+import org.apache.shardingsphere.elasticjob.api.JobExtraConfiguration;
+import org.apache.shardingsphere.elasticjob.api.JobExtraConfigurationFactory;
+import org.apache.shardingsphere.elasticjob.infra.exception.JobConfigurationException;
+
+public class JobAnnotationBuilder {

Review Comment:
   Please add final modifier and javadoc.



##########
elasticjob-api/src/main/java/org/apache/shardingsphere/elasticjob/annotation/ElasticJobConfiguration.java:
##########
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.shardingsphere.elasticjob.api.JobExtraConfigurationFactory;
+
+/**
+ * The annotation that specify a job of elastic.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface ElasticJobConfiguration {
+    
+    /**
+     * Job name.
+     * @return jobName
+     */
+    String jobName();
+    
+    /**
+     * CRON expression, control the job trigger time.
+     * @return cron
+     */
+    String cron() default "";
+    
+    /**
+     * Time zone of CRON.
+     * @return timeZone
+     */
+    String timeZone() default "";
+

Review Comment:
   Please remove the duplicate blank line.



##########
elasticjob-lite/elasticjob-lite-spring/elasticjob-lite-spring-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/core/scanner/ClassPathJobScanner.java:
##########
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.lite.spring.core.scanner;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shardingsphere.elasticjob.annotation.ElasticJobConfiguration;
+import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap;
+import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
+import org.springframework.beans.factory.config.BeanDefinitionHolder;
+import org.springframework.beans.factory.config.RuntimeBeanReference;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
+import org.springframework.context.annotation.ScannedGenericBeanDefinition;
+import org.springframework.core.type.filter.AnnotationTypeFilter;
+
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * A {@link ClassPathBeanDefinitionScanner} that registers ScheduleJobBootstrap by {@code basePackage}.
+ *
+ * @see ScheduleJobBootstrap
+ */
+public class ClassPathJobScanner extends ClassPathBeanDefinitionScanner {
+
+    public ClassPathJobScanner(final BeanDefinitionRegistry registry) {
+        super(registry, false);
+    }
+
+    /**
+     * Calls the parent search that will search and register all the candidates by {@code ElasticJobConfiguration}.
+     *
+     * @param basePackages the packages to check for annotated classes
+     */
+    @Override
+    protected Set<BeanDefinitionHolder> doScan(final String... basePackages) {
+        addIncludeFilter(new AnnotationTypeFilter(ElasticJobConfiguration.class));
+

Review Comment:
   Please remove redundant blank lines here and below.



##########
elasticjob-lite/elasticjob-lite-spring/elasticjob-lite-spring-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/core/scanner/ElasticJobScanRegistrar.java:
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.lite.spring.core.scanner;
+
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.context.ResourceLoaderAware;
+import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
+import org.springframework.core.annotation.AnnotationAttributes;
+import org.springframework.core.io.ResourceLoader;
+import org.springframework.core.type.AnnotationMetadata;
+import org.springframework.util.StringUtils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * A {@link ImportBeanDefinitionRegistrar} to allow annotation configuration of Elastic Job scanning.
+ *
+ * @see ClassPathJobScanner
+ */
+public class ElasticJobScanRegistrar implements ImportBeanDefinitionRegistrar, ResourceLoaderAware {
+
+    /**
+     * set resourceLoader.
+     * @param resourceLoader resourceLoader
+     *
+     * @deprecated  NOP
+     */
+    @Override
+    @Deprecated
+    public void setResourceLoader(final ResourceLoader resourceLoader) {
+        // NOP
+    }
+
+    @Override
+    public void registerBeanDefinitions(final AnnotationMetadata importingClassMetadata,
+                                        final BeanDefinitionRegistry registry) {
+        AnnotationAttributes elasticJobScanAttrs =
+                AnnotationAttributes.fromMap(importingClassMetadata.getAnnotationAttributes(ElasticJobScan.class.getName()));
+        if (elasticJobScanAttrs != null) {
+            registerBeanDefinitions(importingClassMetadata, elasticJobScanAttrs, registry);
+        }
+    }
+
+    private void registerBeanDefinitions(final AnnotationMetadata annoMeta, final AnnotationAttributes annoAttrs,
+            final BeanDefinitionRegistry registry) {
+

Review Comment:
   Please remove redundant blank lines.



##########
elasticjob-api/src/main/java/org/apache/shardingsphere/elasticjob/annotation/ElasticJobConfiguration.java:
##########
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.shardingsphere.elasticjob.api.JobExtraConfigurationFactory;
+
+/**
+ * The annotation that specify a job of elastic.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface ElasticJobConfiguration {
+    
+    /**
+     * Job name.
+     * @return jobName
+     */
+    String jobName();
+    
+    /**
+     * CRON expression, control the job trigger time.
+     * @return cron
+     */
+    String cron() default "";
+    
+    /**
+     * Time zone of CRON.
+     * @return timeZone
+     */
+    String timeZone() default "";
+
+
+    /**
+     * registry center name.
+     * @return registryCenter
+     */
+    String registryCenter() default "";
+
+    /**
+     * Sharding total count.
+     * @return shardingTotalCount
+     */
+    int shardingTotalCount();
+    
+    /**
+     * Sharding item parameters.
+     * @return shardingItemParameters
+     */
+    String shardingItemParameters() default "";
+    
+    /**
+     * Job parameter.
+     * @return jobParameter
+     */
+    String jobParameter() default "";
+    
+    /**
+     * Monitor job execution status.
+     * @return monitorExecution
+     */
+    boolean monitorExecution() default true;
+    
+    /**
+     * Enable or disable job failover.
+     * @return failover
+     */
+    boolean failover() default false;
+    
+    /**
+     * Enable or disable the missed task to re-execute.
+     * @return misfire
+     */
+    boolean misfire() default true;
+    
+    /**
+     * The maximum value for time difference between server and registry center in seconds.
+     * @return maxTimeDiffSeconds
+     */
+    int maxTimeDiffSeconds() default -1;
+    
+    /**
+     * Service scheduling interval in minutes for repairing job server inconsistent state.
+     * @return reconcileIntervalMinutes
+     */
+    int reconcileIntervalMinutes() default 10;
+    
+    /**
+     * Job sharding strategy type.
+     * @return jobShardingStrategyType
+     */
+    String jobShardingStrategyType() default "";
+    
+    /**
+     * Job thread pool handler type.
+     * @return jobExecutorServiceHandlerType
+     */
+    String jobExecutorServiceHandlerType() default "";
+    
+    /**
+     * Job thread pool handler type.
+     * @return jobErrorHandlerType
+     */
+    String jobErrorHandlerType() default "";
+    
+    /**
+     * Job listener types.
+     * @return jobListenerTypes
+     */
+    String[] jobListenerTypes() default {};
+    
+    /**
+     * extra configurations.
+     * @return extraConfigurations
+     */
+    Class<? extends JobExtraConfigurationFactory>[] extraConfigurations() default {};
+    
+    /**
+     * Job description.
+     * @return description
+     */
+    String description() default "";
+    
+    /**
+     * Job properties.
+     * @return props
+     */
+    ElasticJobProp[] props() default {};
+    
+    /**
+     * Enable or disable start the job.
+     * @return disabled
+     */
+    boolean disabled() default false;
+    
+    /**
+     * Enable or disable local configuration override registry center configuration.
+     * @return overwrite
+     */
+    boolean overwrite() default false;
+    

Review Comment:
   Please remove the duplicate blank line.



##########
elasticjob-lite/elasticjob-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/fixture/job/AnnotationSimpleJob.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.lite.fixture.job;
+
+import lombok.Getter;
+import org.apache.shardingsphere.elasticjob.annotation.ElasticJobConfiguration;
+import org.apache.shardingsphere.elasticjob.annotation.ElasticJobProp;
+import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
+
+@Getter
+@ElasticJobConfiguration(
+    jobName = "AnnotationSimpleJob",
+    description = "desc",
+    shardingTotalCount = 3,
+    shardingItemParameters = "0=a,1=b,2=c",
+    cron = "*/10 * * * * ?",
+    props = {
+        @ElasticJobProp(key = "print.title", value = "test title"),
+        @ElasticJobProp(key = "print.content", value = "test content")
+    }
+)
+public class AnnotationSimpleJob implements SimpleJob {

Review Comment:
   Please add final modifier.



##########
elasticjob-api/src/test/java/org/apache/shardingsphere/elasticjob/annotation/ElasticJobConfigurationTest.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.annotation;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertThat;
+
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.Queue;
+import org.apache.shardingsphere.elasticjob.annotation.job.impl.SimpleTestJob;
+import org.apache.shardingsphere.elasticjob.api.JobExtraConfigurationFactory;
+import org.junit.Test;
+
+public class ElasticJobConfigurationTest {

Review Comment:
   Please add final modifier.



##########
elasticjob-api/src/test/java/org/apache/shardingsphere/elasticjob/annotation/SimpleTracingConfigurationFactory.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.annotation;
+
+import java.util.Optional;
+import org.apache.shardingsphere.elasticjob.api.JobExtraConfiguration;
+import org.apache.shardingsphere.elasticjob.api.JobExtraConfigurationFactory;
+
+public class SimpleTracingConfigurationFactory implements JobExtraConfigurationFactory {

Review Comment:
   Please add final modifier.



##########
elasticjob-api/src/test/java/org/apache/shardingsphere/elasticjob/annotation/job/impl/SimpleTestJob.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.annotation.job.impl;
+
+import org.apache.shardingsphere.elasticjob.annotation.ElasticJobConfiguration;
+import org.apache.shardingsphere.elasticjob.annotation.ElasticJobProp;
+import org.apache.shardingsphere.elasticjob.annotation.SimpleTracingConfigurationFactory;
+import org.apache.shardingsphere.elasticjob.annotation.job.CustomJob;
+import org.apache.shardingsphere.elasticjob.api.ShardingContext;
+
+@ElasticJobConfiguration(
+    cron = "0/5 * * * * ?",
+    jobName = "SimpleTestJob",
+    shardingTotalCount = 3,
+    shardingItemParameters = "0=Beijing,1=Shanghai,2=Guangzhou",
+    jobListenerTypes = {"NOOP", "LOG"},
+    extraConfigurations = {SimpleTracingConfigurationFactory.class},
+    props = {
+        @ElasticJobProp(key = "print.title", value = "test title"),
+        @ElasticJobProp(key = "print.content", value = "test content")
+    }
+)
+public class SimpleTestJob implements CustomJob {
+    
+    @Override
+    public void execute(final ShardingContext shardingContext) {
+    }
+    

Review Comment:
   Please remove the redundant blank line.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org