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 2021/09/14 11:32:01 UTC

[GitHub] [shardingsphere-elasticjob] sunkai-cai opened a new pull request #1980: Support annotation job java

sunkai-cai opened a new pull request #1980:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1980


   Fixes #1445.
   
   Part one.
   
   Changes proposed in this pull request:
   - add annotation interface `@ElasticJobConfiguration`
   - add JobAnnotationBuilder
   - `ScheduleJobBootstrap` and `OneOffJobBootstrap` support annotation job
   
   //Java example:
   
   ```
   @ElasticJobConfiguration(
           cron = "0/5 * * * * ?",
           jobName = "SimpleTestJobFirst",
           shardingTotalCount = 3,
           shardingItemParameters = "0=Beijing,1=Shanghai,2=Guangzhou",
           jobListenerTypes = {"NOOP", "LOG"},
           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) {
       }
       
   }
   ```
   
   ```
   public final class JavaMain {
       .....
       public static void main(final String[] args) throws IOException {
           CoordinatorRegistryCenter regCenter = setUpRegistryCenter();
           (new ScheduleJobBootstrap(regCenter,new SimpleTestJob())).schedule();
       }
       .....
   }
   ```
   


-- 
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



[GitHub] [shardingsphere-elasticjob] sunkai-cai commented on pull request #1980: Support annotation job java

Posted by GitBox <gi...@apache.org>.
sunkai-cai commented on pull request #1980:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1980#issuecomment-927503490


   remove to `feature-annotation`


-- 
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



