You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/07/01 11:42:48 UTC

[shardingsphere-elasticjob-lite] branch master updated: Refactor cron from required to optional in job config (#880)

This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere-elasticjob-lite.git


The following commit(s) were added to refs/heads/master by this push:
     new c00e8b7  Refactor cron from required to optional in job config (#880)
c00e8b7 is described below

commit c00e8b7ae036875842e0944c0606ea89b0151c1b
Author: Liang Zhang <te...@163.com>
AuthorDate: Wed Jul 1 19:42:41 2020 +0800

    Refactor cron from required to optional in job config (#880)
---
 .../elasticjob/lite/config/JobConfiguration.java   | 33 +++++++++++-----------
 .../internal/config/yaml/YamlJobConfiguration.java |  4 +--
 .../lite/config/JobConfigurationTest.java          | 11 ++++----
 .../type/impl/DataflowJobExecutorTest.java         |  4 +--
 .../executor/type/impl/ScriptJobExecutorTest.java  |  4 +--
 .../executor/type/impl/SimpleJobExecutorTest.java  |  4 +--
 .../executor/type/impl/WrongJobExecutorTest.java   |  4 +--
 .../lite/fixture/util/JobConfigurationUtil.java    |  4 +--
 .../lite/integrate/AbstractBaseStdJobTest.java     |  2 +-
 .../config/yaml/YamlJobConfigurationTest.java      |  3 +-
 .../failover/FailoverListenerManagerTest.java      | 10 +++----
 .../internal/guarantee/GuaranteeServiceTest.java   |  6 ++--
 .../internal/monitor/MonitorServiceEnableTest.java |  6 ++--
 .../internal/reconcile/ReconcileServiceTest.java   |  2 +-
 .../lite/internal/schedule/LiteJobFacadeTest.java  | 24 ++++++++--------
 .../lite/internal/setup/SetUpFacadeTest.java       |  4 +--
 .../sharding/ExecutionContextServiceTest.java      | 12 ++++----
 .../internal/sharding/ExecutionServiceTest.java    | 24 ++++++++--------
 .../internal/sharding/ShardingServiceTest.java     | 12 ++++----
 .../elasticjob/lite/example/JavaMain.java          | 13 +++++----
 .../lite/example/config/DataflowJobConfig.java     |  4 +--
 .../lite/example/config/SimpleJobConfig.java       |  2 +-
 22 files changed, 97 insertions(+), 95 deletions(-)

diff --git a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/config/JobConfiguration.java b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/config/JobConfiguration.java
index 13e8e28..f96c765 100644
--- a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/config/JobConfiguration.java
+++ b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/config/JobConfiguration.java
@@ -75,12 +75,11 @@ public final class JobConfiguration {
      *
      * @param jobName job name
      * @param jobType job type
-     * @param cron cron expression for job trigger
      * @param shardingTotalCount sharding total count
      * @return ElasticJob configuration builder
      */
-    public static Builder newBuilder(final String jobName, final JobType jobType, final String cron, final int shardingTotalCount) {
-        return new Builder(jobName, jobType, cron, shardingTotalCount);
+    public static Builder newBuilder(final String jobName, final JobType jobType, final int shardingTotalCount) {
+        return new Builder(jobName, jobType, shardingTotalCount);
     }
     
     @RequiredArgsConstructor(access = AccessLevel.PRIVATE)
@@ -90,7 +89,7 @@ public final class JobConfiguration {
         
         private final JobType jobType;
         
-        private final String cron;
+        private String cron;
         
         private final int shardingTotalCount;
         
@@ -121,6 +120,19 @@ public final class JobConfiguration {
         private boolean disabled;
         
         private boolean overwrite;
+    
+        /**
+         * Cron expression.
+         *
+         * @param cron cron expression
+         * @return job configuration builder
+         */
+        public Builder cron(final String cron) {
+            if (null != cron) {
+                this.cron = cron;
+            }
+            return this;
+        }
         
         /**
          * Set mapper of sharding items and sharding parameters.
@@ -134,7 +146,6 @@ public final class JobConfiguration {
          * </p>
          *
          * @param shardingItemParameters mapper of sharding items and sharding parameters
-         *
          * @return job configuration builder
          */
         public Builder shardingItemParameters(final String shardingItemParameters) {
@@ -169,7 +180,6 @@ public final class JobConfiguration {
          * </p>
          *
          * @param monitorExecution monitor job execution status 
-         *
          * @return ElasticJob configuration builder
          */
         public Builder monitorExecution(final boolean monitorExecution) {
@@ -185,7 +195,6 @@ public final class JobConfiguration {
          * </p> 
          *
          * @param failover enable or disable failover
-         *
          * @return job configuration builder
          */
         public Builder failover(final boolean failover) {
@@ -197,7 +206,6 @@ public final class JobConfiguration {
          * Set enable misfire.
          *
          * @param misfire enable or disable misfire
-         *
          * @return job configuration builder
          */
         public Builder misfire(final boolean misfire) {
@@ -214,7 +222,6 @@ public final class JobConfiguration {
          * </p>
          *
          * @param maxTimeDiffSeconds max tolerate time different seconds between job server and registry center
-         *
          * @return ElasticJob configuration builder
          */
         public Builder maxTimeDiffSeconds(final int maxTimeDiffSeconds) {
@@ -230,7 +237,6 @@ public final class JobConfiguration {
          * </p>
          *
          * @param reconcileIntervalMinutes reconcile interval minutes for job sharding status
-         *
          * @return ElasticJob configuration builder
          */
         public Builder reconcileIntervalMinutes(final int reconcileIntervalMinutes) {
@@ -246,7 +252,6 @@ public final class JobConfiguration {
          * </p>
          *
          * @param jobShardingStrategyType job sharding sharding type
-         *
          * @return ElasticJob configuration builder
          */
         public Builder jobShardingStrategyType(final String jobShardingStrategyType) {
@@ -260,7 +265,6 @@ public final class JobConfiguration {
          * Set job executor service handler type.
          *
          * @param jobExecutorServiceHandlerType job executor service handler type
-         *
          * @return job configuration builder
          */
         public Builder jobExecutorServiceHandlerType(final String jobExecutorServiceHandlerType) {
@@ -272,7 +276,6 @@ public final class JobConfiguration {
          * Set job error handler type.
          *
          * @param jobErrorHandlerType job error handler type
-         *
          * @return job configuration builder
          */
         public Builder jobErrorHandlerType(final String jobErrorHandlerType) {
@@ -284,7 +287,6 @@ public final class JobConfiguration {
          * Set job description.
          *
          * @param description job description
-         *
          * @return job configuration builder
          */
         public Builder description(final String description) {
@@ -299,7 +301,6 @@ public final class JobConfiguration {
          *
          * @param key property key
          * @param value property value
-         *
          * @return job configuration builder
          */
         public Builder setProperty(final String key, final String value) {
@@ -315,7 +316,6 @@ public final class JobConfiguration {
          * </p>
          *
          * @param disabled whether disable job when start
-         *
          * @return ElasticJob configuration builder
          */
         public Builder disabled(final boolean disabled) {
@@ -331,7 +331,6 @@ public final class JobConfiguration {
          * </p>
          *
          * @param overwrite whether overwrite local configuration to registry center when job startup
-         *
          * @return ElasticJob configuration builder
          */
         public Builder overwrite(final boolean overwrite) {
diff --git a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/yaml/YamlJobConfiguration.java b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/yaml/YamlJobConfiguration.java
index f4e9e84..9e491e9 100644
--- a/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/yaml/YamlJobConfiguration.java
+++ b/elastic-job-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/config/yaml/YamlJobConfiguration.java
@@ -73,8 +73,8 @@ public final class YamlJobConfiguration {
      * @return job configuration
      */
     public JobConfiguration toJobConfiguration() {
-        JobConfiguration result = JobConfiguration.newBuilder(jobName, jobType, cron, shardingTotalCount)
-                .shardingItemParameters(shardingItemParameters).jobParameter(jobParameter)
+        JobConfiguration result = JobConfiguration.newBuilder(jobName, jobType, shardingTotalCount)
+                .cron(cron).shardingItemParameters(shardingItemParameters).jobParameter(jobParameter)
                 .monitorExecution(monitorExecution).failover(failover).misfire(misfire)
                 .maxTimeDiffSeconds(maxTimeDiffSeconds).reconcileIntervalMinutes(reconcileIntervalMinutes)
                 .jobShardingStrategyType(jobShardingStrategyType).jobExecutorServiceHandlerType(jobExecutorServiceHandlerType).jobErrorHandlerType(jobErrorHandlerType)
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/config/JobConfigurationTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/config/JobConfigurationTest.java
index f126fe6..044a01d 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/config/JobConfigurationTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/config/JobConfigurationTest.java
@@ -30,7 +30,8 @@ public final class JobConfigurationTest {
     
     @Test
     public void assertBuildAllProperties() {
-        JobConfiguration actual = JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3)
+        JobConfiguration actual = JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3)
+                .cron("0/1 * * * * ?")
                 .shardingItemParameters("0=a,1=b,2=c").jobParameter("param")
                 .monitorExecution(false).failover(true).misfire(false)
                 .maxTimeDiffSeconds(1000).reconcileIntervalMinutes(60)
@@ -59,7 +60,7 @@ public final class JobConfigurationTest {
     
     @Test
     public void assertBuildRequiredProperties() {
-        JobConfiguration actual = JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).build();
+        JobConfiguration actual = JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build();
         assertThat(actual.getJobName(), is("test_job"));
         assertThat(actual.getJobType(), is(JobType.SIMPLE));
         assertThat(actual.getCron(), is("0/1 * * * * ?"));
@@ -82,16 +83,16 @@ public final class JobConfigurationTest {
     
     @Test(expected = IllegalArgumentException.class)
     public void assertBuildWithEmptyJobName() {
-        JobConfiguration.newBuilder("", JobType.SIMPLE, "0/1 * * * * ?", 3).build();
+        JobConfiguration.newBuilder("", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build();
     }
     
     @Test(expected = NullPointerException.class)
     public void assertBuildWithNullJobType() {
-        JobConfiguration.newBuilder("test_job", null, "0/1 * * * * ?", 3).build();
+        JobConfiguration.newBuilder("test_job", null, 3).cron("0/1 * * * * ?").build();
     }
     
     @Test(expected = IllegalArgumentException.class)
     public void assertBuildWithInvalidShardingTotalCount() {
-        JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", -1).build();
+        JobConfiguration.newBuilder("test_job", JobType.SIMPLE, -1).cron("0/1 * * * * ?").build();
     }
 }
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/DataflowJobExecutorTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/DataflowJobExecutorTest.java
index 67c5dc1..8591310 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/DataflowJobExecutorTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/DataflowJobExecutorTest.java
@@ -174,8 +174,8 @@ public final class DataflowJobExecutorTest {
     
     private void setUp(final boolean isStreamingProcess, final ShardingContexts shardingContexts) {
         this.shardingContexts = shardingContexts;
-        JobConfiguration jobConfig = JobConfiguration.newBuilder(ShardingContextsBuilder.JOB_NAME, JobType.DATAFLOW, "0/1 * * * * ?", 3)
-                .jobErrorHandlerType("IGNORE").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.toString(isStreamingProcess)).build();
+        JobConfiguration jobConfig = JobConfiguration.newBuilder(ShardingContextsBuilder.JOB_NAME, JobType.DATAFLOW, 3)
+                .cron("0/1 * * * * ?").jobErrorHandlerType("IGNORE").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.toString(isStreamingProcess)).build();
         when(jobFacade.getShardingContexts()).thenReturn(shardingContexts);
         elasticJobExecutor = new ElasticJobExecutor(regCenter, new TestDataflowJob(jobCaller), jobConfig, Collections.emptyList(), null);
         ReflectionUtils.setFieldValue(elasticJobExecutor, "jobFacade", jobFacade);
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/ScriptJobExecutorTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/ScriptJobExecutorTest.java
index 3d80ef2..0e8c09b 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/ScriptJobExecutorTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/ScriptJobExecutorTest.java
@@ -87,7 +87,7 @@ public final class ScriptJobExecutorTest {
     }
     
     private JobConfiguration createJobConfiguration(final String scriptCommandLine, final String jobErrorHandlerType) {
-        return JobConfiguration.newBuilder(ShardingContextsBuilder.JOB_NAME, JobType.SCRIPT, "0/1 * * * * ?", 3)
-                .jobErrorHandlerType(jobErrorHandlerType).setProperty(ScriptJobExecutor.SCRIPT_KEY, scriptCommandLine).build();
+        return JobConfiguration.newBuilder(ShardingContextsBuilder.JOB_NAME, JobType.SCRIPT, 3)
+                .cron("0/1 * * * * ?").jobErrorHandlerType(jobErrorHandlerType).setProperty(ScriptJobExecutor.SCRIPT_KEY, scriptCommandLine).build();
     }
 }
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/SimpleJobExecutorTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/SimpleJobExecutorTest.java
index 19d0e39..24855a6 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/SimpleJobExecutorTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/SimpleJobExecutorTest.java
@@ -68,8 +68,8 @@ public final class SimpleJobExecutorTest {
     }
     
     private JobConfiguration createJobConfiguration(final String jobExecutorServiceHandlerType, final String jobErrorHandlerType) {
-        return JobConfiguration.newBuilder(ShardingContextsBuilder.JOB_NAME, JobType.SIMPLE, "0/1 * * * * ?", 3)
-                .shardingItemParameters("0=A,1=B,2=C").jobParameter("param").failover(true).misfire(false)
+        return JobConfiguration.newBuilder(ShardingContextsBuilder.JOB_NAME, JobType.SIMPLE, 3)
+                .cron("0/1 * * * * ?").shardingItemParameters("0=A,1=B,2=C").jobParameter("param").failover(true).misfire(false)
                 .jobExecutorServiceHandlerType(jobExecutorServiceHandlerType).jobErrorHandlerType(jobErrorHandlerType).description("desc").build();
     }
     
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/WrongJobExecutorTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/WrongJobExecutorTest.java
index 3332e99..134f40b 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/WrongJobExecutorTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/executor/type/impl/WrongJobExecutorTest.java
@@ -58,8 +58,8 @@ public final class WrongJobExecutorTest {
     }
     
     private JobConfiguration createJobConfiguration() {
-        return JobConfiguration.newBuilder(ShardingContextsBuilder.JOB_NAME, JobType.SIMPLE, "0/1 * * * * ?", 3)
-                .shardingItemParameters("0=A,1=B,2=C").jobParameter("param").failover(true).misfire(false).jobErrorHandlerType("THROW").description("desc").build();
+        return JobConfiguration.newBuilder(ShardingContextsBuilder.JOB_NAME, JobType.SIMPLE, 3)
+                .cron("0/1 * * * * ?").shardingItemParameters("0=A,1=B,2=C").jobParameter("param").failover(true).misfire(false).jobErrorHandlerType("THROW").description("desc").build();
     }
     
     @Test(expected = RuntimeException.class)
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/fixture/util/JobConfigurationUtil.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/fixture/util/JobConfigurationUtil.java
index 731418f..d6d8113 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/fixture/util/JobConfigurationUtil.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/fixture/util/JobConfigurationUtil.java
@@ -31,7 +31,7 @@ public final class JobConfigurationUtil {
      * @return job configuration
      */
     public static JobConfiguration createSimpleJobConfiguration() {
-        return JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).build();
+        return JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build();
     }
     
     /**
@@ -41,6 +41,6 @@ public final class JobConfigurationUtil {
      * @return job configuration
      */
     public static JobConfiguration createSimpleJobConfiguration(final boolean overwrite) {
-        return JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).overwrite(overwrite).build();
+        return JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").overwrite(overwrite).build();
     }
 }
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/AbstractBaseStdJobTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/AbstractBaseStdJobTest.java
index 0179534..7653a88 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/AbstractBaseStdJobTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/integrate/AbstractBaseStdJobTest.java
@@ -117,7 +117,7 @@ public abstract class AbstractBaseStdJobTest {
         String cron = "0/1 * * * * ?";
         int totalShardingCount = 3;
         String shardingParameters = "0=A,1=B,2=C";
-        Builder builder = JobConfiguration.newBuilder(jobName, getJobType(elasticJobClass), cron, totalShardingCount).shardingItemParameters(shardingParameters)
+        Builder builder = JobConfiguration.newBuilder(jobName, getJobType(elasticJobClass), totalShardingCount).cron(cron).shardingItemParameters(shardingParameters)
                 .jobErrorHandlerType("IGNORE").disabled(disabled).overwrite(true);
         if (DataflowJob.class.isAssignableFrom(elasticJobClass)) {
             builder.setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString());
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/config/yaml/YamlJobConfigurationTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/config/yaml/YamlJobConfigurationTest.java
index 0eced27..4e24017 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/config/yaml/YamlJobConfigurationTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/config/yaml/YamlJobConfigurationTest.java
@@ -67,7 +67,8 @@ public final class YamlJobConfigurationTest {
     
     @Test
     public void assertFromJobConfiguration() {
-        JobConfiguration jobConfiguration = JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3)
+        JobConfiguration jobConfiguration = JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3)
+                .cron("0/1 * * * * ?")
                 .shardingItemParameters("0=A,1=B,2=C").jobParameter("param")
                 .monitorExecution(true).failover(true).misfire(true)
                 .jobShardingStrategyType("AVG_ALLOCATION").jobExecutorServiceHandlerType("CPU").jobErrorHandlerType("IGNORE")
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/failover/FailoverListenerManagerTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/failover/FailoverListenerManagerTest.java
index fdfd08f..1eb4d92 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/failover/FailoverListenerManagerTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/failover/FailoverListenerManagerTest.java
@@ -81,14 +81,14 @@ public final class FailoverListenerManagerTest {
     
     @Test
     public void assertJobCrashedJobListenerWhenIsNotNodeRemoved() {
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).failover(true).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(true).build());
         failoverListenerManager.new JobCrashedJobListener().dataChanged("/test_job/instances/127.0.0.1@-@0", Type.NODE_ADDED, "");
         verify(failoverService, times(0)).failoverIfNecessary();
     }
     
     @Test
     public void assertJobCrashedJobListenerWhenIsNotInstancesPath() {
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).failover(true).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(true).build());
         failoverListenerManager.new JobCrashedJobListener().dataChanged("/test_job/other/127.0.0.1@-@0", Type.NODE_REMOVED, "");
         verify(failoverService, times(0)).failoverIfNecessary();
     }
@@ -96,7 +96,7 @@ public final class FailoverListenerManagerTest {
     @Test
     public void assertJobCrashedJobListenerWhenIsSameInstance() {
         JobRegistry.getInstance().addJobInstance("test_job", new JobInstance("127.0.0.1@-@0"));
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).failover(true).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(true).build());
         failoverListenerManager.new JobCrashedJobListener().dataChanged("/test_job/instances/127.0.0.1@-@0", Type.NODE_REMOVED, "");
         verify(failoverService, times(0)).failoverIfNecessary();
         JobRegistry.getInstance().shutdown("test_job");
@@ -105,7 +105,7 @@ public final class FailoverListenerManagerTest {
     @Test
     public void assertJobCrashedJobListenerWhenIsOtherInstanceCrashed() {
         JobRegistry.getInstance().addJobInstance("test_job", new JobInstance("127.0.0.1@-@0"));
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).failover(true).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(true).build());
         when(shardingService.getShardingItems("127.0.0.1@-@1")).thenReturn(Arrays.asList(0, 2));
         failoverListenerManager.new JobCrashedJobListener().dataChanged("/test_job/instances/127.0.0.1@-@1", Type.NODE_REMOVED, "");
         verify(failoverService).setCrashedFailoverFlag(0);
@@ -117,7 +117,7 @@ public final class FailoverListenerManagerTest {
     @Test
     public void assertJobCrashedJobListenerWhenIsOtherFailoverInstanceCrashed() {
         JobRegistry.getInstance().addJobInstance("test_job", new JobInstance("127.0.0.1@-@0"));
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).failover(true).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(true).build());
         when(failoverService.getFailoverItems("127.0.0.1@-@1")).thenReturn(Collections.singletonList(1));
         failoverListenerManager.new JobCrashedJobListener().dataChanged("/test_job/instances/127.0.0.1@-@1", Type.NODE_REMOVED, "");
         verify(failoverService).setCrashedFailoverFlag(1);
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/guarantee/GuaranteeServiceTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/guarantee/GuaranteeServiceTest.java
index 71b8225..ce721e0 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/guarantee/GuaranteeServiceTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/guarantee/GuaranteeServiceTest.java
@@ -69,7 +69,7 @@ public final class GuaranteeServiceTest {
     @Test
     public void assertIsNotAllStarted() {
         when(configService.load(false)).thenReturn(
-                JobConfiguration.newBuilder("test_job", JobType.DATAFLOW, "0/1 * * * * ?", 3).setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build());
+                JobConfiguration.newBuilder("test_job", JobType.DATAFLOW, 3).cron("0/1 * * * * ?").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build());
         when(jobNodeStorage.isJobNodeExisted("guarantee/started")).thenReturn(true);
         when(jobNodeStorage.getJobNodeChildrenKeys("guarantee/started")).thenReturn(Arrays.asList("0", "1"));
         assertFalse(guaranteeService.isAllStarted());
@@ -78,7 +78,7 @@ public final class GuaranteeServiceTest {
     @Test
     public void assertIsAllStarted() {
         when(jobNodeStorage.isJobNodeExisted("guarantee/started")).thenReturn(true);
-        when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).build());
+        when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build());
         when(jobNodeStorage.getJobNodeChildrenKeys("guarantee/started")).thenReturn(Arrays.asList("0", "1", "2"));
         assertTrue(guaranteeService.isAllStarted());
     }
@@ -111,7 +111,7 @@ public final class GuaranteeServiceTest {
     @Test
     public void assertIsAllCompleted() {
         when(jobNodeStorage.isJobNodeExisted("guarantee/completed")).thenReturn(true);
-        when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).build());
+        when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build());
         when(jobNodeStorage.getJobNodeChildrenKeys("guarantee/completed")).thenReturn(Arrays.asList("0", "1", "2"));
         assertTrue(guaranteeService.isAllCompleted());
     }
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/monitor/MonitorServiceEnableTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/monitor/MonitorServiceEnableTest.java
index a284679..42a6e90 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/monitor/MonitorServiceEnableTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/monitor/MonitorServiceEnableTest.java
@@ -33,13 +33,13 @@ public final class MonitorServiceEnableTest extends AbstractBaseStdJobTest {
     public MonitorServiceEnableTest() {
         super(TestSimpleJob.class);
     }
-
+    
     @Before
     public void setUp() {
         super.setUp();
         getMonitorService().listen();
     }
-
+    
     @After
     public void tearDown() {
         super.tearDown();
@@ -48,7 +48,7 @@ public final class MonitorServiceEnableTest extends AbstractBaseStdJobTest {
     
     @Test
     public void assertMonitorWithCommand() throws IOException {
-        initJob();
+        scheduleJob();
         assertNotNull(SocketUtils.sendCommand(MonitorService.DUMP_COMMAND + getJobName(), MONITOR_PORT));
         assertNull(SocketUtils.sendCommand("unknown_command", MONITOR_PORT));
     }
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/reconcile/ReconcileServiceTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/reconcile/ReconcileServiceTest.java
index 54709d7..7043522 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/reconcile/ReconcileServiceTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/reconcile/ReconcileServiceTest.java
@@ -60,7 +60,7 @@ public final class ReconcileServiceTest {
     
     @Test
     public void assertReconcile() {
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).reconcileIntervalMinutes(1).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").reconcileIntervalMinutes(1).build());
         when(shardingService.isNeedSharding()).thenReturn(false);
         when(shardingService.hasShardingInfoInOfflineServers()).thenReturn(true);
         when(leaderService.isLeaderUntilBlock()).thenReturn(true);
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/schedule/LiteJobFacadeTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/schedule/LiteJobFacadeTest.java
index b0f0267..7b70dd8 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/schedule/LiteJobFacadeTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/schedule/LiteJobFacadeTest.java
@@ -86,7 +86,7 @@ public final class LiteJobFacadeTest {
     
     @Test
     public void assertLoad() {
-        JobConfiguration expected = JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).build();
+        JobConfiguration expected = JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build();
         when(configService.load(true)).thenReturn(expected);
         assertThat(liteJobFacade.loadJobConfiguration(true), is(expected));
     }
@@ -99,14 +99,14 @@ public final class LiteJobFacadeTest {
     
     @Test
     public void assertFailoverIfUnnecessary() {
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).failover(false).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(false).build());
         liteJobFacade.failoverIfNecessary();
         verify(failoverService, times(0)).failoverIfNecessary();
     }
     
     @Test
     public void assertFailoverIfNecessary() {
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).failover(true).monitorExecution(true).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(true).monitorExecution(true).build());
         liteJobFacade.failoverIfNecessary();
         verify(failoverService).failoverIfNecessary();
     }
@@ -121,7 +121,7 @@ public final class LiteJobFacadeTest {
     @Test
     public void assertRegisterJobCompletedWhenFailoverDisabled() {
         ShardingContexts shardingContexts = new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap());
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).failover(false).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(false).build());
         liteJobFacade.registerJobCompleted(shardingContexts);
         verify(executionService).registerJobCompleted(shardingContexts);
         verify(failoverService, times(0)).updateFailoverComplete(shardingContexts.getShardingItemParameters().keySet());
@@ -130,7 +130,7 @@ public final class LiteJobFacadeTest {
     @Test
     public void assertRegisterJobCompletedWhenFailoverEnabled() {
         ShardingContexts shardingContexts = new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap());
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).failover(true).monitorExecution(true).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(true).monitorExecution(true).build());
         liteJobFacade.registerJobCompleted(shardingContexts);
         verify(executionService).registerJobCompleted(shardingContexts);
         verify(failoverService).updateFailoverComplete(shardingContexts.getShardingItemParameters().keySet());
@@ -139,7 +139,7 @@ public final class LiteJobFacadeTest {
     @Test
     public void assertGetShardingContextWhenIsFailoverEnableAndFailover() {
         ShardingContexts shardingContexts = new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap());
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).failover(true).monitorExecution(true).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(true).monitorExecution(true).build());
         when(failoverService.getLocalFailoverItems()).thenReturn(Collections.singletonList(1));
         when(executionContextService.getJobShardingContext(Collections.singletonList(1))).thenReturn(shardingContexts);
         assertThat(liteJobFacade.getShardingContexts(), is(shardingContexts));
@@ -149,7 +149,7 @@ public final class LiteJobFacadeTest {
     @Test
     public void assertGetShardingContextWhenIsFailoverEnableAndNotFailover() {
         ShardingContexts shardingContexts = new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap());
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).failover(true).monitorExecution(true).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(true).monitorExecution(true).build());
         when(failoverService.getLocalFailoverItems()).thenReturn(Collections.emptyList());
         when(shardingService.getLocalShardingItems()).thenReturn(Lists.newArrayList(0, 1));
         when(failoverService.getLocalTakeOffItems()).thenReturn(Collections.singletonList(0));
@@ -161,7 +161,7 @@ public final class LiteJobFacadeTest {
     @Test
     public void assertGetShardingContextWhenIsFailoverDisable() {
         ShardingContexts shardingContexts = new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap());
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).failover(false).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(false).build());
         when(shardingService.getLocalShardingItems()).thenReturn(Lists.newArrayList(0, 1));
         when(executionContextService.getJobShardingContext(Lists.newArrayList(0, 1))).thenReturn(shardingContexts);
         assertThat(liteJobFacade.getShardingContexts(), is(shardingContexts));
@@ -171,7 +171,7 @@ public final class LiteJobFacadeTest {
     @Test
     public void assertGetShardingContextWhenHasDisabledItems() {
         ShardingContexts shardingContexts = new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap());
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).failover(false).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").failover(false).build());
         when(shardingService.getLocalShardingItems()).thenReturn(Lists.newArrayList(0, 1));
         when(executionService.getDisabledItems(Lists.newArrayList(0, 1))).thenReturn(Collections.singletonList(1));
         when(executionContextService.getJobShardingContext(Lists.newArrayList(0))).thenReturn(shardingContexts);
@@ -212,7 +212,7 @@ public final class LiteJobFacadeTest {
     @Test
     public void assertNotEligibleForJobRunningWhenNeedSharding() {
         when(configService.load(true)).thenReturn(
-                JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build());
+                JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build());
         when(shardingService.isNeedSharding()).thenReturn(true);
         assertThat(liteJobFacade.isEligibleForJobRunning(), is(false));
         verify(shardingService).isNeedSharding();
@@ -221,7 +221,7 @@ public final class LiteJobFacadeTest {
     @Test
     public void assertNotEligibleForJobRunningWhenUnStreamingProcess() {
         when(configService.load(true)).thenReturn(
-                JobConfiguration.newBuilder("test_job", JobType.DATAFLOW, "0/1 * * * * ?", 3).setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.FALSE.toString()).build());
+                JobConfiguration.newBuilder("test_job", JobType.DATAFLOW, 3).cron("0/1 * * * * ?").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.FALSE.toString()).build());
         assertThat(liteJobFacade.isEligibleForJobRunning(), is(false));
         verify(configService).load(true);
     }
@@ -230,7 +230,7 @@ public final class LiteJobFacadeTest {
     public void assertEligibleForJobRunningWhenNotNeedShardingAndStreamingProcess() {
         when(shardingService.isNeedSharding()).thenReturn(false);
         when(configService.load(true)).thenReturn(
-                JobConfiguration.newBuilder("test_job", JobType.DATAFLOW, "0/1 * * * * ?", 3).setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build());
+                JobConfiguration.newBuilder("test_job", JobType.DATAFLOW, 3).cron("0/1 * * * * ?").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build());
         assertThat(liteJobFacade.isEligibleForJobRunning(), is(true));
         verify(shardingService).isNeedSharding();
         verify(configService).load(true);
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/setup/SetUpFacadeTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/setup/SetUpFacadeTest.java
index c45d1b7..f257032 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/setup/SetUpFacadeTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/setup/SetUpFacadeTest.java
@@ -93,8 +93,8 @@ public final class SetUpFacadeTest {
     
     @Test
     public void assertSetUpJobConfiguration() {
-        JobConfiguration jobConfig = JobConfiguration.newBuilder(
-                "test_job", JobType.DATAFLOW, "0/1 * * * * ?", 3).setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build();
+        JobConfiguration jobConfig = JobConfiguration.newBuilder("test_job", JobType.DATAFLOW, 3)
+                .cron("0/1 * * * * ?").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build();
         when(configService.setUpJobConfiguration(TestDataflowJob.class.getName(), jobConfig)).thenReturn(jobConfig);
         assertThat(setUpFacade.setUpJobConfiguration(TestDataflowJob.class.getName(), jobConfig), is(jobConfig));
         verify(configService).setUpJobConfiguration(TestDataflowJob.class.getName(), jobConfig);
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ExecutionContextServiceTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ExecutionContextServiceTest.java
index 4e96961..e680cd9 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ExecutionContextServiceTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ExecutionContextServiceTest.java
@@ -63,8 +63,8 @@ public final class ExecutionContextServiceTest {
     
     @Test
     public void assertGetShardingContextWhenNotAssignShardingItem() {
-        when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.DATAFLOW, "0/1 * * * * ?", 3)
-                .setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).monitorExecution(false).build());
+        when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.DATAFLOW, 3)
+                .cron("0/1 * * * * ?").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).monitorExecution(false).build());
         ShardingContexts shardingContexts = executionContextService.getJobShardingContext(Collections.emptyList());
         assertTrue(shardingContexts.getTaskId().startsWith("test_job@-@@-@READY@-@"));
         assertThat(shardingContexts.getShardingTotalCount(), is(3));
@@ -72,8 +72,8 @@ public final class ExecutionContextServiceTest {
     
     @Test
     public void assertGetShardingContextWhenAssignShardingItems() {
-        when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.DATAFLOW, "0/1 * * * * ?", 3)
-                .shardingItemParameters("0=A,1=B,2=C").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).monitorExecution(false).build());
+        when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.DATAFLOW, 3)
+                .cron("0/1 * * * * ?").shardingItemParameters("0=A,1=B,2=C").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).monitorExecution(false).build());
         Map<Integer, String> map = new HashMap<>(3);
         map.put(0, "A");
         map.put(1, "B");
@@ -83,8 +83,8 @@ public final class ExecutionContextServiceTest {
     
     @Test
     public void assertGetShardingContextWhenHasRunningItems() {
-        when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.DATAFLOW, "0/1 * * * * ?", 3)
-                .shardingItemParameters("0=A,1=B,2=C").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).monitorExecution(true).build());
+        when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.DATAFLOW, 3)
+                .cron("0/1 * * * * ?").shardingItemParameters("0=A,1=B,2=C").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).monitorExecution(true).build());
         when(jobNodeStorage.isJobNodeExisted("sharding/0/running")).thenReturn(false);
         when(jobNodeStorage.isJobNodeExisted("sharding/1/running")).thenReturn(true);
         Map<Integer, String> map = new HashMap<>(1, 1);
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ExecutionServiceTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ExecutionServiceTest.java
index 5e85a67..484dcf0 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ExecutionServiceTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ExecutionServiceTest.java
@@ -69,7 +69,7 @@ public final class ExecutionServiceTest {
     
     @Test
     public void assertRegisterJobBeginWithoutMonitorExecution() {
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).monitorExecution(false).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(false).build());
         executionService.registerJobBegin(getShardingContext());
         verify(jobNodeStorage, times(0)).fillEphemeralJobNode(any(), any());
         assertTrue(JobRegistry.getInstance().isJobRunning("test_job"));
@@ -77,7 +77,7 @@ public final class ExecutionServiceTest {
     
     @Test
     public void assertRegisterJobBeginWithMonitorExecution() {
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).monitorExecution(true).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(true).build());
         executionService.registerJobBegin(getShardingContext());
         verify(jobNodeStorage).fillEphemeralJobNode("sharding/0/running", "");
         verify(jobNodeStorage).fillEphemeralJobNode("sharding/1/running", "");
@@ -88,7 +88,7 @@ public final class ExecutionServiceTest {
     @Test
     public void assertRegisterJobCompletedWithoutMonitorExecution() {
         JobRegistry.getInstance().setJobRunning("test_job", true);
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).monitorExecution(false).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(false).build());
         executionService.registerJobCompleted(new ShardingContexts("fake_task_id", "test_job", 10, "", Collections.emptyMap()));
         verify(jobNodeStorage, times(0)).removeJobNodeIfExisted(any());
         verify(jobNodeStorage, times(0)).createJobNodeIfNeeded(any());
@@ -98,7 +98,7 @@ public final class ExecutionServiceTest {
     @Test
     public void assertRegisterJobCompletedWithMonitorExecution() {
         JobRegistry.getInstance().setJobRunning("test_job", true);
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).monitorExecution(true).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(true).build());
         executionService.registerJobCompleted(getShardingContext());
         verify(jobNodeStorage).removeJobNodeIfExisted("sharding/0/running");
         verify(jobNodeStorage).removeJobNodeIfExisted("sharding/1/running");
@@ -108,7 +108,7 @@ public final class ExecutionServiceTest {
     
     @Test
     public void assertClearAllRunningInfo() {
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).monitorExecution(false).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(false).build());
         executionService.clearAllRunningInfo();
         verify(jobNodeStorage).removeJobNodeIfExisted("sharding/0/running");
         verify(jobNodeStorage).removeJobNodeIfExisted("sharding/1/running");
@@ -124,13 +124,13 @@ public final class ExecutionServiceTest {
     
     @Test
     public void assertNotHaveRunningItemsWithoutMonitorExecution() {
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).monitorExecution(false).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(false).build());
         assertFalse(executionService.hasRunningItems(Arrays.asList(0, 1, 2)));
     }
     
     @Test
     public void assertHasRunningItemsWithMonitorExecution() {
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).monitorExecution(true).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(true).build());
         when(jobNodeStorage.isJobNodeExisted("sharding/0/running")).thenReturn(false);
         when(jobNodeStorage.isJobNodeExisted("sharding/1/running")).thenReturn(true);
         assertTrue(executionService.hasRunningItems(Arrays.asList(0, 1, 2)));
@@ -138,7 +138,7 @@ public final class ExecutionServiceTest {
     
     @Test
     public void assertNotHaveRunningItems() {
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).monitorExecution(true).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(true).build());
         when(jobNodeStorage.isJobNodeExisted("sharding/0/running")).thenReturn(false);
         when(jobNodeStorage.isJobNodeExisted("sharding/1/running")).thenReturn(false);
         when(jobNodeStorage.isJobNodeExisted("sharding/2/running")).thenReturn(false);
@@ -147,7 +147,7 @@ public final class ExecutionServiceTest {
     
     @Test
     public void assertHasRunningItemsForAll() {
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build());
         when(jobNodeStorage.isJobNodeExisted("sharding/0/running")).thenReturn(false);
         when(jobNodeStorage.isJobNodeExisted("sharding/1/running")).thenReturn(true);
         assertTrue(executionService.hasRunningItems());
@@ -155,7 +155,7 @@ public final class ExecutionServiceTest {
     
     @Test
     public void assertNotHaveRunningItemsForAll() {
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build());
         when(jobNodeStorage.isJobNodeExisted("sharding/0/running")).thenReturn(false);
         when(jobNodeStorage.isJobNodeExisted("sharding/1/running")).thenReturn(false);
         when(jobNodeStorage.isJobNodeExisted("sharding/2/running")).thenReturn(false);
@@ -164,7 +164,7 @@ public final class ExecutionServiceTest {
     
     @Test
     public void assertMisfireIfNotRunning() {
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).monitorExecution(true).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(true).build());
         when(jobNodeStorage.isJobNodeExisted("sharding/0/running")).thenReturn(false);
         when(jobNodeStorage.isJobNodeExisted("sharding/1/running")).thenReturn(false);
         when(jobNodeStorage.isJobNodeExisted("sharding/2/running")).thenReturn(false);
@@ -173,7 +173,7 @@ public final class ExecutionServiceTest {
     
     @Test
     public void assertMisfireIfRunning() {
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).monitorExecution(true).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(true).build());
         when(jobNodeStorage.isJobNodeExisted("sharding/0/running")).thenReturn(false);
         when(jobNodeStorage.isJobNodeExisted("sharding/1/running")).thenReturn(true);
         assertTrue(executionService.misfireIfHasRunningItems(Arrays.asList(0, 1, 2)));
diff --git a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ShardingServiceTest.java b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ShardingServiceTest.java
index 7b65730..d895346 100644
--- a/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ShardingServiceTest.java
+++ b/elastic-job-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ShardingServiceTest.java
@@ -137,7 +137,7 @@ public final class ShardingServiceTest {
         when(instanceService.getAvailableJobInstances()).thenReturn(Collections.singletonList(new JobInstance("127.0.0.1@-@0")));
         when(jobNodeStorage.isJobNodeExisted("leader/sharding/necessary")).thenReturn(true);
         when(leaderService.isLeaderUntilBlock()).thenReturn(true);
-        when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).monitorExecution(true).build());
+        when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(true).build());
         when(executionService.hasRunningItems()).thenReturn(true, false);
         when(jobNodeStorage.getJobNodeChildrenKeys(ShardingNode.ROOT)).thenReturn(Arrays.asList("0", "1"));
         shardingService.shardingIfNecessary();
@@ -157,7 +157,7 @@ public final class ShardingServiceTest {
         when(instanceService.getAvailableJobInstances()).thenReturn(Collections.singletonList(new JobInstance("127.0.0.1@-@0")));
         when(jobNodeStorage.isJobNodeExisted("leader/sharding/necessary")).thenReturn(true);
         when(leaderService.isLeaderUntilBlock()).thenReturn(true);
-        when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).monitorExecution(false).build());
+        when(configService.load(false)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").monitorExecution(false).build());
         when(jobNodeStorage.getJobNodeChildrenKeys(ShardingNode.ROOT)).thenReturn(Arrays.asList("0", "1", "2", "3"));
         shardingService.shardingIfNecessary();
         verify(jobNodeStorage).removeJobNodeIfExisted("sharding/0/instance");
@@ -182,7 +182,7 @@ public final class ShardingServiceTest {
         JobRegistry.getInstance().registerRegistryCenter("test_job", regCenter);
         JobRegistry.getInstance().registerJob("test_job", jobScheduleController);
         when(serverService.isAvailableServer("127.0.0.1")).thenReturn(true);
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build());
         when(jobNodeStorage.getJobNodeData("sharding/0/instance")).thenReturn("127.0.0.1@-@0");
         when(jobNodeStorage.getJobNodeData("sharding/1/instance")).thenReturn("127.0.0.1@-@1");
         when(jobNodeStorage.getJobNodeData("sharding/2/instance")).thenReturn("127.0.0.1@-@0");
@@ -208,7 +208,7 @@ public final class ShardingServiceTest {
         JobRegistry.getInstance().registerRegistryCenter("test_job", regCenter);
         JobRegistry.getInstance().registerJob("test_job", jobScheduleController);
         when(serverService.isAvailableServer("127.0.0.1")).thenReturn(true);
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build());
         when(jobNodeStorage.getJobNodeData("sharding/0/instance")).thenReturn("127.0.0.1@-@0");
         when(jobNodeStorage.getJobNodeData("sharding/1/instance")).thenReturn("127.0.0.1@-@1");
         when(jobNodeStorage.getJobNodeData("sharding/2/instance")).thenReturn("127.0.0.1@-@0");
@@ -219,7 +219,7 @@ public final class ShardingServiceTest {
     @Test
     public void assertHasShardingInfoInOfflineServers() {
         when(jobNodeStorage.getJobNodeChildrenKeys(InstanceNode.ROOT)).thenReturn(Arrays.asList("host0@-@0", "host0@-@1"));
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build());
         when(jobNodeStorage.getJobNodeData(ShardingNode.getInstanceNode(0))).thenReturn("host0@-@0");
         when(jobNodeStorage.getJobNodeData(ShardingNode.getInstanceNode(1))).thenReturn("host0@-@1");
         when(jobNodeStorage.getJobNodeData(ShardingNode.getInstanceNode(2))).thenReturn("host0@-@2");
@@ -229,7 +229,7 @@ public final class ShardingServiceTest {
     @Test
     public void assertHasNotShardingInfoInOfflineServers() {
         when(jobNodeStorage.getJobNodeChildrenKeys(InstanceNode.ROOT)).thenReturn(Arrays.asList("host0@-@0", "host0@-@1"));
-        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, "0/1 * * * * ?", 3).build());
+        when(configService.load(true)).thenReturn(JobConfiguration.newBuilder("test_job", JobType.SIMPLE, 3).cron("0/1 * * * * ?").build());
         when(jobNodeStorage.getJobNodeData(ShardingNode.getInstanceNode(0))).thenReturn("host0@-@0");
         when(jobNodeStorage.getJobNodeData(ShardingNode.getInstanceNode(1))).thenReturn("host0@-@1");
         when(jobNodeStorage.getJobNodeData(ShardingNode.getInstanceNode(2))).thenReturn("host0@-@0");
diff --git a/examples/elastic-job-example-lite-java/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/JavaMain.java b/examples/elastic-job-example-lite-java/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/JavaMain.java
index 225996d..cffd8c2 100644
--- a/examples/elastic-job-example-lite-java/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/JavaMain.java
+++ b/examples/elastic-job-example-lite-java/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/JavaMain.java
@@ -85,18 +85,19 @@ public final class JavaMain {
     }
     
     private static void setUpSimpleJob(final CoordinatorRegistryCenter regCenter, final TracingConfiguration tracingConfig) {
-        new ScheduleJobBootstrap(regCenter, new JavaSimpleJob(), JobConfiguration.newBuilder("javaSimpleJob", JobType.SIMPLE, "0/5 * * * * ?", 3)
-                .shardingItemParameters("0=Beijing,1=Shanghai,2=Guangzhou").build(), tracingConfig).schedule();
+        new ScheduleJobBootstrap(regCenter, new JavaSimpleJob(), JobConfiguration.newBuilder("javaSimpleJob", JobType.SIMPLE, 3)
+                .cron("0/5 * * * * ?").shardingItemParameters("0=Beijing,1=Shanghai,2=Guangzhou").build(), tracingConfig).schedule();
     }
     
     private static void setUpDataflowJob(final CoordinatorRegistryCenter regCenter, final TracingConfiguration tracingConfig) {
-        new ScheduleJobBootstrap(regCenter, new JavaDataflowJob(), JobConfiguration.newBuilder("javaDataflowElasticJob", JobType.DATAFLOW, "0/5 * * * * ?", 3)
-                .shardingItemParameters("0=Beijing,1=Shanghai,2=Guangzhou").setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build(), tracingConfig).schedule();
+        new ScheduleJobBootstrap(regCenter, new JavaDataflowJob(), JobConfiguration.newBuilder("javaDataflowElasticJob", JobType.DATAFLOW, 3)
+                .cron("0/5 * * * * ?").shardingItemParameters("0=Beijing,1=Shanghai,2=Guangzhou")
+                .setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build(), tracingConfig).schedule();
     }
     
     private static void setUpScriptJob(final CoordinatorRegistryCenter regCenter, final TracingConfiguration tracingConfig) throws IOException {
-        new ScheduleJobBootstrap(regCenter, null, JobConfiguration.newBuilder("scriptElasticJob", JobType.SCRIPT, "0/5 * * * * ?", 3)
-                .setProperty(ScriptJobExecutor.SCRIPT_KEY, buildScriptCommandLine()).build(), tracingConfig).schedule();
+        new ScheduleJobBootstrap(regCenter, null, JobConfiguration.newBuilder("scriptElasticJob", JobType.SCRIPT, 3)
+                .cron("0/5 * * * * ?").setProperty(ScriptJobExecutor.SCRIPT_KEY, buildScriptCommandLine()).build(), tracingConfig).schedule();
     }
     
     private static String buildScriptCommandLine() throws IOException {
diff --git a/examples/elastic-job-example-lite-springboot/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/config/DataflowJobConfig.java b/examples/elastic-job-example-lite-springboot/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/config/DataflowJobConfig.java
index abeaa8a..bc049f2 100644
--- a/examples/elastic-job-example-lite-springboot/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/config/DataflowJobConfig.java
+++ b/examples/elastic-job-example-lite-springboot/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/config/DataflowJobConfig.java
@@ -53,7 +53,7 @@ public class DataflowJobConfig {
     }
     
     private JobConfiguration getJobConfiguration(final Class<? extends DataflowJob> jobClass, final String cron, final int shardingTotalCount, final String shardingItemParameters) {
-        return JobConfiguration.newBuilder(jobClass.getName(), JobType.DATAFLOW, cron, shardingTotalCount)
-                .shardingItemParameters(shardingItemParameters).setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).overwrite(true).build();
+        return JobConfiguration.newBuilder(jobClass.getName(), JobType.DATAFLOW, shardingTotalCount)
+                .cron(cron).shardingItemParameters(shardingItemParameters).setProperty(DataflowJobExecutor.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).overwrite(true).build();
     }
 }
diff --git a/examples/elastic-job-example-lite-springboot/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/config/SimpleJobConfig.java b/examples/elastic-job-example-lite-springboot/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/config/SimpleJobConfig.java
index 89c0aeb..7e3f7fb 100644
--- a/examples/elastic-job-example-lite-springboot/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/config/SimpleJobConfig.java
+++ b/examples/elastic-job-example-lite-springboot/src/main/java/org/apache/shardingsphere/elasticjob/lite/example/config/SimpleJobConfig.java
@@ -51,6 +51,6 @@ public class SimpleJobConfig {
     }
     
     private JobConfiguration getJobConfiguration(final Class<? extends SimpleJob> jobClass, final String cron, final int shardingTotalCount, final String shardingItemParameters) {
-        return JobConfiguration.newBuilder(jobClass.getName(), JobType.SIMPLE, cron, shardingTotalCount).shardingItemParameters(shardingItemParameters).overwrite(true).build();
+        return JobConfiguration.newBuilder(jobClass.getName(), JobType.SIMPLE, shardingTotalCount).cron(cron).shardingItemParameters(shardingItemParameters).overwrite(true).build();
     }
 }