[GitHub] [shardingsphere-elasticjob] codecov-commenter commented on pull request #1980: Support annotation job java

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #1980:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1980#issuecomment-921470208


   # [Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1980](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (1c01819) into [master](https://codecov.io/gh/apache/shardingsphere-elasticjob/commit/879b6f414f36a656cdc4ca0c3396f58fba3bb38b?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (879b6f4) will **decrease** coverage by `0.15%`.
   > The diff coverage is `66.66%`.
   
   > :exclamation: Current head 1c01819 differs from pull request most recent head fe99223. Consider uploading reports for the commit fe99223 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/graphs/tree.svg?width=650&height=150&src=pr&token=8ZMVc4Yo4Z&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #1980      +/-   ##
   ============================================
   - Coverage     85.70%   85.54%   -0.16%     
   - Complexity     1875     1879       +4     
   ============================================
     Files           278      278              
     Lines          6063     6019      -44     
     Branches        729      672      -57     
   ============================================
   - Hits           5196     5149      -47     
   - Misses          535      559      +24     
   + Partials        332      311      -21     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...lite/internal/annotation/JobAnnotationBuilder.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1saXRlL2VsYXN0aWNqb2ItbGl0ZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2xpdGUvaW50ZXJuYWwvYW5ub3RhdGlvbi9Kb2JBbm5vdGF0aW9uQnVpbGRlci5qYXZh) | `56.66% <56.66%> (ø)` | |
   | [...ob/lite/api/bootstrap/impl/OneOffJobBootstrap.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1saXRlL2VsYXN0aWNqb2ItbGl0ZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2xpdGUvYXBpL2Jvb3RzdHJhcC9pbXBsL09uZU9mZkpvYkJvb3RzdHJhcC5qYXZh) | `73.68% <100.00%> (+9.39%)` | :arrow_up: |
   | [.../lite/api/bootstrap/impl/ScheduleJobBootstrap.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1saXRlL2VsYXN0aWNqb2ItbGl0ZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2xpdGUvYXBpL2Jvb3RzdHJhcC9pbXBsL1NjaGVkdWxlSm9iQm9vdHN0cmFwLmphdmE=) | `73.33% <100.00%> (+9.69%)` | :arrow_up: |
   | [...te/internal/setup/JobClassNameProviderFactory.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1saXRlL2VsYXN0aWNqb2ItbGl0ZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2xpdGUvaW50ZXJuYWwvc2V0dXAvSm9iQ2xhc3NOYW1lUHJvdmlkZXJGYWN0b3J5LmphdmE=) | `42.85% <0.00%> (-14.29%)` | :arrow_down: |
   | [...ob/restful/pipeline/FilterChainInboundHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1pbmZyYS9lbGFzdGljam9iLXJlc3RmdWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2VsYXN0aWNqb2IvcmVzdGZ1bC9waXBlbGluZS9GaWx0ZXJDaGFpbkluYm91bmRIYW5kbGVyLmphdmE=) | `75.00% <0.00%> (-12.50%)` | :arrow_down: |
   | [...ticjob/cloud/executor/local/LocalTaskExecutor.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1jbG91ZC9lbGFzdGljam9iLWNsb3VkLWV4ZWN1dG9yL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2Nsb3VkL2V4ZWN1dG9yL2xvY2FsL0xvY2FsVGFza0V4ZWN1dG9yLmphdmE=) | `90.90% <0.00%> (-9.10%)` | :arrow_down: |
   | [...sphere/elasticjob/executor/ElasticJobExecutor.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1lY29zeXN0ZW0vZWxhc3RpY2pvYi1leGVjdXRvci9lbGFzdGljam9iLWV4ZWN1dG9yLWtlcm5lbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9leGVjdXRvci9FbGFzdGljSm9iRXhlY3V0b3IuamF2YQ==) | `86.66% <0.00%> (-4.64%)` | :arrow_down: |
   | [...l/deserializer/RequestBodyDeserializerFactory.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1pbmZyYS9lbGFzdGljam9iLXJlc3RmdWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2VsYXN0aWNqb2IvcmVzdGZ1bC9kZXNlcmlhbGl6ZXIvUmVxdWVzdEJvZHlEZXNlcmlhbGl6ZXJGYWN0b3J5LmphdmE=) | `76.92% <0.00%> (-3.85%)` | :arrow_down: |
   | [...asticjob/lite/internal/storage/JobNodeStorage.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1saXRlL2VsYXN0aWNqb2ItbGl0ZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2xpdGUvaW50ZXJuYWwvc3RvcmFnZS9Kb2JOb2RlU3RvcmFnZS5qYXZh) | `89.28% <0.00%> (-3.58%)` | :arrow_down: |
   | [...ener/AbstractDistributeOnceElasticJobListener.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1saXRlL2VsYXN0aWNqb2ItbGl0ZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2xpdGUvYXBpL2xpc3RlbmVyL0Fic3RyYWN0RGlzdHJpYnV0ZU9uY2VFbGFzdGljSm9iTGlzdGVuZXIuamF2YQ==) | `79.31% <0.00%> (-3.45%)` | :arrow_down: |
   | ... and [45 more](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [879b6f4...fe99223](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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



[GitHub] [shardingsphere-elasticjob] sunkai-cai closed pull request #1980: Support annotation job java

Posted by GitBox <gi...@apache.org>.
sunkai-cai closed pull request #1980:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1980


   


-- 
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



[GitHub] [shardingsphere-elasticjob] TeslaCN commented on a change in pull request #1980: Support annotation job java

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on a change in pull request #1980:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1980#discussion_r710263507



##########
File path: elasticjob-api/src/main/java/org/apache/shardingsphere/elasticjob/api/JobExtraConfigurationFactory.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.api;
+
+/**
+ * Job extra configuration factory.
+ */
+public interface JobExtraConfigurationFactory {
+    
+    /**
+     * get JobExtraConfiguration.

Review comment:
       The first letter should be uppercase.

##########
File path: elasticjob-lite/elasticjob-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/annotation/JobAnnotationBuilder.java
##########
@@ -0,0 +1,72 @@
+/*
+ * 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 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.JobAnnotationException;
+
+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);
+        JobConfiguration.Builder jobConfigurationBuilder = JobConfiguration.newBuilder(annotation.jobName(), annotation.shardingTotalCount())
+                .shardingItemParameters(annotation.shardingItemParameters())
+                .cron(Strings.isNullOrEmpty(annotation.cron()) ? null : annotation.cron())
+                .timeZone(Strings.isNullOrEmpty(annotation.timeZone()) ? null : annotation.timeZone())
+                .jobParameter(annotation.jobParameter())
+                .monitorExecution(annotation.monitorExecution())
+                .failover(annotation.failover())
+                .misfire(annotation.misfire())
+                .maxTimeDiffSeconds(annotation.maxTimeDiffSeconds())
+                .reconcileIntervalMinutes(annotation.reconcileIntervalMinutes())
+                .jobShardingStrategyType(annotation.jobShardingStrategyType())
+                .jobExecutorServiceHandlerType(annotation.jobExecutorServiceHandlerType())
+                .jobErrorHandlerType(Strings.isNullOrEmpty(annotation.jobErrorHandlerType()) ? null : annotation.jobErrorHandlerType())
+                .jobListenerTypes(annotation.jobListenerTypes())
+                .description(annotation.description())
+                .disabled(annotation.disabled())
+                .overwrite(annotation.overwrite());
+        for (Class<? extends JobExtraConfigurationFactory> clazz : annotation.extraConfigurations()) {
+            try {
+                JobExtraConfiguration jobExtraConfiguration = clazz.newInstance().getJobExtraConfiguration();

Review comment:
       I prefer doing a null check here. What do you think? 

##########
File path: elasticjob-lite/elasticjob-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/annotation/JobAnnotationBuilder.java
##########
@@ -0,0 +1,72 @@
+/*
+ * 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 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.JobAnnotationException;
+
+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);
+        JobConfiguration.Builder jobConfigurationBuilder = JobConfiguration.newBuilder(annotation.jobName(), annotation.shardingTotalCount())
+                .shardingItemParameters(annotation.shardingItemParameters())
+                .cron(Strings.isNullOrEmpty(annotation.cron()) ? null : annotation.cron())
+                .timeZone(Strings.isNullOrEmpty(annotation.timeZone()) ? null : annotation.timeZone())
+                .jobParameter(annotation.jobParameter())
+                .monitorExecution(annotation.monitorExecution())
+                .failover(annotation.failover())
+                .misfire(annotation.misfire())
+                .maxTimeDiffSeconds(annotation.maxTimeDiffSeconds())
+                .reconcileIntervalMinutes(annotation.reconcileIntervalMinutes())
+                .jobShardingStrategyType(annotation.jobShardingStrategyType())
+                .jobExecutorServiceHandlerType(annotation.jobExecutorServiceHandlerType())
+                .jobErrorHandlerType(Strings.isNullOrEmpty(annotation.jobErrorHandlerType()) ? null : annotation.jobErrorHandlerType())
+                .jobListenerTypes(annotation.jobListenerTypes())
+                .description(annotation.description())
+                .disabled(annotation.disabled())
+                .overwrite(annotation.overwrite());
+        for (Class<? extends JobExtraConfigurationFactory> clazz : annotation.extraConfigurations()) {
+            try {
+                JobExtraConfiguration jobExtraConfiguration = clazz.newInstance().getJobExtraConfiguration();
+                jobConfigurationBuilder.addExtraConfigurations(jobExtraConfiguration);
+            } catch (IllegalAccessException | InstantiationException exception) {
+                throw (JobAnnotationException) new JobAnnotationException("new JobExtraConfigurationFactory instance by class '%s' failure", clazz).initCause(exception);
+            }
+        }
+        for (ElasticJobProp prop :annotation.props()) {
+            jobConfigurationBuilder.setProperty(prop.key(), prop.value());
+        }
+    

Review comment:
       Remove the redundant blank line.

##########
File path: elasticjob-api/src/test/java/org/apache/shardingsphere/elasticjob/annotation/ElasticJobConfigurationTest.java
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
+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 {
+    
+    @Test
+    public void assertAnnotationJob() {
+        ElasticJobConfiguration annotation = SimpleTestJob.class.getAnnotation(ElasticJobConfiguration.class);
+        assertEquals(annotation.jobName(), "SimpleTestJob");

Review comment:
       Use `assertThat` instead of `assertEquals`.

##########
File path: elasticjob-api/src/main/java/org/apache/shardingsphere/elasticjob/annotation/ElasticJobConfiguration.java
##########
@@ -0,0 +1,155 @@
+/*
+ * 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 jo of elastic.

Review comment:
       A typo here.

##########
File path: elasticjob-api/src/main/java/org/apache/shardingsphere/elasticjob/annotation/ElasticJobConfiguration.java
##########
@@ -0,0 +1,155 @@
+/*
+ * 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 jo 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 "";
+    
+    /**
+     * 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 "AVG_ALLOCATION";

Review comment:
       It's better to keep the default value same as JobConfiguration.

##########
File path: elasticjob-api/src/main/java/org/apache/shardingsphere/elasticjob/annotation/ElasticJobConfiguration.java
##########
@@ -0,0 +1,155 @@
+/*
+ * 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 jo 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 "";
+    
+    /**
+     * 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 "AVG_ALLOCATION";
+    
+    /**
+     * Job thread pool handler type.
+     * @return jobExecutorServiceHandlerType
+     */
+    String jobExecutorServiceHandlerType() default "CPU";

Review comment:
       It's better to keep the default value same as JobConfiguration.




-- 
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



[GitHub] [shardingsphere-elasticjob] TeslaCN commented on pull request #1980: Support annotation job java

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on pull request #1980:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1980#issuecomment-921060710


   Hi @sunkai-cai 
   Thanks for your contribution!


-- 
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



[GitHub] [shardingsphere-elasticjob] codecov-commenter edited a comment on pull request #1980: Support annotation job java

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1980:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1980#issuecomment-921470208


   # [Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1980](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (764db58) into [master](https://codecov.io/gh/apache/shardingsphere-elasticjob/commit/879b6f414f36a656cdc4ca0c3396f58fba3bb38b?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (879b6f4) will **decrease** coverage by `0.17%`.
   > The diff coverage is `66.66%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/graphs/tree.svg?width=650&height=150&src=pr&token=8ZMVc4Yo4Z&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #1980      +/-   ##
   ============================================
   - Coverage     85.70%   85.52%   -0.18%     
   - Complexity     1875     1879       +4     
   ============================================
     Files           278      278              
     Lines          6063     6019      -44     
     Branches        729      672      -57     
   ============================================
   - Hits           5196     5148      -48     
   - Misses          535      559      +24     
   + Partials        332      312      -20     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...lite/internal/annotation/JobAnnotationBuilder.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1saXRlL2VsYXN0aWNqb2ItbGl0ZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2xpdGUvaW50ZXJuYWwvYW5ub3RhdGlvbi9Kb2JBbm5vdGF0aW9uQnVpbGRlci5qYXZh) | `56.66% <56.66%> (ø)` | |
   | [...ob/lite/api/bootstrap/impl/OneOffJobBootstrap.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1saXRlL2VsYXN0aWNqb2ItbGl0ZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2xpdGUvYXBpL2Jvb3RzdHJhcC9pbXBsL09uZU9mZkpvYkJvb3RzdHJhcC5qYXZh) | `73.68% <100.00%> (+9.39%)` | :arrow_up: |
   | [.../lite/api/bootstrap/impl/ScheduleJobBootstrap.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1saXRlL2VsYXN0aWNqb2ItbGl0ZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2xpdGUvYXBpL2Jvb3RzdHJhcC9pbXBsL1NjaGVkdWxlSm9iQm9vdHN0cmFwLmphdmE=) | `73.33% <100.00%> (+9.69%)` | :arrow_up: |
   | [...te/internal/setup/JobClassNameProviderFactory.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1saXRlL2VsYXN0aWNqb2ItbGl0ZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2xpdGUvaW50ZXJuYWwvc2V0dXAvSm9iQ2xhc3NOYW1lUHJvdmlkZXJGYWN0b3J5LmphdmE=) | `42.85% <0.00%> (-14.29%)` | :arrow_down: |
   | [...ob/restful/pipeline/FilterChainInboundHandler.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1pbmZyYS9lbGFzdGljam9iLXJlc3RmdWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2VsYXN0aWNqb2IvcmVzdGZ1bC9waXBlbGluZS9GaWx0ZXJDaGFpbkluYm91bmRIYW5kbGVyLmphdmE=) | `75.00% <0.00%> (-12.50%)` | :arrow_down: |
   | [...ticjob/cloud/executor/local/LocalTaskExecutor.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1jbG91ZC9lbGFzdGljam9iLWNsb3VkLWV4ZWN1dG9yL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2Nsb3VkL2V4ZWN1dG9yL2xvY2FsL0xvY2FsVGFza0V4ZWN1dG9yLmphdmE=) | `90.90% <0.00%> (-9.10%)` | :arrow_down: |
   | [...sphere/elasticjob/executor/ElasticJobExecutor.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1lY29zeXN0ZW0vZWxhc3RpY2pvYi1leGVjdXRvci9lbGFzdGljam9iLWV4ZWN1dG9yLWtlcm5lbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9leGVjdXRvci9FbGFzdGljSm9iRXhlY3V0b3IuamF2YQ==) | `86.66% <0.00%> (-4.64%)` | :arrow_down: |
   | [...ite/internal/election/ElectionListenerManager.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1saXRlL2VsYXN0aWNqb2ItbGl0ZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2xpdGUvaW50ZXJuYWwvZWxlY3Rpb24vRWxlY3Rpb25MaXN0ZW5lck1hbmFnZXIuamF2YQ==) | `91.66% <0.00%> (-4.34%)` | :arrow_down: |
   | [...l/deserializer/RequestBodyDeserializerFactory.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1pbmZyYS9lbGFzdGljam9iLXJlc3RmdWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2VsYXN0aWNqb2IvcmVzdGZ1bC9kZXNlcmlhbGl6ZXIvUmVxdWVzdEJvZHlEZXNlcmlhbGl6ZXJGYWN0b3J5LmphdmE=) | `76.92% <0.00%> (-3.85%)` | :arrow_down: |
   | [...asticjob/lite/internal/storage/JobNodeStorage.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1saXRlL2VsYXN0aWNqb2ItbGl0ZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2xpdGUvaW50ZXJuYWwvc3RvcmFnZS9Kb2JOb2RlU3RvcmFnZS5qYXZh) | `89.28% <0.00%> (-3.58%)` | :arrow_down: |
   | ... and [45 more](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [879b6f4...764db58](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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



[GitHub] [shardingsphere-elasticjob] codecov-commenter edited a comment on pull request #1980: Support annotation job java

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1980:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1980#issuecomment-921470208


   # [Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#1980](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (764db58) into [master](https://codecov.io/gh/apache/shardingsphere-elasticjob/commit/879b6f414f36a656cdc4ca0c3396f58fba3bb38b?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (879b6f4) will **decrease** coverage by `0.13%`.
   > The diff coverage is `66.66%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/graphs/tree.svg?width=650&height=150&src=pr&token=8ZMVc4Yo4Z&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #1980      +/-   ##
   ============================================
   - Coverage     85.70%   85.56%   -0.14%     
   - Complexity     1875     1879       +4     
   ============================================
     Files           278      279       +1     
     Lines          6063     6102      +39     
     Branches        729      738       +9     
   ============================================
   + Hits           5196     5221      +25     
   - Misses          535      543       +8     
   - Partials        332      338       +6     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...lite/internal/annotation/JobAnnotationBuilder.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1saXRlL2VsYXN0aWNqb2ItbGl0ZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2xpdGUvaW50ZXJuYWwvYW5ub3RhdGlvbi9Kb2JBbm5vdGF0aW9uQnVpbGRlci5qYXZh) | `56.66% <56.66%> (ø)` | |
   | [...ob/lite/api/bootstrap/impl/OneOffJobBootstrap.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1saXRlL2VsYXN0aWNqb2ItbGl0ZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2xpdGUvYXBpL2Jvb3RzdHJhcC9pbXBsL09uZU9mZkpvYkJvb3RzdHJhcC5qYXZh) | `73.68% <100.00%> (+9.39%)` | :arrow_up: |
   | [.../lite/api/bootstrap/impl/ScheduleJobBootstrap.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1saXRlL2VsYXN0aWNqb2ItbGl0ZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2xpdGUvYXBpL2Jvb3RzdHJhcC9pbXBsL1NjaGVkdWxlSm9iQm9vdHN0cmFwLmphdmE=) | `73.33% <100.00%> (+9.69%)` | :arrow_up: |
   | [...ite/internal/election/ElectionListenerManager.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1saXRlL2VsYXN0aWNqb2ItbGl0ZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2xpdGUvaW50ZXJuYWwvZWxlY3Rpb24vRWxlY3Rpb25MaXN0ZW5lck1hbmFnZXIuamF2YQ==) | `92.00% <0.00%> (-4.00%)` | :arrow_down: |
   | [...ticjob/lite/internal/snapshot/SnapshotService.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1saXRlL2VsYXN0aWNqb2ItbGl0ZS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9lbGFzdGljam9iL2xpdGUvaW50ZXJuYWwvc25hcHNob3QvU25hcHNob3RTZXJ2aWNlLmphdmE=) | `82.53% <0.00%> (ø)` | |
   | [...sticjob/reg/zookeeper/ZookeeperRegistryCenter.java](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZWxhc3RpY2pvYi1pbmZyYS9lbGFzdGljam9iLXJlZ2lzdHJ5LWNlbnRlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvZWxhc3RpY2pvYi9yZWcvem9va2VlcGVyL1pvb2tlZXBlclJlZ2lzdHJ5Q2VudGVyLmphdmE=) | `72.80% <0.00%> (ø)` | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [879b6f4...764db58](https://codecov.io/gh/apache/shardingsphere-elasticjob/pull/1980?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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



[GitHub] [shardingsphere-elasticjob] TeslaCN commented on a change in pull request #1980: Support annotation job java

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on a change in pull request #1980:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1980#discussion_r710290350



##########
File path: elasticjob-api/src/main/java/org/apache/shardingsphere/elasticjob/annotation/ElasticJobProp.java
##########
@@ -0,0 +1,42 @@
+/*
+ * 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.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * The annotation that specify elastic-job prop.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ElasticJobProp {
+    
+    /**
+     * prop key.
+     * @return key
+     */
+    String key();
+    
+    /**
+     * prop value.

Review comment:
       The first letter should be uppercase.

##########
File path: elasticjob-api/src/main/java/org/apache/shardingsphere/elasticjob/annotation/ElasticJobProp.java
##########
@@ -0,0 +1,42 @@
+/*
+ * 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.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * The annotation that specify elastic-job prop.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ElasticJobProp {
+    
+    /**
+     * prop key.

Review comment:
       The first letter should be uppercase.

##########
File path: elasticjob-api/src/main/java/org/apache/shardingsphere/elasticjob/annotation/ElasticJobConfiguration.java
##########
@@ -0,0 +1,155 @@
+/*
+ * 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 jo 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.

Review comment:
       The first letter should be uppercase.

##########
File path: elasticjob-infra/elasticjob-infra-common/src/main/java/org/apache/shardingsphere/elasticjob/infra/exception/JobAnnotationException.java
##########
@@ -0,0 +1,35 @@
+/*
+ * 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.infra.exception;
+
+/**
+ * Job annotation exception.
+ */
+public final class JobAnnotationException extends RuntimeException {

Review comment:
       Could we reuse the `JobConfigurationException`?




-- 
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