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/13 08:24:28 UTC
[shardingsphere-elasticjob-lite] branch master updated: Use
JobConfiguration for cloud (#1041)
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 ca1fe2c Use JobConfiguration for cloud (#1041)
ca1fe2c is described below
commit ca1fe2c3c9431eb0a32ad851ddf1c8ebe3951227
Author: Liang Zhang <te...@163.com>
AuthorDate: Mon Jul 13 16:24:17 2020 +0800
Use JobConfiguration for cloud (#1041)
* Remove useless code
* Decouple CloudJobConfiguration and JobRootConfiguration
* Remove JobRootConfiguration
* Refactor TaskExecutor
* Remove JobTypeConfiguration.jobClass
* Remove StatisticManager.getJobTypeStatistics
* Add JobCoreConfiguration.props
* Refactor CloudJobFacade
* Refactor TaskLaunchScheduledService
* Decouple job type
* remove DataflowJobConfiguration.streamingProcess and ScriptJobConfiguration.scriptCommandLine
* Refactor JobConfigurationContextTest
* Decouple job type and CloudJobFacadeTest
* Decouple job type and TaskExecutorThreadTest
* Decouple job type and JobTypeConfigurationUtil
* Remove JobType
* Remove JobTypeConfiguration
* Remove JobCoreConfiguration
* Remove CloudJobConfiguration.beanName & applicationContext
* Rename CloudJobConfiguration.coreConfig to jobConfig
---
.../elasticjob/cloud/api/JobType.java | 26 ---
.../cloud/config}/CloudJobConfiguration.java | 19 +-
.../cloud/config}/CloudJobExecutionType.java | 4 +-
.../cloud/config/JobCoreConfiguration.java | 201 ---------------------
.../cloud/config/JobRootConfiguration.java | 31 ----
.../cloud/config/JobTypeConfiguration.java | 47 -----
.../config/dataflow/DataflowJobConfiguration.java | 40 ----
.../config/script/ScriptJobConfiguration.java | 40 ----
.../config/simple/SimpleJobConfiguration.java | 38 ----
.../AbstractJobConfigurationGsonTypeAdapter.java | 109 ++++-------
.../cloud/config/JobCoreConfigurationTest.java | 80 --------
.../elasticjob/cloud/api/JobBootstrap.java | 24 ++-
.../elasticjob/cloud/executor/CloudJobFacade.java | 22 +--
.../cloud/executor/DaemonTaskScheduler.java | 4 +-
.../cloud/executor/JobConfigurationContext.java | 8 +-
.../cloud/executor/JobTypeConfigurationUtil.java | 25 +--
.../elasticjob/cloud/executor/TaskExecutor.java | 66 ++-----
.../cloud/executor/local/LocalTaskExecutor.java | 6 +-
.../cloud/executor/CloudJobFacadeTest.java | 10 +-
.../executor/JobConfigurationContextTest.java | 35 +---
.../cloud/executor/TaskExecutorTest.java | 3 +-
.../cloud/executor/TaskExecutorThreadTest.java | 18 +-
.../constants/CloudConfigurationConstants.java | 10 +-
.../job/CloudJobConfigurationGsonFactory.java | 34 ++--
.../config/job/CloudJobConfigurationListener.java | 6 +-
.../config/job/CloudJobConfigurationService.java | 1 +
.../cloud/scheduler/context/JobContext.java | 4 +-
.../scheduler/mesos/AppConstraintEvaluator.java | 2 +-
.../cloud/scheduler/mesos/FacadeService.java | 6 +-
.../cloud/scheduler/mesos/JobTaskRequest.java | 2 +-
.../cloud/scheduler/mesos/LaunchingTasks.java | 2 +-
.../cloud/scheduler/mesos/TaskInfoData.java | 26 ++-
.../mesos/TaskLaunchScheduledService.java | 21 +--
.../cloud/scheduler/producer/ProducerManager.java | 4 +-
.../producer/TransientProducerScheduler.java | 6 +-
.../scheduler/restful/CloudAppRestfulApi.java | 2 +-
.../scheduler/restful/CloudJobRestfulApi.java | 19 +-
.../scheduler/state/failover/FailoverService.java | 2 +-
.../cloud/scheduler/state/ready/ReadyService.java | 6 +-
.../scheduler/state/running/RunningService.java | 4 +-
.../scheduler/statistics/StatisticManager.java | 27 +--
.../main/resources/console/html/job/add_job.html | 20 --
.../resources/console/html/job/detail_job.html | 20 --
.../resources/console/html/job/jobs_overview.html | 1 -
.../resources/console/html/job/modify_job.html | 20 --
.../resources/console/i18n/message_en.properties | 4 -
.../resources/console/i18n/message_zh.properties | 4 -
.../resources/console/js/history/job_dashboard.js | 17 --
.../main/resources/console/js/job/job_common.js | 15 --
.../main/resources/console/js/job/jobs_overview.js | 6 -
.../job/CloudJobConfigurationListenerTest.java | 55 +++---
.../job/CloudJobConfigurationServiceTest.java | 3 +-
.../cloud/scheduler/context/JobContextTest.java | 2 +-
.../fixture/CloudJobConfigurationBuilder.java | 102 +++++------
.../scheduler/fixture/CloudJsonConstants.java | 19 +-
.../cloud/scheduler/mesos/FacadeServiceTest.java | 4 +-
.../mesos/TaskLaunchScheduledServiceTest.java | 2 +-
.../scheduler/producer/ProducerManagerTest.java | 4 +-
.../producer/TransientProducerSchedulerTest.java | 12 +-
.../scheduler/restful/CloudJobRestfulApiTest.java | 16 +-
.../scheduler/state/ready/ReadyServiceTest.java | 2 +-
.../state/running/RunningServiceTest.java | 2 +-
.../scheduler/statistics/StatisticManagerTest.java | 15 +-
.../resources/console/i18n/message_en.properties | 1 -
.../resources/console/i18n/message_zh.properties | 1 -
examples/elasticjob-example-cloud/src/README.txt | 14 +-
.../dangdang/ddframe/job/example/CloudJobMain.java | 2 +-
67 files changed, 313 insertions(+), 1090 deletions(-)
diff --git a/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/api/JobType.java b/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/api/JobType.java
deleted file mode 100755
index b44b445..0000000
--- a/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/api/JobType.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.cloud.api;
-
-/**
- * Job type.
- */
-public enum JobType {
-
- SIMPLE, DATAFLOW, SCRIPT
-}
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfiguration.java b/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/CloudJobConfiguration.java
similarity index 69%
rename from elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfiguration.java
rename to elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/CloudJobConfiguration.java
index 180dfc9..9682f02 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfiguration.java
+++ b/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/CloudJobConfiguration.java
@@ -7,7 +7,7 @@
* 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.
@@ -15,25 +15,22 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job;
+package org.apache.shardingsphere.elasticjob.cloud.config;
-import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.elasticjob.cloud.config.JobRootConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.JobTypeConfiguration;
+import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
/**
* Cloud job configuration.
*/
-@AllArgsConstructor
@RequiredArgsConstructor
@Getter
-public final class CloudJobConfiguration implements JobRootConfiguration {
+public final class CloudJobConfiguration {
private final String appName;
- private final JobTypeConfiguration typeConfig;
+ private final JobConfiguration jobConfig;
private final double cpuCount;
@@ -41,16 +38,12 @@ public final class CloudJobConfiguration implements JobRootConfiguration {
private final CloudJobExecutionType jobExecutionType;
- private String beanName;
-
- private String applicationContext;
-
/**
* Get job name.
*
* @return job name
*/
public String getJobName() {
- return typeConfig.getCoreConfig().getJobName();
+ return jobConfig.getJobName();
}
}
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobExecutionType.java b/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/CloudJobExecutionType.java
similarity index 92%
rename from elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobExecutionType.java
rename to elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/CloudJobExecutionType.java
index 85531e1..58c0b15 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobExecutionType.java
+++ b/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/CloudJobExecutionType.java
@@ -7,7 +7,7 @@
* 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.
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job;
+package org.apache.shardingsphere.elasticjob.cloud.config;
/**
* Cloud job execution type.
diff --git a/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/JobCoreConfiguration.java b/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/JobCoreConfiguration.java
deleted file mode 100755
index 6e4a0a1..0000000
--- a/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/JobCoreConfiguration.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * 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.cloud.config;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-import lombok.AccessLevel;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-/**
- * Job core configuration.
- */
-@AllArgsConstructor(access = AccessLevel.PRIVATE)
-@Getter
-public final class JobCoreConfiguration {
-
- private final String jobName;
-
- private final String cron;
-
- private final int shardingTotalCount;
-
- private final String shardingItemParameters;
-
- private final String jobParameter;
-
- private final boolean failover;
-
- private final boolean misfire;
-
- private final String jobExecutorServiceHandlerType;
-
- private final String jobErrorHandlerType;
-
- private final String description;
-
- /**
- * Create simple job configuration builder.
- *
- * @param jobName job name
- * @param cron cron expression for job trigger
- * @param shardingTotalCount sharding total count
- * @return simple job configuration builder
- */
- public static Builder newBuilder(final String jobName, final String cron, final int shardingTotalCount) {
- return new Builder(jobName, cron, shardingTotalCount);
- }
-
- @RequiredArgsConstructor(access = AccessLevel.PRIVATE)
- public static class Builder {
-
- private final String jobName;
-
- private final String cron;
-
- private final int shardingTotalCount;
-
- private String shardingItemParameters = "";
-
- private String jobParameter = "";
-
- private boolean failover;
-
- private boolean misfire = true;
-
- private String jobExecutorServiceHandlerType;
-
- private String jobErrorHandlerType;
-
- private String description = "";
-
- /**
- * Set mapper of sharding items and sharding parameters.
- *
- * <p>
- * sharding item and sharding parameter split by =, multiple sharding items and sharding parameters split by comma, just like map.
- * Sharding item start from zero, cannot equal to great than sharding total count.
- *
- * For example:
- * 0=a,1=b,2=c
- * </p>
- *
- * @param shardingItemParameters mapper of sharding items and sharding parameters
- *
- * @return job configuration builder
- */
- public Builder shardingItemParameters(final String shardingItemParameters) {
- if (null != shardingItemParameters) {
- this.shardingItemParameters = shardingItemParameters;
- }
- return this;
- }
-
- /**
- * Set job parameter.
- *
- * @param jobParameter job parameter
- *
- * @return job configuration builder
- */
- public Builder jobParameter(final String jobParameter) {
- if (null != jobParameter) {
- this.jobParameter = jobParameter;
- }
- return this;
- }
-
- /**
- * Set enable failover.
- *
- * <p>
- * Only for `monitorExecution` enabled.
- * </p>
- *
- * @param failover enable or disable failover
- *
- * @return job configuration builder
- */
- public Builder failover(final boolean failover) {
- this.failover = failover;
- return this;
- }
-
- /**
- * Set enable misfire.
- *
- * @param misfire enable or disable misfire
- *
- * @return job configuration builder
- */
- public Builder misfire(final boolean misfire) {
- this.misfire = misfire;
- return this;
- }
-
- /**
- * Set job executor service handler type.
- *
- * @param jobExecutorServiceHandlerType job executor service handler type
- * @return job configuration builder
- */
- public Builder jobExecutorServiceHandlerType(final String jobExecutorServiceHandlerType) {
- this.jobExecutorServiceHandlerType = jobExecutorServiceHandlerType;
- return this;
- }
-
- /**
- * Set job error handler type.
- *
- * @param jobErrorHandlerType job error handler type
- * @return job configuration builder
- */
- public Builder jobErrorHandlerType(final String jobErrorHandlerType) {
- this.jobErrorHandlerType = jobErrorHandlerType;
- return this;
- }
-
- /**
- * Set job description.
- *
- * @param description job description
- *
- * @return job configuration builder
- */
- public Builder description(final String description) {
- if (null != description) {
- this.description = description;
- }
- return this;
- }
-
- /**
- * Build Job.
- *
- * @return job configuration builder
- */
- public final JobCoreConfiguration build() {
- Preconditions.checkArgument(!Strings.isNullOrEmpty(jobName), "jobName can not be empty.");
- Preconditions.checkArgument(shardingTotalCount > 0, "shardingTotalCount should larger than zero.");
- return new JobCoreConfiguration(
- jobName, cron, shardingTotalCount, shardingItemParameters, jobParameter, failover, misfire, jobExecutorServiceHandlerType, jobErrorHandlerType, description);
- }
- }
-}
diff --git a/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/JobRootConfiguration.java b/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/JobRootConfiguration.java
deleted file mode 100755
index ff3ae8e..0000000
--- a/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/JobRootConfiguration.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.cloud.config;
-
-/**
- * Job root configuration.
- */
-public interface JobRootConfiguration {
-
- /**
- * Get type Configuration.
- *
- * @return Job type configuration
- */
- JobTypeConfiguration getTypeConfig();
-}
diff --git a/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/JobTypeConfiguration.java b/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/JobTypeConfiguration.java
deleted file mode 100755
index af4bc4b..0000000
--- a/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/JobTypeConfiguration.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.cloud.config;
-
-import org.apache.shardingsphere.elasticjob.cloud.api.JobType;
-
-/**
- * Job type configuration.
- */
-public interface JobTypeConfiguration {
-
- /**
- * Get job type.
- *
- * @return job type
- */
- JobType getJobType();
-
- /**
- * Get job class name.
- *
- * @return job class name
- */
- String getJobClass();
-
- /**
- * Get job core configuration.
- *
- * @return job core configuration
- */
- JobCoreConfiguration getCoreConfig();
-}
diff --git a/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/dataflow/DataflowJobConfiguration.java b/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/dataflow/DataflowJobConfiguration.java
deleted file mode 100755
index 04aa42c..0000000
--- a/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/dataflow/DataflowJobConfiguration.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.cloud.config.dataflow;
-
-import org.apache.shardingsphere.elasticjob.cloud.api.JobType;
-import org.apache.shardingsphere.elasticjob.cloud.config.JobCoreConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.JobTypeConfiguration;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-/**
- * Dataflow job configuration.
- */
-@RequiredArgsConstructor
-@Getter
-public final class DataflowJobConfiguration implements JobTypeConfiguration {
-
- private final JobCoreConfiguration coreConfig;
-
- private final JobType jobType = JobType.DATAFLOW;
-
- private final String jobClass;
-
- private final boolean streamingProcess;
-}
diff --git a/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/script/ScriptJobConfiguration.java b/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/script/ScriptJobConfiguration.java
deleted file mode 100755
index 7ce6448..0000000
--- a/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/script/ScriptJobConfiguration.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.cloud.config.script;
-
-import org.apache.shardingsphere.elasticjob.cloud.api.JobType;
-import org.apache.shardingsphere.elasticjob.cloud.config.JobTypeConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.JobCoreConfiguration;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-/**
- * Script job configuration.
- */
-@RequiredArgsConstructor
-@Getter
-public final class ScriptJobConfiguration implements JobTypeConfiguration {
-
- private final JobCoreConfiguration coreConfig;
-
- private final JobType jobType = JobType.SCRIPT;
-
- private final String jobClass = "SCRIPT";
-
- private final String scriptCommandLine;
-}
diff --git a/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/simple/SimpleJobConfiguration.java b/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/simple/SimpleJobConfiguration.java
deleted file mode 100755
index 856bd35..0000000
--- a/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/config/simple/SimpleJobConfiguration.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.cloud.config.simple;
-
-import org.apache.shardingsphere.elasticjob.cloud.api.JobType;
-import org.apache.shardingsphere.elasticjob.cloud.config.JobCoreConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.JobTypeConfiguration;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-/**
- * Simple job configuration.
- */
-@RequiredArgsConstructor
-@Getter
-public final class SimpleJobConfiguration implements JobTypeConfiguration {
-
- private final JobCoreConfiguration coreConfig;
-
- private final JobType jobType = JobType.SIMPLE;
-
- private final String jobClass;
-}
diff --git a/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/util/json/AbstractJobConfigurationGsonTypeAdapter.java b/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/util/json/AbstractJobConfigurationGsonTypeAdapter.java
index 2aee317..f28f24d 100755
--- a/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/util/json/AbstractJobConfigurationGsonTypeAdapter.java
+++ b/elasticjob-cloud/elasticjob-cloud-common/src/main/java/org/apache/shardingsphere/elasticjob/cloud/util/json/AbstractJobConfigurationGsonTypeAdapter.java
@@ -17,18 +17,14 @@
package org.apache.shardingsphere.elasticjob.cloud.util.json;
-import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
-import org.apache.shardingsphere.elasticjob.cloud.api.JobType;
-import org.apache.shardingsphere.elasticjob.cloud.config.JobCoreConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.JobRootConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.JobTypeConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.dataflow.DataflowJobConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.script.ScriptJobConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.simple.SimpleJobConfiguration;
+import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.dataflow.props.DataflowJobProperties;
+import org.apache.shardingsphere.elasticjob.script.props.ScriptJobProperties;
import java.io.IOException;
import java.util.HashMap;
@@ -36,13 +32,11 @@ import java.util.Map;
/**
* Job configuration gson type adapter.
- *
- * @param <T> type of job root configuration
*/
-public abstract class AbstractJobConfigurationGsonTypeAdapter<T extends JobRootConfiguration> extends TypeAdapter<T> {
+public abstract class AbstractJobConfigurationGsonTypeAdapter extends TypeAdapter<CloudJobConfiguration> {
@Override
- public T read(final JsonReader in) throws IOException {
+ public CloudJobConfiguration read(final JsonReader in) throws IOException {
String jobName = "";
String cron = "";
int shardingTotalCount = 0;
@@ -53,10 +47,8 @@ public abstract class AbstractJobConfigurationGsonTypeAdapter<T extends JobRootC
String jobExecutorServiceHandlerType = "";
String jobErrorHandlerType = "";
String description = "";
- JobType jobType = null;
- String jobClass = "";
- boolean streamingProcess = false;
- String scriptCommandLine = "";
+ Boolean streamingProcess = null;
+ String scriptCommandLine = null;
Map<String, Object> customizedValueMap = new HashMap<>(32, 1);
in.beginObject();
while (in.hasNext()) {
@@ -92,12 +84,6 @@ public abstract class AbstractJobConfigurationGsonTypeAdapter<T extends JobRootC
case "description":
description = in.nextString();
break;
- case "jobType":
- jobType = JobType.valueOf(in.nextString());
- break;
- case "jobClass":
- jobClass = in.nextString();
- break;
case "streamingProcess":
streamingProcess = in.nextBoolean();
break;
@@ -110,71 +96,56 @@ public abstract class AbstractJobConfigurationGsonTypeAdapter<T extends JobRootC
}
}
in.endObject();
- JobCoreConfiguration coreConfig = getJobCoreConfiguration(jobName, cron, shardingTotalCount, shardingItemParameters,
+ JobConfiguration jobConfig = getJobConfiguration(jobName, cron, shardingTotalCount, shardingItemParameters,
jobParameter, failover, misfire, jobExecutorServiceHandlerType, jobErrorHandlerType, description);
- JobTypeConfiguration typeConfig = getJobTypeConfiguration(coreConfig, jobType, jobClass, streamingProcess, scriptCommandLine);
- return getJobRootConfiguration(typeConfig, customizedValueMap);
+ if (null != streamingProcess) {
+ jobConfig.getProps().setProperty(DataflowJobProperties.STREAM_PROCESS_KEY, Boolean.toString(streamingProcess));
+ }
+ if (null != scriptCommandLine) {
+ jobConfig.getProps().setProperty(ScriptJobProperties.SCRIPT_KEY, scriptCommandLine);
+ }
+ return getJobRootConfiguration(jobConfig, customizedValueMap);
}
protected abstract void addToCustomizedValueMap(String jsonName, JsonReader in, Map<String, Object> customizedValueMap) throws IOException;
- private JobCoreConfiguration getJobCoreConfiguration(final String jobName, final String cron, final int shardingTotalCount,
- final String shardingItemParameters, final String jobParameter, final boolean failover, final boolean misfire,
- final String jobExecutorServiceHandlerType, final String jobErrorHandlerType, final String description) {
- return JobCoreConfiguration.newBuilder(jobName, cron, shardingTotalCount)
+ private JobConfiguration getJobConfiguration(final String jobName, final String cron, final int shardingTotalCount,
+ final String shardingItemParameters, final String jobParameter, final boolean failover, final boolean misfire,
+ final String jobExecutorServiceHandlerType, final String jobErrorHandlerType, final String description) {
+ return JobConfiguration.newBuilder(jobName, shardingTotalCount).cron(cron)
.shardingItemParameters(shardingItemParameters).jobParameter(jobParameter).failover(failover).misfire(misfire)
.jobExecutorServiceHandlerType(jobExecutorServiceHandlerType).jobErrorHandlerType(jobErrorHandlerType).description(description)
.build();
}
- private JobTypeConfiguration getJobTypeConfiguration(
- final JobCoreConfiguration coreConfig, final JobType jobType, final String jobClass, final boolean streamingProcess, final String scriptCommandLine) {
- Preconditions.checkNotNull(jobType, "jobType cannot be null.");
- switch (jobType) {
- case SIMPLE:
- Preconditions.checkArgument(!Strings.isNullOrEmpty(jobClass), "jobClass cannot be empty.");
- return new SimpleJobConfiguration(coreConfig, jobClass);
- case DATAFLOW:
- Preconditions.checkArgument(!Strings.isNullOrEmpty(jobClass), "jobClass cannot be empty.");
- return new DataflowJobConfiguration(coreConfig, jobClass, streamingProcess);
- case SCRIPT:
- return new ScriptJobConfiguration(coreConfig, scriptCommandLine);
- default:
- throw new UnsupportedOperationException(String.valueOf(jobType));
- }
- }
-
- protected abstract T getJobRootConfiguration(JobTypeConfiguration typeConfig, Map<String, Object> customizedValueMap);
+ protected abstract CloudJobConfiguration getJobRootConfiguration(JobConfiguration jobConfig, Map<String, Object> customizedValueMap);
@Override
- public void write(final JsonWriter out, final T value) throws IOException {
+ public void write(final JsonWriter out, final CloudJobConfiguration value) throws IOException {
out.beginObject();
- out.name("jobName").value(value.getTypeConfig().getCoreConfig().getJobName());
- out.name("jobClass").value(value.getTypeConfig().getJobClass());
- out.name("jobType").value(value.getTypeConfig().getJobType().name());
- out.name("cron").value(value.getTypeConfig().getCoreConfig().getCron());
- out.name("shardingTotalCount").value(value.getTypeConfig().getCoreConfig().getShardingTotalCount());
- out.name("shardingItemParameters").value(value.getTypeConfig().getCoreConfig().getShardingItemParameters());
- out.name("jobParameter").value(value.getTypeConfig().getCoreConfig().getJobParameter());
- out.name("failover").value(value.getTypeConfig().getCoreConfig().isFailover());
- out.name("misfire").value(value.getTypeConfig().getCoreConfig().isMisfire());
- if (!Strings.isNullOrEmpty(value.getTypeConfig().getCoreConfig().getJobExecutorServiceHandlerType())) {
- out.name("executorServiceHandler").value(value.getTypeConfig().getCoreConfig().getJobExecutorServiceHandlerType());
+ out.name("jobName").value(value.getJobConfig().getJobName());
+ out.name("cron").value(value.getJobConfig().getCron());
+ out.name("shardingTotalCount").value(value.getJobConfig().getShardingTotalCount());
+ out.name("shardingItemParameters").value(value.getJobConfig().getShardingItemParameters());
+ out.name("jobParameter").value(value.getJobConfig().getJobParameter());
+ out.name("failover").value(value.getJobConfig().isFailover());
+ out.name("misfire").value(value.getJobConfig().isMisfire());
+ if (!Strings.isNullOrEmpty(value.getJobConfig().getJobExecutorServiceHandlerType())) {
+ out.name("executorServiceHandler").value(value.getJobConfig().getJobExecutorServiceHandlerType());
+ }
+ if (!Strings.isNullOrEmpty(value.getJobConfig().getJobErrorHandlerType())) {
+ out.name("jobExceptionHandler").value(value.getJobConfig().getJobErrorHandlerType());
}
- if (!Strings.isNullOrEmpty(value.getTypeConfig().getCoreConfig().getJobErrorHandlerType())) {
- out.name("jobExceptionHandler").value(value.getTypeConfig().getCoreConfig().getJobErrorHandlerType());
+ out.name("description").value(value.getJobConfig().getDescription());
+ if (value.getJobConfig().getProps().containsKey(DataflowJobProperties.STREAM_PROCESS_KEY)) {
+ out.name("streamingProcess").value(value.getJobConfig().getProps().getProperty(DataflowJobProperties.STREAM_PROCESS_KEY));
}
- out.name("description").value(value.getTypeConfig().getCoreConfig().getDescription());
- if (value.getTypeConfig().getJobType() == JobType.DATAFLOW) {
- DataflowJobConfiguration dataflowJobConfig = (DataflowJobConfiguration) value.getTypeConfig();
- out.name("streamingProcess").value(dataflowJobConfig.isStreamingProcess());
- } else if (value.getTypeConfig().getJobType() == JobType.SCRIPT) {
- ScriptJobConfiguration scriptJobConfig = (ScriptJobConfiguration) value.getTypeConfig();
- out.name("scriptCommandLine").value(scriptJobConfig.getScriptCommandLine());
+ if (value.getJobConfig().getProps().containsKey(ScriptJobProperties.SCRIPT_KEY)) {
+ out.name("scriptCommandLine").value(value.getJobConfig().getProps().getProperty(ScriptJobProperties.SCRIPT_KEY));
}
writeCustomized(out, value);
out.endObject();
}
- protected abstract void writeCustomized(JsonWriter out, T value) throws IOException;
+ protected abstract void writeCustomized(JsonWriter out, CloudJobConfiguration value) throws IOException;
}
diff --git a/elasticjob-cloud/elasticjob-cloud-common/src/test/java/org/apache/shardingsphere/elasticjob/cloud/config/JobCoreConfigurationTest.java b/elasticjob-cloud/elasticjob-cloud-common/src/test/java/org/apache/shardingsphere/elasticjob/cloud/config/JobCoreConfigurationTest.java
deleted file mode 100755
index e31e27f..0000000
--- a/elasticjob-cloud/elasticjob-cloud-common/src/test/java/org/apache/shardingsphere/elasticjob/cloud/config/JobCoreConfigurationTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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.cloud.config;
-
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
-public final class JobCoreConfigurationTest {
-
- @Test
- public void assertBuildAllProperties() {
- JobCoreConfiguration actual = JobCoreConfiguration.newBuilder("test_job", "0/1 * * * * ?", 3)
- .shardingItemParameters("0=a,1=b,2=c").jobParameter("param").failover(true).misfire(false).description("desc").jobErrorHandlerType("IGNORE").build();
- assertRequiredProperties(actual);
- assertThat(actual.getShardingItemParameters(), is("0=a,1=b,2=c"));
- assertThat(actual.getJobParameter(), is("param"));
- assertTrue(actual.isFailover());
- assertFalse(actual.isMisfire());
- assertThat(actual.getDescription(), is("desc"));
- assertThat(actual.getJobErrorHandlerType(), is("IGNORE"));
- }
-
- @Test
- public void assertBuildRequiredProperties() {
- JobCoreConfiguration actual = JobCoreConfiguration.newBuilder("test_job", "0/1 * * * * ?", 3).build();
- assertRequiredProperties(actual);
- assertDefaultValues(actual);
- }
-
- @Test
- public void assertBuildWhenOptionalParametersIsNull() {
- //noinspection NullArgumentToVariableArgMethod
- JobCoreConfiguration actual = JobCoreConfiguration.newBuilder("test_job", "0/1 * * * * ?", 3).shardingItemParameters(null).jobParameter(null).description(null).build();
- assertRequiredProperties(actual);
- assertDefaultValues(actual);
- }
-
- private void assertRequiredProperties(final JobCoreConfiguration actual) {
- assertThat(actual.getJobName(), is("test_job"));
- assertThat(actual.getCron(), is("0/1 * * * * ?"));
- assertThat(actual.getShardingTotalCount(), is(3));
- }
-
- private void assertDefaultValues(final JobCoreConfiguration actual) {
- assertThat(actual.getShardingItemParameters(), is(""));
- assertThat(actual.getJobParameter(), is(""));
- assertFalse(actual.isFailover());
- assertTrue(actual.isMisfire());
- assertThat(actual.getDescription(), is(""));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void assertBuildWhenJobNameIsNull() {
- JobCoreConfiguration.newBuilder(null, "0/1 * * * * ?", 3).build();
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void assertBuildWhenTotalSHardingCountIsNegative() {
- JobCoreConfiguration.newBuilder(null, "0/1 * * * * ?", -1).build();
- }
-}
diff --git a/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/api/JobBootstrap.java b/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/api/JobBootstrap.java
index cf09778..fff00e7 100755
--- a/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/api/JobBootstrap.java
+++ b/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/api/JobBootstrap.java
@@ -17,11 +17,12 @@
package org.apache.shardingsphere.elasticjob.cloud.api;
-import org.apache.shardingsphere.elasticjob.cloud.executor.TaskExecutor;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.mesos.MesosExecutorDriver;
import org.apache.mesos.Protos;
+import org.apache.shardingsphere.elasticjob.api.ElasticJob;
+import org.apache.shardingsphere.elasticjob.cloud.executor.TaskExecutor;
/**
* Job bootstrap.
@@ -31,9 +32,24 @@ public final class JobBootstrap {
/**
* Execute.
+ *
+ * @param elasticJob elastic job
*/
- public static void execute() {
- MesosExecutorDriver driver = new MesosExecutorDriver(new TaskExecutor());
- System.exit(Protos.Status.DRIVER_STOPPED == driver.run() ? 0 : -1);
+ public static void execute(final ElasticJob elasticJob) {
+ execute(new TaskExecutor(elasticJob));
+ }
+
+ /**
+ * Execute.
+ *
+ * @param elasticJobType elastic job type
+ */
+ public static void execute(final String elasticJobType) {
+ execute(new TaskExecutor(elasticJobType));
}
+
+ private static void execute(final TaskExecutor taskExecutor) {
+ MesosExecutorDriver driver = new MesosExecutorDriver(taskExecutor);
+ System.exit(Protos.Status.DRIVER_STOPPED == driver.run() ? 0 : -1);
+ }
}
diff --git a/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/CloudJobFacade.java b/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/CloudJobFacade.java
index 10161e4..be353fe 100755
--- a/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/CloudJobFacade.java
+++ b/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/CloudJobFacade.java
@@ -20,10 +20,6 @@ package org.apache.shardingsphere.elasticjob.cloud.executor;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
import org.apache.shardingsphere.elasticjob.api.listener.ShardingContexts;
-import org.apache.shardingsphere.elasticjob.cloud.api.JobType;
-import org.apache.shardingsphere.elasticjob.cloud.config.JobTypeConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.dataflow.DataflowJobConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.script.ScriptJobConfiguration;
import org.apache.shardingsphere.elasticjob.executor.JobFacade;
import org.apache.shardingsphere.elasticjob.infra.context.TaskContext;
import org.apache.shardingsphere.elasticjob.tracing.JobEventBus;
@@ -42,22 +38,18 @@ public final class CloudJobFacade implements JobFacade {
private final ShardingContexts shardingContexts;
- private final JobTypeConfiguration jobConfig;
+ private final JobConfiguration jobConfig;
private final JobEventBus jobEventBus;
@Override
public JobConfiguration loadJobConfiguration(final boolean fromCache) {
- JobConfiguration result = JobConfiguration.newBuilder(jobConfig.getCoreConfig().getJobName(), jobConfig.getCoreConfig().getShardingTotalCount())
- .cron(jobConfig.getCoreConfig().getCron()).shardingItemParameters(jobConfig.getCoreConfig().getShardingItemParameters()).jobParameter(jobConfig.getCoreConfig().getJobParameter())
- .failover(jobConfig.getCoreConfig().isFailover()).misfire(jobConfig.getCoreConfig().isMisfire()).description(jobConfig.getCoreConfig().getDescription())
- .jobExecutorServiceHandlerType(jobConfig.getCoreConfig().getJobExecutorServiceHandlerType())
- .jobErrorHandlerType(jobConfig.getCoreConfig().getJobErrorHandlerType()).build();
- if (JobType.DATAFLOW == jobConfig.getJobType()) {
- result.getProps().setProperty("streaming.process", Boolean.toString(((DataflowJobConfiguration) jobConfig).isStreamingProcess()));
- } else if (JobType.SCRIPT == jobConfig.getJobType()) {
- result.getProps().setProperty("script.command.line", ((ScriptJobConfiguration) jobConfig).getScriptCommandLine());
- }
+ JobConfiguration result = JobConfiguration.newBuilder(jobConfig.getJobName(), jobConfig.getShardingTotalCount())
+ .cron(jobConfig.getCron()).shardingItemParameters(jobConfig.getShardingItemParameters()).jobParameter(jobConfig.getJobParameter())
+ .failover(jobConfig.isFailover()).misfire(jobConfig.isMisfire()).description(jobConfig.getDescription())
+ .jobExecutorServiceHandlerType(jobConfig.getJobExecutorServiceHandlerType())
+ .jobErrorHandlerType(jobConfig.getJobErrorHandlerType()).build();
+ result.getProps().putAll(jobConfig.getProps());
return result;
}
diff --git a/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/DaemonTaskScheduler.java b/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/DaemonTaskScheduler.java
index eed5e4f..d038f2b 100755
--- a/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/DaemonTaskScheduler.java
+++ b/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/DaemonTaskScheduler.java
@@ -22,8 +22,8 @@ import lombok.Setter;
import org.apache.mesos.ExecutorDriver;
import org.apache.mesos.Protos;
import org.apache.shardingsphere.elasticjob.api.ElasticJob;
+import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
import org.apache.shardingsphere.elasticjob.api.listener.ShardingContexts;
-import org.apache.shardingsphere.elasticjob.cloud.config.JobCoreConfiguration;
import org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor;
import org.apache.shardingsphere.elasticjob.executor.JobFacade;
import org.apache.shardingsphere.elasticjob.infra.exception.JobSystemException;
@@ -64,7 +64,7 @@ public final class DaemonTaskScheduler {
private final String elasticJobType;
- private final JobCoreConfiguration jobConfig;
+ private final JobConfiguration jobConfig;
private final JobFacade jobFacade;
diff --git a/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/JobConfigurationContext.java b/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/JobConfigurationContext.java
index 21990e2..beb51a0 100755
--- a/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/JobConfigurationContext.java
+++ b/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/JobConfigurationContext.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.elasticjob.cloud.executor;
import com.google.common.base.Strings;
import lombok.Getter;
-import org.apache.shardingsphere.elasticjob.cloud.config.JobTypeConfiguration;
+import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
import java.util.Map;
@@ -29,7 +29,7 @@ import java.util.Map;
@Getter
public final class JobConfigurationContext {
- private final JobTypeConfiguration typeConfig;
+ private final JobConfiguration jobConfig;
private final String beanName;
@@ -38,9 +38,9 @@ public final class JobConfigurationContext {
private final boolean isTransient;
public JobConfigurationContext(final Map<String, String> jobConfigurationMap) {
- typeConfig = JobTypeConfigurationUtil.createJobConfigurationContext(jobConfigurationMap);
+ jobConfig = JobTypeConfigurationUtil.createJobConfigurationContext(jobConfigurationMap);
beanName = jobConfigurationMap.get("beanName");
applicationContext = jobConfigurationMap.get("applicationContext");
- isTransient = Strings.isNullOrEmpty(typeConfig.getCoreConfig().getCron());
+ isTransient = Strings.isNullOrEmpty(jobConfig.getCron());
}
}
diff --git a/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/JobTypeConfigurationUtil.java b/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/JobTypeConfigurationUtil.java
index 626acb8..4339841 100644
--- a/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/JobTypeConfigurationUtil.java
+++ b/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/JobTypeConfigurationUtil.java
@@ -19,12 +19,9 @@ package org.apache.shardingsphere.elasticjob.cloud.executor;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
-import org.apache.shardingsphere.elasticjob.cloud.api.JobType;
-import org.apache.shardingsphere.elasticjob.cloud.config.JobCoreConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.JobTypeConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.dataflow.DataflowJobConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.script.ScriptJobConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.simple.SimpleJobConfiguration;
+import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
+import org.apache.shardingsphere.elasticjob.dataflow.props.DataflowJobProperties;
+import org.apache.shardingsphere.elasticjob.script.props.ScriptJobProperties;
import java.util.Map;
@@ -39,20 +36,18 @@ public final class JobTypeConfigurationUtil {
* @param jobConfigurationMap job configuration map
* @return job type configuration
*/
- public static JobTypeConfiguration createJobConfigurationContext(final Map<String, String> jobConfigurationMap) {
+ public static JobConfiguration createJobConfigurationContext(final Map<String, String> jobConfigurationMap) {
int ignoredShardingTotalCount = 1;
- String jobClass = jobConfigurationMap.get("jobClass");
- String jobType = jobConfigurationMap.get("jobType");
String jobName = jobConfigurationMap.get("jobName");
String cron = jobConfigurationMap.get("cron");
Preconditions.checkArgument(!Strings.isNullOrEmpty(jobName), "jobName can not be empty.");
- JobCoreConfiguration jobCoreConfig = JobCoreConfiguration.newBuilder(jobName, cron, ignoredShardingTotalCount)
+ JobConfiguration result = JobConfiguration.newBuilder(jobName, ignoredShardingTotalCount).cron(cron)
.jobExecutorServiceHandlerType(jobConfigurationMap.get("executorServiceHandler")).jobErrorHandlerType(jobConfigurationMap.get("jobExceptionHandler")).build();
- if (JobType.DATAFLOW.name().equals(jobType)) {
- return new DataflowJobConfiguration(jobCoreConfig, jobClass, Boolean.valueOf(jobConfigurationMap.get("streamingProcess")));
- } else if (JobType.SCRIPT.name().equals(jobType)) {
- return new ScriptJobConfiguration(jobCoreConfig, jobConfigurationMap.get("scriptCommandLine"));
+ if (jobConfigurationMap.containsKey("streamingProcess")) {
+ result.getProps().setProperty(DataflowJobProperties.STREAM_PROCESS_KEY, jobConfigurationMap.get("streamingProcess"));
+ } else if (jobConfigurationMap.containsKey("scriptCommandLine")) {
+ result.getProps().setProperty(ScriptJobProperties.SCRIPT_KEY, jobConfigurationMap.get("scriptCommandLine"));
}
- return new SimpleJobConfiguration(jobCoreConfig, jobClass);
+ return result;
}
}
diff --git a/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/TaskExecutor.java b/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/TaskExecutor.java
index 6323a03..ae76891 100755
--- a/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/TaskExecutor.java
+++ b/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/TaskExecutor.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.elasticjob.cloud.executor;
-import com.google.common.base.Strings;
+import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.dbcp.BasicDataSource;
@@ -29,32 +29,37 @@ import org.apache.mesos.Protos.TaskInfo;
import org.apache.shardingsphere.elasticjob.api.ElasticJob;
import org.apache.shardingsphere.elasticjob.api.listener.ShardingContexts;
import org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor;
+import org.apache.shardingsphere.elasticjob.executor.JobFacade;
import org.apache.shardingsphere.elasticjob.infra.concurrent.ElasticJobExecutorService;
import org.apache.shardingsphere.elasticjob.infra.exception.ExceptionUtils;
-import org.apache.shardingsphere.elasticjob.infra.exception.JobSystemException;
import org.apache.shardingsphere.elasticjob.tracing.JobEventBus;
import org.apache.shardingsphere.elasticjob.tracing.api.TracingConfiguration;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
import javax.sql.DataSource;
-import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
/**
* Task executor.
*/
+@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
@Slf4j
public final class TaskExecutor implements Executor {
- private final ExecutorService executorService;
+ private final ElasticJob elasticJob;
- private final Map<String, ClassPathXmlApplicationContext> applicationContexts = new HashMap<>();
+ private final String elasticJobType;
+
+ private final ExecutorService executorService = new ElasticJobExecutorService("cloud-task-executor", Runtime.getRuntime().availableProcessors() * 100).createExecutorService();
private volatile JobEventBus jobEventBus = new JobEventBus();
- public TaskExecutor() {
- executorService = new ElasticJobExecutorService("cloud-task-executor", Runtime.getRuntime().availableProcessors() * 100).createExecutorService();
+ public TaskExecutor(final ElasticJob elasticJob) {
+ this(elasticJob, null);
+ }
+
+ public TaskExecutor(final String elasticJobType) {
+ this(null, elasticJobType);
}
@Override
@@ -122,57 +127,26 @@ public final class TaskExecutor implements Executor {
@SuppressWarnings("unchecked")
JobConfigurationContext jobConfig = new JobConfigurationContext((Map<String, String>) data.get("jobConfigContext"));
try {
- ElasticJob elasticJob = getElasticJobInstance(jobConfig);
- final CloudJobFacade jobFacade = new CloudJobFacade(shardingContexts, jobConfig.getTypeConfig(), jobEventBus);
+ JobFacade jobFacade = new CloudJobFacade(shardingContexts, jobConfig.getJobConfig(), jobEventBus);
if (jobConfig.isTransient()) {
- if (null == elasticJob) {
- new ElasticJobExecutor(jobConfig.getTypeConfig().getJobClass(), jobFacade.loadJobConfiguration(true), jobFacade).execute();
- } else {
- new ElasticJobExecutor(elasticJob, jobFacade.loadJobConfiguration(true), jobFacade).execute();
- }
-
+ createElasticJobExecutor(jobFacade).execute();
executorDriver.sendStatusUpdate(Protos.TaskStatus.newBuilder().setTaskId(taskInfo.getTaskId()).setState(Protos.TaskState.TASK_FINISHED).build());
} else {
- new DaemonTaskScheduler(elasticJob, jobConfig.getTypeConfig().getJobClass(), jobConfig.getTypeConfig().getCoreConfig(), jobFacade, executorDriver, taskInfo.getTaskId()).init();
+ new DaemonTaskScheduler(elasticJob, elasticJobType, jobConfig.getJobConfig(), jobFacade, executorDriver, taskInfo.getTaskId()).init();
}
// CHECKSTYLE:OFF
} catch (final Throwable ex) {
// CHECKSTYLE:ON
- log.error("ElasticJob Cloud Executor error", ex);
+ log.error("ElasticJob Cloud Executor error:", ex);
executorDriver.sendStatusUpdate(Protos.TaskStatus.newBuilder().setTaskId(taskInfo.getTaskId()).setState(Protos.TaskState.TASK_ERROR).setMessage(ExceptionUtils.transform(ex)).build());
executorDriver.stop();
throw ex;
}
}
- private ElasticJob getElasticJobInstance(final JobConfigurationContext jobConfig) {
- if (!Strings.isNullOrEmpty(jobConfig.getBeanName()) && !Strings.isNullOrEmpty(jobConfig.getApplicationContext())) {
- return getElasticJobBean(jobConfig);
- }
- return getElasticJobClass(jobConfig);
- }
-
- private ElasticJob getElasticJobBean(final JobConfigurationContext jobConfig) {
- String applicationContextFile = jobConfig.getApplicationContext();
- if (null == applicationContexts.get(applicationContextFile)) {
- synchronized (applicationContexts) {
- applicationContexts.computeIfAbsent(applicationContextFile, ClassPathXmlApplicationContext::new);
- }
- }
- return (ElasticJob) applicationContexts.get(applicationContextFile).getBean(jobConfig.getBeanName());
- }
-
- private ElasticJob getElasticJobClass(final JobConfigurationContext jobConfig) {
- String jobClass = jobConfig.getTypeConfig().getJobClass();
- try {
- Class<?> elasticJobClass = Class.forName(jobClass);
- if (!ElasticJob.class.isAssignableFrom(elasticJobClass)) {
- throw new JobSystemException("ElasticJob: Class '%s' must implements ElasticJob interface.", jobClass);
- }
- return (ElasticJob) elasticJobClass.newInstance();
- } catch (final ReflectiveOperationException ex) {
- return null;
- }
+ private ElasticJobExecutor createElasticJobExecutor(final JobFacade jobFacade) {
+ return null == elasticJob
+ ? new ElasticJobExecutor(elasticJobType, jobFacade.loadJobConfiguration(true), jobFacade) : new ElasticJobExecutor(elasticJob, jobFacade.loadJobConfiguration(true), jobFacade);
}
}
}
diff --git a/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/local/LocalTaskExecutor.java b/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/local/LocalTaskExecutor.java
index 86402b9..9af4c64 100755
--- a/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/local/LocalTaskExecutor.java
+++ b/elasticjob-cloud/elasticjob-cloud-executor/src/main/java/org/apache/shardingsphere/elasticjob/cloud/executor/local/LocalTaskExecutor.java
@@ -23,7 +23,6 @@ import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.elasticjob.api.ElasticJob;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
import org.apache.shardingsphere.elasticjob.api.listener.ShardingContexts;
-import org.apache.shardingsphere.elasticjob.cloud.config.JobTypeConfiguration;
import org.apache.shardingsphere.elasticjob.cloud.executor.CloudJobFacade;
import org.apache.shardingsphere.elasticjob.cloud.executor.JobTypeConfigurationUtil;
import org.apache.shardingsphere.elasticjob.cloud.util.config.ShardingItemParameters;
@@ -59,9 +58,8 @@ public final class LocalTaskExecutor {
/**
* Execute job.
*/
- @SuppressWarnings("unchecked")
public void execute() {
- createElasticJobExecutor(new CloudJobFacade(getShardingContexts(), getJobTypeConfiguration(), new JobEventBus())).execute();
+ createElasticJobExecutor(new CloudJobFacade(getShardingContexts(), getJobConfiguration(), new JobEventBus())).execute();
}
private ElasticJobExecutor createElasticJobExecutor(final JobFacade jobFacade) {
@@ -77,7 +75,7 @@ public final class LocalTaskExecutor {
jobConfiguration.getJobName(), jobConfiguration.getShardingTotalCount(), jobConfiguration.getJobParameter(), shardingItemMap);
}
- private JobTypeConfiguration getJobTypeConfiguration() {
+ private JobConfiguration getJobConfiguration() {
Map<String, String> jobConfigurationMap = new HashMap<>();
jobConfigurationMap.put("jobName", jobConfiguration.getJobName());
if (jobConfiguration.getProps().containsKey("streaming.process")) {
diff --git a/elasticjob-cloud/elasticjob-cloud-executor/src/test/java/org/apache/shardingsphere/elasticjob/cloud/executor/CloudJobFacadeTest.java b/elasticjob-cloud/elasticjob-cloud-executor/src/test/java/org/apache/shardingsphere/elasticjob/cloud/executor/CloudJobFacadeTest.java
index df1d6fa..a8fabd3 100755
--- a/elasticjob-cloud/elasticjob-cloud-executor/src/test/java/org/apache/shardingsphere/elasticjob/cloud/executor/CloudJobFacadeTest.java
+++ b/elasticjob-cloud/elasticjob-cloud-executor/src/test/java/org/apache/shardingsphere/elasticjob/cloud/executor/CloudJobFacadeTest.java
@@ -17,9 +17,7 @@
package org.apache.shardingsphere.elasticjob.cloud.executor;
-import org.apache.shardingsphere.elasticjob.api.ElasticJob;
import org.apache.shardingsphere.elasticjob.api.listener.ShardingContexts;
-import org.apache.shardingsphere.elasticjob.cloud.api.JobType;
import org.apache.shardingsphere.elasticjob.executor.JobFacade;
import org.apache.shardingsphere.elasticjob.infra.context.ExecutionType;
import org.apache.shardingsphere.elasticjob.infra.exception.JobExecutionEnvironmentException;
@@ -55,8 +53,8 @@ public class CloudJobFacadeTest {
@Before
public void setUp() {
shardingContexts = getShardingContexts();
- jobConfig = new JobConfigurationContext(getJobConfigurationMap(JobType.SIMPLE, false));
- jobFacade = new CloudJobFacade(shardingContexts, jobConfig.getTypeConfig(), eventBus);
+ jobConfig = new JobConfigurationContext(getJobConfigurationMap(false));
+ jobFacade = new CloudJobFacade(shardingContexts, jobConfig.getJobConfig(), eventBus);
}
private ShardingContexts getShardingContexts() {
@@ -65,11 +63,9 @@ public class CloudJobFacadeTest {
return new ShardingContexts("fake_task_id", "test_job", 3, "", shardingItemParameters);
}
- private Map<String, String> getJobConfigurationMap(final JobType jobType, final boolean streamingProcess) {
+ private Map<String, String> getJobConfigurationMap(final boolean streamingProcess) {
Map<String, String> result = new HashMap<>(10, 1);
result.put("jobName", "test_job");
- result.put("jobClass", ElasticJob.class.getCanonicalName());
- result.put("jobType", jobType.name());
result.put("streamingProcess", Boolean.toString(streamingProcess));
return result;
}
diff --git a/elasticjob-cloud/elasticjob-cloud-executor/src/test/java/org/apache/shardingsphere/elasticjob/cloud/executor/JobConfigurationContextTest.java b/elasticjob-cloud/elasticjob-cloud-executor/src/test/java/org/apache/shardingsphere/elasticjob/cloud/executor/JobConfigurationContextTest.java
index 559d1df..f3a4224 100755
--- a/elasticjob-cloud/elasticjob-cloud-executor/src/test/java/org/apache/shardingsphere/elasticjob/cloud/executor/JobConfigurationContextTest.java
+++ b/elasticjob-cloud/elasticjob-cloud-executor/src/test/java/org/apache/shardingsphere/elasticjob/cloud/executor/JobConfigurationContextTest.java
@@ -17,10 +17,6 @@
package org.apache.shardingsphere.elasticjob.cloud.executor;
-import org.apache.shardingsphere.elasticjob.cloud.api.JobType;
-import org.apache.shardingsphere.elasticjob.cloud.config.dataflow.DataflowJobConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.script.ScriptJobConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.simple.SimpleJobConfiguration;
import org.apache.shardingsphere.elasticjob.cloud.executor.fixture.TestJob;
import org.junit.Test;
@@ -32,26 +28,11 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
-public class JobConfigurationContextTest {
-
- @Test
- public void assertSimpleJobConfigurationContext() {
- assertTrue(new JobConfigurationContext(buildJobConfigurationContextMap(JobType.SIMPLE)).getTypeConfig() instanceof SimpleJobConfiguration);
- }
-
- @Test
- public void assertDataflowJobConfigurationContext() {
- assertTrue(new JobConfigurationContext(buildJobConfigurationContextMap(JobType.DATAFLOW)).getTypeConfig() instanceof DataflowJobConfiguration);
- }
-
- @Test
- public void assertScriptJobConfigurationContext() {
- assertTrue(new JobConfigurationContext(buildJobConfigurationContextMap(JobType.SCRIPT)).getTypeConfig() instanceof ScriptJobConfiguration);
- }
+public final class JobConfigurationContextTest {
@Test
public void assertSpringSimpleJobConfigurationContext() {
- Map<String, String> context = buildJobConfigurationContextMap(JobType.SIMPLE);
+ Map<String, String> context = buildJobConfigurationContextMap();
context.put("beanName", "springSimpleJobName");
context.put("applicationContext", "applicationContext.xml");
assertThat(new JobConfigurationContext(context).getBeanName(), is("springSimpleJobName"));
@@ -60,22 +41,18 @@ public class JobConfigurationContextTest {
@Test
public void assertSimpleJobConfigurationContextWithExecutionType() {
- Map<String, String> context = buildJobConfigurationContextMap(JobType.SIMPLE);
+ Map<String, String> context = buildJobConfigurationContextMap();
assertTrue(new JobConfigurationContext(context).isTransient());
context.put("cron", "0/1 * * * * ?");
assertFalse(new JobConfigurationContext(context).isTransient());
}
- private Map<String, String> buildJobConfigurationContextMap(final JobType jobType) {
+ private Map<String, String> buildJobConfigurationContextMap() {
Map<String, String> result = new HashMap<>();
result.put("jobName", "configuration_map_job");
result.put("jobClass", TestJob.class.getCanonicalName());
- result.put("jobType", jobType.name());
- if (jobType == JobType.DATAFLOW) {
- result.put("streamingProcess", Boolean.TRUE.toString());
- } else if (jobType == JobType.SCRIPT) {
- result.put("scriptCommandLine", "echo test");
- }
+ result.put("streamingProcess", Boolean.TRUE.toString());
+ result.put("scriptCommandLine", "echo test");
return result;
}
}
diff --git a/elasticjob-cloud/elasticjob-cloud-executor/src/test/java/org/apache/shardingsphere/elasticjob/cloud/executor/TaskExecutorTest.java b/elasticjob-cloud/elasticjob-cloud-executor/src/test/java/org/apache/shardingsphere/elasticjob/cloud/executor/TaskExecutorTest.java
index ed7ddc8..52f9945 100755
--- a/elasticjob-cloud/elasticjob-cloud-executor/src/test/java/org/apache/shardingsphere/elasticjob/cloud/executor/TaskExecutorTest.java
+++ b/elasticjob-cloud/elasticjob-cloud-executor/src/test/java/org/apache/shardingsphere/elasticjob/cloud/executor/TaskExecutorTest.java
@@ -26,6 +26,7 @@ import org.apache.mesos.Protos.FrameworkInfo;
import org.apache.mesos.Protos.SlaveInfo;
import org.apache.mesos.Protos.TaskID;
import org.apache.mesos.Protos.TaskInfo;
+import org.apache.shardingsphere.elasticjob.cloud.executor.fixture.TestJob;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -57,7 +58,7 @@ public final class TaskExecutorTest {
@Before
public void setUp() throws NoSuchFieldException {
- taskExecutor = new TaskExecutor();
+ taskExecutor = new TaskExecutor(new TestJob());
ReflectionUtils.setFieldValue(taskExecutor, "executorService", executorService);
executorInfo = ExecutorInfo.getDefaultInstance();
}
diff --git a/elasticjob-cloud/elasticjob-cloud-executor/src/test/java/org/apache/shardingsphere/elasticjob/cloud/executor/TaskExecutorThreadTest.java b/elasticjob-cloud/elasticjob-cloud-executor/src/test/java/org/apache/shardingsphere/elasticjob/cloud/executor/TaskExecutorThreadTest.java
index 0b7ee6f..60acab1 100755
--- a/elasticjob-cloud/elasticjob-cloud-executor/src/test/java/org/apache/shardingsphere/elasticjob/cloud/executor/TaskExecutorThreadTest.java
+++ b/elasticjob-cloud/elasticjob-cloud-executor/src/test/java/org/apache/shardingsphere/elasticjob/cloud/executor/TaskExecutorThreadTest.java
@@ -25,7 +25,6 @@ import org.apache.mesos.Protos.TaskID;
import org.apache.mesos.Protos.TaskInfo;
import org.apache.mesos.Protos.TaskState;
import org.apache.shardingsphere.elasticjob.api.listener.ShardingContexts;
-import org.apache.shardingsphere.elasticjob.cloud.api.JobType;
import org.apache.shardingsphere.elasticjob.cloud.executor.fixture.TestJob;
import org.apache.shardingsphere.elasticjob.infra.context.ExecutionType;
import org.apache.shardingsphere.elasticjob.infra.exception.JobSystemException;
@@ -54,7 +53,7 @@ public final class TaskExecutorThreadTest {
@Test
public void assertLaunchTaskWithDaemonTaskAndJavaSimpleJob() {
TaskInfo taskInfo = buildJavaTransientTaskInfo();
- TaskExecutor.TaskThread taskThread = new TaskExecutor().new TaskThread(executorDriver, taskInfo);
+ TaskExecutor.TaskThread taskThread = new TaskExecutor(new TestJob()).new TaskThread(executorDriver, taskInfo);
taskThread.run();
verify(executorDriver).sendStatusUpdate(Protos.TaskStatus.newBuilder().setTaskId(taskInfo.getTaskId()).setState(TaskState.TASK_RUNNING).build());
verify(executorDriver).sendStatusUpdate(Protos.TaskStatus.newBuilder().setTaskId(taskInfo.getTaskId()).setState(TaskState.TASK_FINISHED).build());
@@ -63,7 +62,7 @@ public final class TaskExecutorThreadTest {
@Test
public void assertLaunchTaskWithTransientTaskAndSpringSimpleJob() {
TaskInfo taskInfo = buildSpringDaemonTaskInfo();
- TaskExecutor.TaskThread taskThread = new TaskExecutor().new TaskThread(executorDriver, taskInfo);
+ TaskExecutor.TaskThread taskThread = new TaskExecutor(new TestJob()).new TaskThread(executorDriver, taskInfo);
taskThread.run();
verify(executorDriver).sendStatusUpdate(Protos.TaskStatus.newBuilder().setTaskId(taskInfo.getTaskId()).setState(TaskState.TASK_RUNNING).build());
}
@@ -71,7 +70,7 @@ public final class TaskExecutorThreadTest {
@Test
public void assertLaunchTaskWithDaemonTaskAndJavaScriptJob() {
TaskInfo taskInfo = buildSpringScriptTransientTaskInfo();
- TaskExecutor.TaskThread taskThread = new TaskExecutor().new TaskThread(executorDriver, taskInfo);
+ TaskExecutor.TaskThread taskThread = new TaskExecutor(new TestJob()).new TaskThread(executorDriver, taskInfo);
taskThread.run();
verify(executorDriver).sendStatusUpdate(Protos.TaskStatus.newBuilder().setTaskId(taskInfo.getTaskId()).setState(TaskState.TASK_RUNNING).build());
verify(executorDriver).sendStatusUpdate(Protos.TaskStatus.newBuilder().setTaskId(taskInfo.getTaskId()).setState(TaskState.TASK_FINISHED).build());
@@ -80,7 +79,7 @@ public final class TaskExecutorThreadTest {
@Test
public void assertLaunchTaskWithWrongElasticJobClass() {
TaskInfo taskInfo = buildWrongElasticJobClass();
- TaskExecutor.TaskThread taskThread = new TaskExecutor().new TaskThread(executorDriver, taskInfo);
+ TaskExecutor.TaskThread taskThread = new TaskExecutor(new TestJob()).new TaskThread(executorDriver, taskInfo);
try {
taskThread.run();
} catch (final JobSystemException ex) {
@@ -92,7 +91,7 @@ public final class TaskExecutorThreadTest {
@Ignore
public void assertLaunchTaskWithWrongClass() {
TaskInfo taskInfo = buildWrongClass();
- TaskExecutor.TaskThread taskThread = new TaskExecutor().new TaskThread(executorDriver, taskInfo);
+ TaskExecutor.TaskThread taskThread = new TaskExecutor(new TestJob()).new TaskThread(executorDriver, taskInfo);
try {
taskThread.run();
} catch (final JobSystemException ex) {
@@ -117,7 +116,7 @@ public final class TaskExecutorThreadTest {
}
private TaskInfo buildSpringScriptTransientTaskInfo() {
- return buildTaskInfo(buildBaseJobConfigurationContextMap(TestJob.class.getCanonicalName(), null, JobType.SCRIPT)).build();
+ return buildTaskInfo(buildBaseJobConfigurationContextMap(TestJob.class.getCanonicalName(), null)).build();
}
private TaskInfo.Builder buildTaskInfo(final Map<String, String> jobConfigurationContext) {
@@ -147,15 +146,14 @@ public final class TaskExecutorThreadTest {
}
private Map<String, String> buildBaseJobConfigurationContextMapWithJobClassAndCron(final String jobClass, final String cron) {
- return buildBaseJobConfigurationContextMap(jobClass, cron, JobType.SIMPLE);
+ return buildBaseJobConfigurationContextMap(jobClass, cron);
}
- private Map<String, String> buildBaseJobConfigurationContextMap(final String jobClass, final String cron, final JobType jobType) {
+ private Map<String, String> buildBaseJobConfigurationContextMap(final String jobClass, final String cron) {
Map<String, String> result = new HashMap<>();
result.put("jobName", "test_job");
result.put("cron", cron);
result.put("jobClass", jobClass);
- result.put("jobType", jobType.name());
result.put("scriptCommandLine", "echo \"\"");
return result;
}
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/constants/CloudConfigurationConstants.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/constants/CloudConfigurationConstants.java
index f4340be..ec8c5d6 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/constants/CloudConfigurationConstants.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/constants/CloudConfigurationConstants.java
@@ -17,9 +17,13 @@
package org.apache.shardingsphere.elasticjob.cloud.scheduler.config.constants;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
/**
* Cloud configuration constants.
*/
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class CloudConfigurationConstants {
public static final String APP_NAME = "appName";
@@ -37,10 +41,4 @@ public final class CloudConfigurationConstants {
public static final String MEMORY_MB = "memoryMB";
public static final String JOB_EXECUTION_TYPE = "jobExecutionType";
-
- public static final String BEAN_NAME = "beanName";
-
- public static final String APPLICATION_CONTEXT = "applicationContext";
-
-
}
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationGsonFactory.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationGsonFactory.java
index ba8df54..10b059b 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationGsonFactory.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationGsonFactory.java
@@ -17,15 +17,17 @@
package org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.constants.CloudConfigurationConstants;
-import org.apache.shardingsphere.elasticjob.cloud.config.JobTypeConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.util.json.AbstractJobConfigurationGsonTypeAdapter;
-import org.apache.shardingsphere.elasticjob.cloud.util.json.GsonFactory;
import com.google.common.base.Preconditions;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
+import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.constants.CloudConfigurationConstants;
+import org.apache.shardingsphere.elasticjob.cloud.util.json.AbstractJobConfigurationGsonTypeAdapter;
+import org.apache.shardingsphere.elasticjob.cloud.util.json.GsonFactory;
import java.io.IOException;
import java.util.Map;
@@ -63,7 +65,7 @@ public final class CloudJobConfigurationGsonFactory {
/**
* Json adapter of the cloud job configuration.
*/
- public static final class CloudJobConfigurationGsonTypeAdapter extends AbstractJobConfigurationGsonTypeAdapter<CloudJobConfiguration> {
+ public static final class CloudJobConfigurationGsonTypeAdapter extends AbstractJobConfigurationGsonTypeAdapter {
@Override
protected void addToCustomizedValueMap(final String jsonName, final JsonReader in, final Map<String, Object> customizedValueMap) throws IOException {
@@ -73,8 +75,6 @@ public final class CloudJobConfigurationGsonFactory {
customizedValueMap.put(jsonName, in.nextDouble());
break;
case CloudConfigurationConstants.APP_NAME:
- case CloudConfigurationConstants.APPLICATION_CONTEXT:
- case CloudConfigurationConstants.BEAN_NAME:
case CloudConfigurationConstants.JOB_EXECUTION_TYPE:
customizedValueMap.put(jsonName, in.nextString());
break;
@@ -85,25 +85,17 @@ public final class CloudJobConfigurationGsonFactory {
}
@Override
- protected CloudJobConfiguration getJobRootConfiguration(final JobTypeConfiguration typeConfig, final Map<String, Object> customizedValueMap) {
+ protected CloudJobConfiguration getJobRootConfiguration(final JobConfiguration jobConfig, final Map<String, Object> customizedValueMap) {
Preconditions.checkNotNull(customizedValueMap.get(CloudConfigurationConstants.APP_NAME), "appName cannot be null.");
Preconditions.checkNotNull(customizedValueMap.get(CloudConfigurationConstants.CPU_COUNT), "cpuCount cannot be null.");
Preconditions.checkArgument((double) customizedValueMap.get(CloudConfigurationConstants.CPU_COUNT) >= 0.001, "cpuCount cannot be less than 0.001");
Preconditions.checkNotNull(customizedValueMap.get(CloudConfigurationConstants.MEMORY_MB), "memoryMB cannot be null.");
Preconditions.checkArgument((double) customizedValueMap.get(CloudConfigurationConstants.MEMORY_MB) >= 1, "memory cannot be less than 1");
Preconditions.checkNotNull(customizedValueMap.get(CloudConfigurationConstants.JOB_EXECUTION_TYPE), "jobExecutionType cannot be null.");
- if (customizedValueMap.containsKey(CloudConfigurationConstants.BEAN_NAME) && customizedValueMap.containsKey(CloudConfigurationConstants.APPLICATION_CONTEXT)) {
- return new CloudJobConfiguration((String) customizedValueMap.get(CloudConfigurationConstants.APP_NAME), typeConfig,
- (double) customizedValueMap.get(CloudConfigurationConstants.CPU_COUNT),
- (double) customizedValueMap.get(CloudConfigurationConstants.MEMORY_MB),
- CloudJobExecutionType.valueOf(customizedValueMap.get(CloudConfigurationConstants.JOB_EXECUTION_TYPE).toString()),
- customizedValueMap.get(CloudConfigurationConstants.BEAN_NAME).toString(), customizedValueMap.get(CloudConfigurationConstants.APPLICATION_CONTEXT).toString());
- } else {
- return new CloudJobConfiguration((String) customizedValueMap.get(CloudConfigurationConstants.APP_NAME), typeConfig,
- (double) customizedValueMap.get(CloudConfigurationConstants.CPU_COUNT),
- (double) customizedValueMap.get(CloudConfigurationConstants.MEMORY_MB),
- CloudJobExecutionType.valueOf(customizedValueMap.get(CloudConfigurationConstants.JOB_EXECUTION_TYPE).toString()));
- }
+ return new CloudJobConfiguration((String) customizedValueMap.get(CloudConfigurationConstants.APP_NAME), jobConfig,
+ (double) customizedValueMap.get(CloudConfigurationConstants.CPU_COUNT),
+ (double) customizedValueMap.get(CloudConfigurationConstants.MEMORY_MB),
+ CloudJobExecutionType.valueOf(customizedValueMap.get(CloudConfigurationConstants.JOB_EXECUTION_TYPE).toString()));
}
@Override
@@ -112,8 +104,6 @@ public final class CloudJobConfigurationGsonFactory {
out.name(CloudConfigurationConstants.CPU_COUNT).value(value.getCpuCount());
out.name(CloudConfigurationConstants.MEMORY_MB).value(value.getMemoryMB());
out.name(CloudConfigurationConstants.JOB_EXECUTION_TYPE).value(value.getJobExecutionType().name());
- out.name(CloudConfigurationConstants.BEAN_NAME).value(value.getBeanName());
- out.name(CloudConfigurationConstants.APPLICATION_CONTEXT).value(value.getApplicationContext());
}
}
}
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationListener.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationListener.java
index 0731cc6..9ea4296 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationListener.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationListener.java
@@ -23,6 +23,8 @@ import org.apache.curator.framework.recipes.cache.TreeCache;
import org.apache.curator.framework.recipes.cache.TreeCacheEvent;
import org.apache.curator.framework.recipes.cache.TreeCacheEvent.Type;
import org.apache.curator.framework.recipes.cache.TreeCacheListener;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.producer.ProducerManager;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.state.ready.ReadyService;
import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
@@ -49,7 +51,7 @@ public final class CloudJobConfigurationListener implements TreeCacheListener {
}
@Override
- public void childEvent(final CuratorFramework client, final TreeCacheEvent event) throws Exception {
+ public void childEvent(final CuratorFramework client, final TreeCacheEvent event) {
String path = null == event.getData() ? "" : event.getData().getPath();
if (isJobConfigNode(event, path, Type.NODE_ADDED)) {
CloudJobConfiguration jobConfig = getJobConfig(event);
@@ -64,7 +66,7 @@ public final class CloudJobConfigurationListener implements TreeCacheListener {
if (CloudJobExecutionType.DAEMON == jobConfig.getJobExecutionType()) {
readyService.remove(Collections.singletonList(jobConfig.getJobName()));
}
- if (!jobConfig.getTypeConfig().getCoreConfig().isMisfire()) {
+ if (!jobConfig.getJobConfig().isMisfire()) {
readyService.setMisfireDisabled(jobConfig.getJobName());
}
producerManager.reschedule(jobConfig.getJobName());
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationService.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationService.java
index 19caef7..c10c7c7 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationService.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationService.java
@@ -18,6 +18,7 @@
package org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job;
import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
import java.util.ArrayList;
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/context/JobContext.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/context/JobContext.java
index 29b8cc4..240b42c 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/context/JobContext.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/context/JobContext.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.elasticjob.cloud.scheduler.context;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
import org.apache.shardingsphere.elasticjob.infra.context.ExecutionType;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@@ -46,7 +46,7 @@ public final class JobContext {
* @return Job running context
*/
public static JobContext from(final CloudJobConfiguration jobConfig, final ExecutionType type) {
- int shardingTotalCount = jobConfig.getTypeConfig().getCoreConfig().getShardingTotalCount();
+ int shardingTotalCount = jobConfig.getJobConfig().getShardingTotalCount();
List<Integer> shardingItems = new ArrayList<>(shardingTotalCount);
for (int i = 0; i < shardingTotalCount; i++) {
shardingItems.add(i);
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/AppConstraintEvaluator.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/AppConstraintEvaluator.java
index cf4bb58..aff4655 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/AppConstraintEvaluator.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/AppConstraintEvaluator.java
@@ -30,7 +30,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.elasticjob.infra.context.TaskContext;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.app.CloudAppConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
import org.codehaus.jettison.json.JSONException;
import java.util.ArrayList;
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/FacadeService.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/FacadeService.java
index f98227b..910ef00 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/FacadeService.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/FacadeService.java
@@ -22,9 +22,9 @@ import org.apache.shardingsphere.elasticjob.infra.context.ExecutionType;
import org.apache.shardingsphere.elasticjob.infra.context.TaskContext;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.app.CloudAppConfiguration;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.app.CloudAppConfigurationService;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfigurationService;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobExecutionType;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.context.JobContext;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.state.disable.app.DisableAppService;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.state.disable.job.DisableJobService;
@@ -165,7 +165,7 @@ public final class FacadeService {
return;
}
CloudJobConfiguration jobConfig = jobConfigOptional.get();
- if (jobConfig.getTypeConfig().getCoreConfig().isFailover() || CloudJobExecutionType.DAEMON == jobConfig.getJobExecutionType()) {
+ if (jobConfig.getJobConfig().isFailover() || CloudJobExecutionType.DAEMON == jobConfig.getJobExecutionType()) {
failoverService.add(taskContext);
}
}
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/JobTaskRequest.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/JobTaskRequest.java
index dcb360e..d34e4a6 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/JobTaskRequest.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/JobTaskRequest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.elasticjob.cloud.scheduler.mesos;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
import org.apache.shardingsphere.elasticjob.infra.context.TaskContext;
import com.netflix.fenzo.ConstraintEvaluator;
import com.netflix.fenzo.TaskRequest;
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/LaunchingTasks.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/LaunchingTasks.java
index 3330acf..1acc16f 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/LaunchingTasks.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/LaunchingTasks.java
@@ -69,7 +69,7 @@ public final class LaunchingTasks {
Collection<String> result = new HashSet<>(assignedJobShardingTotalCountMap.size(), 1);
for (Map.Entry<String, Integer> entry : assignedJobShardingTotalCountMap.entrySet()) {
JobContext jobContext = eligibleJobContextsMap.get(entry.getKey());
- if (ExecutionType.FAILOVER != jobContext.getType() && !entry.getValue().equals(jobContext.getJobConfig().getTypeConfig().getCoreConfig().getShardingTotalCount())) {
+ if (ExecutionType.FAILOVER != jobContext.getType() && !entry.getValue().equals(jobContext.getJobConfig().getJobConfig().getShardingTotalCount())) {
log.warn("Job {} is not assigned at this time, because resources not enough to run all sharding instances.", entry.getKey());
result.add(entry.getKey());
}
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/TaskInfoData.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/TaskInfoData.java
index 4e138be..0ae460b 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/TaskInfoData.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/TaskInfoData.java
@@ -20,10 +20,10 @@ package org.apache.shardingsphere.elasticjob.cloud.scheduler.mesos;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.SerializationUtils;
import org.apache.shardingsphere.elasticjob.api.listener.ShardingContexts;
-import org.apache.shardingsphere.elasticjob.cloud.config.dataflow.DataflowJobConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.script.ScriptJobConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobExecutionType;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
+import org.apache.shardingsphere.elasticjob.dataflow.props.DataflowJobProperties;
+import org.apache.shardingsphere.elasticjob.script.props.ScriptJobProperties;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -52,19 +52,15 @@ public final class TaskInfoData {
private Map<String, String> buildJobConfigurationContext() {
Map<String, String> result = new LinkedHashMap<>(16, 1);
- result.put("jobType", jobConfig.getTypeConfig().getJobType().name());
result.put("jobName", jobConfig.getJobName());
- result.put("jobClass", jobConfig.getTypeConfig().getJobClass());
- result.put("cron", CloudJobExecutionType.DAEMON == jobConfig.getJobExecutionType() ? jobConfig.getTypeConfig().getCoreConfig().getCron() : "");
- result.put("executorServiceHandler", jobConfig.getTypeConfig().getCoreConfig().getJobExecutorServiceHandlerType());
- result.put("jobExceptionHandler", jobConfig.getTypeConfig().getCoreConfig().getJobErrorHandlerType());
- if (jobConfig.getTypeConfig() instanceof DataflowJobConfiguration) {
- result.put("streamingProcess", Boolean.toString(((DataflowJobConfiguration) jobConfig.getTypeConfig()).isStreamingProcess()));
- } else if (jobConfig.getTypeConfig() instanceof ScriptJobConfiguration) {
- result.put("scriptCommandLine", ((ScriptJobConfiguration) jobConfig.getTypeConfig()).getScriptCommandLine());
+ result.put("cron", CloudJobExecutionType.DAEMON == jobConfig.getJobExecutionType() ? jobConfig.getJobConfig().getCron() : "");
+ result.put("executorServiceHandler", jobConfig.getJobConfig().getJobExecutorServiceHandlerType());
+ result.put("jobExceptionHandler", jobConfig.getJobConfig().getJobErrorHandlerType());
+ if (jobConfig.getJobConfig().getProps().containsKey(DataflowJobProperties.STREAM_PROCESS_KEY)) {
+ result.put("streamingProcess", jobConfig.getJobConfig().getProps().getProperty(DataflowJobProperties.STREAM_PROCESS_KEY));
+ } else if (jobConfig.getJobConfig().getProps().containsKey(ScriptJobProperties.SCRIPT_KEY)) {
+ result.put("scriptCommandLine", jobConfig.getJobConfig().getProps().getProperty(ScriptJobProperties.SCRIPT_KEY));
}
- result.put("beanName", jobConfig.getBeanName());
- result.put("applicationContext", jobConfig.getApplicationContext());
return result;
}
}
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/TaskLaunchScheduledService.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/TaskLaunchScheduledService.java
index 8828969..81c4acb 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/TaskLaunchScheduledService.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/TaskLaunchScheduledService.java
@@ -34,16 +34,15 @@ import org.apache.mesos.Protos.OfferID;
import org.apache.mesos.Protos.TaskInfo;
import org.apache.mesos.SchedulerDriver;
import org.apache.shardingsphere.elasticjob.api.listener.ShardingContexts;
-import org.apache.shardingsphere.elasticjob.cloud.api.JobType;
-import org.apache.shardingsphere.elasticjob.cloud.config.script.ScriptJobConfiguration;
-import org.apache.shardingsphere.elasticjob.infra.context.ExecutionType;
-import org.apache.shardingsphere.elasticjob.infra.context.TaskContext;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.app.CloudAppConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobExecutionType;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.env.BootstrapEnvironment;
import org.apache.shardingsphere.elasticjob.cloud.util.config.ShardingItemParameters;
import org.apache.shardingsphere.elasticjob.cloud.util.json.GsonFactory;
+import org.apache.shardingsphere.elasticjob.infra.context.ExecutionType;
+import org.apache.shardingsphere.elasticjob.infra.context.TaskContext;
+import org.apache.shardingsphere.elasticjob.script.props.ScriptJobProperties;
import org.apache.shardingsphere.elasticjob.tracing.JobEventBus;
import org.apache.shardingsphere.elasticjob.tracing.event.JobStatusTraceEvent;
import org.apache.shardingsphere.elasticjob.tracing.event.JobStatusTraceEvent.Source;
@@ -164,10 +163,10 @@ public final class TaskLaunchScheduledService extends AbstractScheduledService {
CloudAppConfiguration appConfig = appConfigOptional.get();
taskContext.setSlaveId(offer.getSlaveId().getValue());
ShardingContexts shardingContexts = getShardingContexts(taskContext, appConfig, jobConfig);
- boolean isCommandExecutor = CloudJobExecutionType.TRANSIENT == jobConfig.getJobExecutionType() && JobType.SCRIPT == jobConfig.getTypeConfig().getJobType();
+ boolean isCommandExecutor = CloudJobExecutionType.TRANSIENT == jobConfig.getJobExecutionType() && jobConfig.getJobConfig().getProps().contains(ScriptJobProperties.SCRIPT_KEY);
String script = appConfig.getBootstrapScript();
if (isCommandExecutor) {
- script = ((ScriptJobConfiguration) jobConfig.getTypeConfig()).getScriptCommandLine();
+ script = jobConfig.getJobConfig().getProps().getProperty(ScriptJobProperties.SCRIPT_KEY);
}
Protos.CommandInfo.URI uri = buildURI(appConfig, isCommandExecutor);
Protos.CommandInfo command = buildCommand(uri, script, shardingContexts, isCommandExecutor);
@@ -179,12 +178,12 @@ public final class TaskLaunchScheduledService extends AbstractScheduledService {
}
private ShardingContexts getShardingContexts(final TaskContext taskContext, final CloudAppConfiguration appConfig, final CloudJobConfiguration jobConfig) {
- Map<Integer, String> shardingItemParameters = new ShardingItemParameters(jobConfig.getTypeConfig().getCoreConfig().getShardingItemParameters()).getMap();
+ Map<Integer, String> shardingItemParameters = new ShardingItemParameters(jobConfig.getJobConfig().getShardingItemParameters()).getMap();
Map<Integer, String> assignedShardingItemParameters = new HashMap<>(1, 1);
int shardingItem = taskContext.getMetaInfo().getShardingItems().get(0);
assignedShardingItemParameters.put(shardingItem, shardingItemParameters.getOrDefault(shardingItem, ""));
- return new ShardingContexts(taskContext.getId(), jobConfig.getJobName(), jobConfig.getTypeConfig().getCoreConfig().getShardingTotalCount(),
- jobConfig.getTypeConfig().getCoreConfig().getJobParameter(), assignedShardingItemParameters, appConfig.getEventTraceSamplingCount());
+ return new ShardingContexts(taskContext.getId(), jobConfig.getJobName(), jobConfig.getJobConfig().getShardingTotalCount(),
+ jobConfig.getJobConfig().getJobParameter(), assignedShardingItemParameters, appConfig.getEventTraceSamplingCount());
}
private Protos.TaskInfo buildCommandExecutorTaskInfo(final TaskContext taskContext, final CloudJobConfiguration jobConfig, final ShardingContexts shardingContexts,
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/producer/ProducerManager.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/producer/ProducerManager.java
index a23a5cc..a64a8e4 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/producer/ProducerManager.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/producer/ProducerManager.java
@@ -27,9 +27,9 @@ import org.apache.shardingsphere.elasticjob.infra.context.TaskContext;
import org.apache.shardingsphere.elasticjob.cloud.exception.AppConfigurationException;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.app.CloudAppConfiguration;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.app.CloudAppConfigurationService;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfigurationService;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobExecutionType;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.state.disable.app.DisableAppService;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.state.disable.job.DisableJobService;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.state.ready.ReadyService;
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/producer/TransientProducerScheduler.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/producer/TransientProducerScheduler.java
index 3f0dc3d..80ec503 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/producer/TransientProducerScheduler.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/producer/TransientProducerScheduler.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.elasticjob.cloud.scheduler.producer;
import lombok.Setter;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.state.ready.ReadyService;
import org.apache.shardingsphere.elasticjob.infra.exception.JobSystemException;
import org.quartz.CronScheduleBuilder;
@@ -86,7 +86,7 @@ final class TransientProducerScheduler {
// TODO Concurrency optimization
synchronized void register(final CloudJobConfiguration jobConfig) {
- String cron = jobConfig.getTypeConfig().getCoreConfig().getCron();
+ String cron = jobConfig.getJobConfig().getCron();
JobKey jobKey = buildJobKey(cron);
repository.put(jobKey, jobConfig.getJobName());
try {
@@ -111,7 +111,7 @@ final class TransientProducerScheduler {
synchronized void deregister(final CloudJobConfiguration jobConfig) {
repository.remove(jobConfig.getJobName());
- String cron = jobConfig.getTypeConfig().getCoreConfig().getCron();
+ String cron = jobConfig.getJobConfig().getCron();
if (!repository.containsKey(buildJobKey(cron))) {
try {
scheduler.unscheduleJob(TriggerKey.triggerKey(cron));
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/restful/CloudAppRestfulApi.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/restful/CloudAppRestfulApi.java
index f5b90da..e93fbec 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/restful/CloudAppRestfulApi.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/restful/CloudAppRestfulApi.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.elasticjob.cloud.exception.AppConfigurationExce
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.app.CloudAppConfiguration;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.app.CloudAppConfigurationGsonFactory;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.app.CloudAppConfigurationService;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfigurationService;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.mesos.MesosStateService;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.producer.ProducerManager;
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/restful/CloudJobRestfulApi.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/restful/CloudJobRestfulApi.java
index 8bc804d..36cdc7c 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/restful/CloudJobRestfulApi.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/restful/CloudJobRestfulApi.java
@@ -20,11 +20,10 @@ package org.apache.shardingsphere.elasticjob.cloud.scheduler.restful;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import lombok.extern.slf4j.Slf4j;
-import org.apache.shardingsphere.elasticjob.infra.context.TaskContext;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfigurationGsonFactory;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfigurationService;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobExecutionType;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.env.BootstrapEnvironment;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.mesos.FacadeService;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.producer.ProducerManager;
@@ -35,10 +34,10 @@ import org.apache.shardingsphere.elasticjob.cloud.statistics.StatisticInterval;
import org.apache.shardingsphere.elasticjob.cloud.statistics.type.job.JobExecutionTypeStatistics;
import org.apache.shardingsphere.elasticjob.cloud.statistics.type.job.JobRegisterStatistics;
import org.apache.shardingsphere.elasticjob.cloud.statistics.type.job.JobRunningStatistics;
-import org.apache.shardingsphere.elasticjob.cloud.statistics.type.job.JobTypeStatistics;
import org.apache.shardingsphere.elasticjob.cloud.statistics.type.task.TaskResultStatistics;
import org.apache.shardingsphere.elasticjob.cloud.statistics.type.task.TaskRunningStatistics;
import org.apache.shardingsphere.elasticjob.cloud.util.json.GsonFactory;
+import org.apache.shardingsphere.elasticjob.infra.context.TaskContext;
import org.apache.shardingsphere.elasticjob.infra.exception.JobSystemException;
import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
import org.apache.shardingsphere.elasticjob.tracing.api.TracingConfiguration;
@@ -419,18 +418,6 @@ public final class CloudJobRestfulApi {
}
/**
- * Get job type statistics.
- *
- * @return job type statistics
- */
- @GET
- @Path("/statistics/jobs/type")
- @Consumes(MediaType.APPLICATION_JSON)
- public JobTypeStatistics getJobTypeStatistics() {
- return statisticManager.getJobTypeStatistics();
- }
-
- /**
* Get job execution type statistics.
*
* @return job execution statistics
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/failover/FailoverService.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/failover/FailoverService.java
index c8f71bb..5baf237 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/failover/FailoverService.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/failover/FailoverService.java
@@ -24,7 +24,7 @@ import com.google.common.hash.Hashing;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.elasticjob.infra.context.ExecutionType;
import org.apache.shardingsphere.elasticjob.infra.context.TaskContext;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfigurationService;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.context.JobContext;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.env.BootstrapEnvironment;
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/ready/ReadyService.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/ready/ReadyService.java
index 8ccdb25..862fa0a 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/ready/ReadyService.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/ready/ReadyService.java
@@ -20,9 +20,9 @@ package org.apache.shardingsphere.elasticjob.cloud.scheduler.state.ready;
import com.google.common.base.Strings;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.elasticjob.infra.context.ExecutionType;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfigurationService;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobExecutionType;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.context.JobContext;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.env.BootstrapEnvironment;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.state.running.RunningService;
@@ -73,7 +73,7 @@ public final class ReadyService {
}
String readyJobNode = ReadyNode.getReadyJobNodePath(jobName);
String times = regCenter.getDirectly(readyJobNode);
- if (cloudJobConfig.get().getTypeConfig().getCoreConfig().isMisfire()) {
+ if (cloudJobConfig.get().getJobConfig().isMisfire()) {
regCenter.persist(readyJobNode, Integer.toString(null == times ? 1 : Integer.parseInt(times) + 1));
} else {
regCenter.persist(ReadyNode.getReadyJobNodePath(jobName), "1");
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/running/RunningService.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/running/RunningService.java
index 945f7f0..a310869 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/running/RunningService.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/running/RunningService.java
@@ -22,9 +22,9 @@ import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.elasticjob.infra.context.TaskContext;
import org.apache.shardingsphere.elasticjob.infra.context.TaskContext.MetaInfo;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfigurationService;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobExecutionType;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
import java.util.Collection;
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/statistics/StatisticManager.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/statistics/StatisticManager.java
index 83f0a6d..fbd25e4 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/statistics/StatisticManager.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/statistics/StatisticManager.java
@@ -20,10 +20,9 @@ package org.apache.shardingsphere.elasticjob.cloud.scheduler.statistics;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import org.apache.shardingsphere.elasticjob.cloud.api.JobType;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfigurationService;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobExecutionType;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.statistics.job.JobRunningStatisticJob;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.statistics.job.RegisteredJobStatisticJob;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.statistics.job.TaskResultStatisticJob;
@@ -33,7 +32,6 @@ import org.apache.shardingsphere.elasticjob.cloud.statistics.rdb.StatisticRdbRep
import org.apache.shardingsphere.elasticjob.cloud.statistics.type.job.JobExecutionTypeStatistics;
import org.apache.shardingsphere.elasticjob.cloud.statistics.type.job.JobRegisterStatistics;
import org.apache.shardingsphere.elasticjob.cloud.statistics.type.job.JobRunningStatistics;
-import org.apache.shardingsphere.elasticjob.cloud.statistics.type.job.JobTypeStatistics;
import org.apache.shardingsphere.elasticjob.cloud.statistics.type.task.TaskResultStatistics;
import org.apache.shardingsphere.elasticjob.cloud.statistics.type.task.TaskRunningStatistics;
import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
@@ -207,27 +205,6 @@ public final class StatisticManager {
}
/**
- * Get job type statistics.
- *
- * @return job type statistics
- */
- public JobTypeStatistics getJobTypeStatistics() {
- int scriptJobCnt = 0;
- int simpleJobCnt = 0;
- int dataflowJobCnt = 0;
- for (CloudJobConfiguration each : configurationService.loadAll()) {
- if (JobType.SCRIPT.equals(each.getTypeConfig().getJobType())) {
- scriptJobCnt++;
- } else if (JobType.SIMPLE.equals(each.getTypeConfig().getJobType())) {
- simpleJobCnt++;
- } else if (JobType.DATAFLOW.equals(each.getTypeConfig().getJobType())) {
- dataflowJobCnt++;
- }
- }
- return new JobTypeStatistics(scriptJobCnt, simpleJobCnt, dataflowJobCnt);
- }
-
- /**
* Get job execution type statistics.
*
* @return Job execution type statistics data object
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/html/job/add_job.html b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/html/job/add_job.html
index 81c01b3..c1f3e84 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/html/job/add_job.html
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/html/job/add_job.html
@@ -47,26 +47,6 @@
</div>
</div>
</div>
- <div class="form-group" id="job-class-model">
- <label for="job-class" class="col-sm-2 control-label" data-lang="job-class"><i>*</i></label>
- <div class="col-sm-9">
- <input type="text" placeholder="yourJobClass" id="job-class" name="jobClass" class="form-control" data-toggle="tooltip" data-placement="bottom" title="作业实现类,需实现ElasticJob接口,脚本型作业不需要配置"/>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-4">
- <div class="form-group">
- <label for="job-type" class="col-sm-6 control-label" data-lang="job-type"><i>*</i></label>
- <div class="col-sm-6">
- <select id="job-type" name="jobType" class="form-control" >
- <option value="SIMPLE" required>SIMPLE</option>
- <option value="DATAFLOW">DATAFLOW</option>
- <option value="SCRIPT">SCRIPT</option>
- </select>
- </div>
- </div>
- </div>
- </div>
<div class="row">
<div class="col-sm-4">
<div class="form-group">
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/html/job/detail_job.html b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/html/job/detail_job.html
index f1a8e9b..476b25d 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/html/job/detail_job.html
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/html/job/detail_job.html
@@ -47,26 +47,6 @@
</div>
</div>
</div>
- <div class="form-group" id="job-class-model">
- <label for="job-class" class="col-sm-2 control-label" data-lang="job-class"><i>*</i></label>
- <div class="col-sm-9">
- <input type="text" disabled="disabled" placeholder="yourJobClass" id="job-class" name="jobClass" class="form-control" data-toggle="tooltip" data-placement="bottom" title="作业实现类,需实现ElasticJob接口,脚本型作业不需要配置"/>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-4">
- <div class="form-group">
- <label for="job-type" class="col-sm-6 control-label" data-lang="job-type"><i>*</i></label>
- <div class="col-sm-6">
- <select id="job-type" disabled="disabled" name="jobType" class="form-control" >
- <option value="SIMPLE" required>SIMPLE</option>
- <option value="DATAFLOW">DATAFLOW</option>
- <option value="SCRIPT">SCRIPT</option>
- </select>
- </div>
- </div>
- </div>
- </div>
<div class="row">
<div class="col-sm-4">
<div class="form-group">
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/html/job/jobs_overview.html b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/html/job/jobs_overview.html
index 6821761..ac393dc 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/html/job/jobs_overview.html
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/html/job/jobs_overview.html
@@ -30,7 +30,6 @@
<tr>
<th data-field="jobName" data-sortable="true"><span data-lang="job-name"></span></th>
<th data-field="appName" data-sortable="true"><span data-lang="app-name"></span></th>
- <th data-field="jobClass" data-sortable="true"><span data-lang="job-class"></span></th>
<th data-field="shardingTotalCount" data-sortable="true"><span data-lang="job-sharding-total-count"></span></th>
<th data-field="cron" data-sortable="true"><span data-lang="job-cron"></span></th>
<th data-field="operation" data-formatter="operationJob"><span data-lang="operation"></span></th>
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/html/job/modify_job.html b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/html/job/modify_job.html
index c939906..d78c307 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/html/job/modify_job.html
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/html/job/modify_job.html
@@ -47,26 +47,6 @@
</div>
</div>
</div>
- <div class="form-group" id="job-class-model">
- <label for="job-class" class="col-sm-2 control-label" data-lang="job-class"><i>*</i></label>
- <div class="col-sm-9">
- <input type="text" placeholder="yourJobClass" id="job-class" name="jobClass" class="form-control" data-toggle="tooltip" data-placement="bottom" title="作业实现类,需实现ElasticJob接口,脚本型作业不需要配置"/>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-4">
- <div class="form-group">
- <label for="job-type" class="col-sm-6 control-label" data-lang="job-type"><i>*</i></label>
- <div class="col-sm-6">
- <select id="job-type" name="jobType" class="form-control" >
- <option value="SIMPLE" required>SIMPLE</option>
- <option value="DATAFLOW">DATAFLOW</option>
- <option value="SCRIPT">SCRIPT</option>
- </select>
- </div>
- </div>
- </div>
- </div>
<div class="row">
<div class="col-sm-4">
<div class="form-group">
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/i18n/message_en.properties b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/i18n/message_en.properties
index 248a516..c6c9943 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/i18n/message_en.properties
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/i18n/message_en.properties
@@ -71,7 +71,6 @@ job-detail=Job detail
update-job=Update job
job-name=Job name
job-execution-type=Job execution type
-job-class=Job class
job-type=Job type
job-cron=Crontab
job-sharding-total-count=Sharding total count
@@ -91,8 +90,6 @@ job-sharding-item=Sharding item
job-spring-type-settings=Job spring type settings
job-application-context-info=Job application context info
job-bean-name-info=Job bean name info
-job-class-not-null=Job class cannot be null
-job-class-regexp-limit=The job class can only use Numbers, letters, underscores (_) and dot (.).
job-name-not-null=Job name cannot be null
job-name-length-limit=Job name length should less than 100 characters
job-name-exists=Job name has already existed
@@ -132,7 +129,6 @@ highchart-tooltip-info2=Gesture operations are scaled
placeholder-bootstrap-script=bootstrap-script, eg: bin//start.sh
placeholder-app-url=Path should be accessed through the network, eg: http://file_host:8080/your-job.tar.gz
placeholder-job-app-name=The application name of the job must be registered in the application
-placeholder-job-class=The job class needs to implement the ElasticJob interface, which does not require configuration
placeholder-cron=The cron expression for the job start time. eg: 0/5 * * *?
placeholder-sharding-total-count=Job sharding total count
placeholder-job-parameter=Job customization parameters, can by passing this parameter for job scheduling the business method of ginseng, eg: take parameters job every time for the amount of data read from the database and operation instance of the primary key.
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/i18n/message_zh.properties b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/i18n/message_zh.properties
index 221a316..80dea92 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/i18n/message_zh.properties
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/i18n/message_zh.properties
@@ -72,7 +72,6 @@ update-job=修改作业
job-name=作业名称
job-execution-type=执行类型
job-type=作业类型
-job-class=作业实现类
job-cron=Cron表达式
job-sharding-total-count=作业分片总数
job-parameter=自定义参数
@@ -91,8 +90,6 @@ job-sharding-item=分片项
job-spring-type-settings=Spring方式配置
job-application-context-info=请填写Spring配置文件相对路径及名称
job-bean-name-info=请填写beanName名称
-job-class-not-null=作业实现类不能为空
-job-class-regexp-limit=作业实现类只能使用数字、字母、下划线(_)和点号(.)
job-name-not-null=作业名称不能为空
job-name-length-limit=作业名称长度不能超过100字符大小
job-name-exists=作业名称已经注册
@@ -132,7 +129,6 @@ highchart-tooltip-info2=手势操作进行缩放
placeholder-bootstrap-script=启动脚本,如:bin\\start.sh。
placeholder-app-url=必须是可以通过网络访问到的路径。如:http://file_host:8080/your-job.tar.gz
placeholder-job-app-name=作业所在的应用名称,必须是在应用中已注册。
-placeholder-job-class=作业实现类,需实现ElasticJob接口,脚本型作业不需要配置
placeholder-cron=作业启动时间的cron表达式。如:0/5 * * * * ?
placeholder-sharding-total-count=作业分片总数
placeholder-job-parameter=作业自定义参数,可通过传递该参数为作业调度的业务方法传参,用于实现带参数的作业例:每次获取的数据量、作业实例从数据库读取的主键。
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/js/history/job_dashboard.js b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/js/history/job_dashboard.js
index 4d7c993..1f2e9ba 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/js/history/job_dashboard.js
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/js/history/job_dashboard.js
@@ -20,7 +20,6 @@ $(function() {
renderPieChartSinceLastMinuteData();
renderPieChartSinceLastHourData();
renderPieChartSinceLastWeekData();
- renderJobTypePieChart();
renderJobExecutionTypePieChart();
renderStaticsJobsLineChart();
renderRunningJobsAndTasksLineChart();
@@ -36,7 +35,6 @@ function doLocale() {
renderPieChartSinceLastMinuteData();
renderPieChartSinceLastHourData();
renderPieChartSinceLastWeekData();
- renderJobTypePieChart();
renderJobExecutionTypePieChart();
renderStaticsJobsLineChart();
renderRunningJobsAndTasksLineChart();
@@ -88,21 +86,6 @@ function renderPieChartSinceLastWeekData() {
});
}
-function renderJobTypePieChart() {
- $.ajax({
- url: "/api/job/statistics/jobs/type",
- dataType: "json",
- success: function(jobData) {
- if(null !== jobData) {
- var chartName = "#job-type";
- var color = ["rgb(144, 237, 125)", "rgb(247, 163, 92)", "rgb(67, 67, 72)"];
- var jobResult = [["DATAFLOW", jobData.dataflowJobCount], ["SIMPLE", jobData.simpleJobCount], ["SCRIPT", jobData.scriptJobCount]];
- renderPieChart(chartName, $.i18n.prop("job-type"), color, jobResult);
- }
- }
- });
-}
-
function renderJobExecutionTypePieChart() {
$.ajax({
url: "/api/job/statistics/jobs/executionType",
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/js/job/job_common.js b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/js/job/job_common.js
index dd9c172..99f0281 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/js/job/job_common.js
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/js/job/job_common.js
@@ -24,17 +24,6 @@ function validate() {
validating: "glyphicon glyphicon-refresh"
},
fields: {
- jobClass: {
- validators: {
- notEmpty: {
- message: $.i18n.prop("job-class-not-null")
- },
- regexp: {
- regexp: /^[\w\.]+$/,
- message: $.i18n.prop("job-class-regexp-limit")
- }
- }
- },
jobName: {
jobNameCheck: true,
validators: {
@@ -214,17 +203,14 @@ function dataControl() {
$("#job-type").change(function() {
var jobType = $("#job-type").val();
if("SIMPLE" === jobType) {
- $("#job-class-model").show();
$("#streaming-process").hide();
$("#streaming-process-box").hide();
$("#bootstrap-script-div").hide();
} else if("DATAFLOW" === jobType) {
- $("#job-class-model").show();
$("#streaming-process").show();
$("#streaming-process-box").show();
$("#bootstrap-script-div").hide();
} else if("SCRIPT" === jobType) {
- $("#job-class-model").hide();
$("#streaming-process").hide();
$("#streaming-process-box").hide();
$("#bootstrap-script-div").show();
@@ -236,7 +222,6 @@ function getJob() {
return {
jobName: $("#job-name").val(),
appName: $("#job-app-name").val(),
- jobClass: $("#job-class").val(),
cron: $("#cron").val(),
jobType: $("#job-type").val(),
cpuCount: $("#cpu-count").val(),
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/js/job/jobs_overview.js b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/js/job/jobs_overview.js
index 348ac84..e197ad1 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/js/job/jobs_overview.js
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/main/resources/console/js/job/jobs_overview.js
@@ -208,20 +208,14 @@ function renderJob(job) {
$("#job-type").val(job.jobType);
$("#script-command-line").val(job.scriptCommandLine);
if("SIMPLE" === job.jobType) {
- $("#job-class").attr("value", job.jobClass);
- $("#job-class-model").show();
$("#streaming-process").hide();
$("#streaming-process-box").hide();
$("#bootstrap-script-div").hide();
} else if("DATAFLOW" === job.jobType) {
- $("#job-class").attr("value", job.jobClass);
- $("#job-class-model").show();
$("#streaming-process").show();
$("#streaming-process-box").show();
$("#bootstrap-script-div").hide();
} else if("SCRIPT" === job.jobType) {
- $("#job-class").attr("");
- $("#job-class-model").hide();
$("#streaming-process").hide();
$("#streaming-process-box").hide();
$("#bootstrap-script-div").show();
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationListenerTest.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationListenerTest.java
index 868bf78..c32f46a 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationListenerTest.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationListenerTest.java
@@ -17,11 +17,12 @@
package org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job;
+import org.apache.curator.framework.recipes.cache.ChildData;
+import org.apache.curator.framework.recipes.cache.TreeCacheEvent;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.CloudJsonConstants;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.producer.ProducerManager;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.state.ready.ReadyService;
-import org.apache.curator.framework.recipes.cache.ChildData;
-import org.apache.curator.framework.recipes.cache.TreeCacheEvent;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -55,68 +56,68 @@ public final class CloudJobConfigurationListenerTest {
}
@Test
- public void assertChildEventWhenDataIsNull() throws Exception {
+ public void assertChildEventWhenDataIsNull() {
cloudJobConfigurationListener.childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, null));
- verify(producerManager, times(0)).schedule(ArgumentMatchers.<CloudJobConfiguration>any());
- verify(producerManager, times(0)).reschedule(ArgumentMatchers.<String>any());
- verify(producerManager, times(0)).unschedule(ArgumentMatchers.<String>any());
+ verify(producerManager, times(0)).schedule(ArgumentMatchers.any());
+ verify(producerManager, times(0)).reschedule(ArgumentMatchers.any());
+ verify(producerManager, times(0)).unschedule(ArgumentMatchers.any());
}
@Test
- public void assertChildEventWhenIsNotConfigPath() throws Exception {
+ public void assertChildEventWhenIsNotConfigPath() {
cloudJobConfigurationListener.childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_UPDATED, new ChildData("/other/test_job", null, "".getBytes())));
- verify(producerManager, times(0)).schedule(ArgumentMatchers.<CloudJobConfiguration>any());
- verify(producerManager, times(0)).reschedule(ArgumentMatchers.<String>any());
- verify(producerManager, times(0)).unschedule(ArgumentMatchers.<String>any());
+ verify(producerManager, times(0)).schedule(ArgumentMatchers.any());
+ verify(producerManager, times(0)).reschedule(ArgumentMatchers.any());
+ verify(producerManager, times(0)).unschedule(ArgumentMatchers.any());
}
@Test
- public void assertChildEventWhenIsRootConfigPath() throws Exception {
+ public void assertChildEventWhenIsRootConfigPath() {
cloudJobConfigurationListener.childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_REMOVED, new ChildData("/config/job", null, "".getBytes())));
- verify(producerManager, times(0)).schedule(ArgumentMatchers.<CloudJobConfiguration>any());
- verify(producerManager, times(0)).reschedule(ArgumentMatchers.<String>any());
- verify(producerManager, times(0)).unschedule(ArgumentMatchers.<String>any());
+ verify(producerManager, times(0)).schedule(ArgumentMatchers.any());
+ verify(producerManager, times(0)).reschedule(ArgumentMatchers.any());
+ verify(producerManager, times(0)).unschedule(ArgumentMatchers.any());
}
@Test
- public void assertChildEventWhenStateIsAddAndIsConfigPathAndInvalidData() throws Exception {
+ public void assertChildEventWhenStateIsAddAndIsConfigPathAndInvalidData() {
cloudJobConfigurationListener.childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, new ChildData("/config/job/test_job", null, "".getBytes())));
- verify(producerManager, times(0)).schedule(ArgumentMatchers.<CloudJobConfiguration>any());
- verify(producerManager, times(0)).reschedule(ArgumentMatchers.<String>any());
- verify(producerManager, times(0)).unschedule(ArgumentMatchers.<String>any());
+ verify(producerManager, times(0)).schedule(ArgumentMatchers.any());
+ verify(producerManager, times(0)).reschedule(ArgumentMatchers.any());
+ verify(producerManager, times(0)).unschedule(ArgumentMatchers.any());
}
@Test
- public void assertChildEventWhenStateIsAddAndIsConfigPath() throws Exception {
+ public void assertChildEventWhenStateIsAddAndIsConfigPath() {
cloudJobConfigurationListener.childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, new ChildData("/config/job/test_job", null, CloudJsonConstants.getJobJson().getBytes())));
- verify(producerManager).schedule(ArgumentMatchers.<CloudJobConfiguration>any());
+ verify(producerManager).schedule(ArgumentMatchers.any());
}
@Test
- public void assertChildEventWhenStateIsUpdateAndIsConfigPathAndTransientJob() throws Exception {
+ public void assertChildEventWhenStateIsUpdateAndIsConfigPathAndTransientJob() {
cloudJobConfigurationListener.childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_UPDATED, new ChildData("/config/job/test_job", null, CloudJsonConstants.getJobJson().getBytes())));
verify(readyService, times(0)).remove(Collections.singletonList("test_job"));
- verify(producerManager).reschedule(ArgumentMatchers.<String>any());
+ verify(producerManager).reschedule(ArgumentMatchers.any());
}
@Test
- public void assertChildEventWhenStateIsUpdateAndIsConfigPathAndDaemonJob() throws Exception {
+ public void assertChildEventWhenStateIsUpdateAndIsConfigPathAndDaemonJob() {
cloudJobConfigurationListener.childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_UPDATED,
new ChildData("/config/job/test_job", null, CloudJsonConstants.getJobJson(CloudJobExecutionType.DAEMON).getBytes())));
verify(readyService).remove(Collections.singletonList("test_job"));
- verify(producerManager).reschedule(ArgumentMatchers.<String>any());
+ verify(producerManager).reschedule(ArgumentMatchers.any());
}
@Test
- public void assertChildEventWhenStateIsUpdateAndIsConfigPathAndMisfireDisabled() throws Exception {
+ public void assertChildEventWhenStateIsUpdateAndIsConfigPathAndMisfireDisabled() {
cloudJobConfigurationListener.childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_UPDATED,
new ChildData("/config/job/test_job", null, CloudJsonConstants.getJobJson(false).getBytes())));
verify(readyService).setMisfireDisabled("test_job");
- verify(producerManager).reschedule(ArgumentMatchers.<String>any());
+ verify(producerManager).reschedule(ArgumentMatchers.any());
}
@Test
- public void assertChildEventWhenStateIsRemovedAndIsJobConfigPath() throws Exception {
+ public void assertChildEventWhenStateIsRemovedAndIsJobConfigPath() {
cloudJobConfigurationListener.childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_REMOVED, new ChildData("/config/job/test_job", null, "".getBytes())));
verify(producerManager).unschedule("test_job");
}
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationServiceTest.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationServiceTest.java
index a8b0f68..4d87b91 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationServiceTest.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/config/job/CloudJobConfigurationServiceTest.java
@@ -17,6 +17,7 @@
package org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.CloudJobConfigurationBuilder;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.CloudJsonConstants;
import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
@@ -106,8 +107,6 @@ public final class CloudJobConfigurationServiceTest {
when(regCenter.get("/config/job/test_spring_job")).thenReturn(CloudJsonConstants.getSpringJobJson());
Optional<CloudJobConfiguration> actual = configService.load("test_spring_job");
assertTrue(actual.isPresent());
- assertThat(actual.get().getBeanName(), is("springSimpleJob"));
- assertThat(actual.get().getApplicationContext(), is("applicationContext.xml"));
}
@Test
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/context/JobContextTest.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/context/JobContextTest.java
index 8515697..8b1f7f4 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/context/JobContextTest.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/context/JobContextTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.elasticjob.cloud.scheduler.context;
import org.apache.shardingsphere.elasticjob.infra.context.ExecutionType;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.CloudJobConfigurationBuilder;
import org.junit.Test;
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/fixture/CloudJobConfigurationBuilder.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/fixture/CloudJobConfigurationBuilder.java
index 371e909..804e3af 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/fixture/CloudJobConfigurationBuilder.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/fixture/CloudJobConfigurationBuilder.java
@@ -19,128 +19,126 @@ package org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.elasticjob.cloud.config.JobCoreConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.dataflow.DataflowJobConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.script.ScriptJobConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.config.simple.SimpleJobConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfiguration;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobExecutionType;
-import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
+import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
+import org.apache.shardingsphere.elasticjob.dataflow.props.DataflowJobProperties;
+import org.apache.shardingsphere.elasticjob.script.props.ScriptJobProperties;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class CloudJobConfigurationBuilder {
-
+
/**
* Create cloud job configuration.
+ *
* @param jobName job name
- * @return CloudJobConfiguration
+ * @return cloud job configuration
*/
public static CloudJobConfiguration createCloudJobConfiguration(final String jobName) {
- return new CloudJobConfiguration("test_app",
- new SimpleJobConfiguration(JobCoreConfiguration.newBuilder(jobName, "0/30 * * * * ?", 10).failover(true).misfire(true).build(), TestSimpleJob.class.getCanonicalName()),
- 1.0d, 128.0d, CloudJobExecutionType.TRANSIENT);
+ return new CloudJobConfiguration("test_app",
+ JobConfiguration.newBuilder(jobName, 10).cron("0/30 * * * * ?").failover(true).misfire(true).build(), 1.0d, 128.0d, CloudJobExecutionType.TRANSIENT);
}
-
+
/**
* Create cloud job configuration.
+ *
* @param jobName job name
* @param jobExecutionType execution type
- * @return CloudJobConfiguration
+ * @return cloud job configuration
*/
public static CloudJobConfiguration createCloudJobConfiguration(final String jobName, final CloudJobExecutionType jobExecutionType) {
- return new CloudJobConfiguration("test_app",
- new SimpleJobConfiguration(JobCoreConfiguration.newBuilder(jobName, "0/30 * * * * ?", 10).failover(true).misfire(true).build(), TestSimpleJob.class.getCanonicalName()),
- 1.0d, 128.0d, jobExecutionType);
+ return new CloudJobConfiguration("test_app", JobConfiguration.newBuilder(jobName, 10).cron("0/30 * * * * ?").failover(true).misfire(true).build(), 1.0d, 128.0d, jobExecutionType);
}
-
+
/**
* Create cloud job configuration.
+ *
* @param jobName job name
* @param jobExecutionType execution type
* @param shardingTotalCount sharding total count
- * @return CloudJobConfiguration
+ * @return cloud job configuration
*/
public static CloudJobConfiguration createCloudJobConfiguration(final String jobName, final CloudJobExecutionType jobExecutionType, final int shardingTotalCount) {
- return new CloudJobConfiguration("test_app",
- new SimpleJobConfiguration(JobCoreConfiguration.newBuilder(jobName, "0/30 * * * * ?", shardingTotalCount).failover(true).misfire(true).build(), TestSimpleJob.class.getCanonicalName()),
- 1.0d, 128.0d, jobExecutionType);
+ return new CloudJobConfiguration("test_app",
+ JobConfiguration.newBuilder(jobName, shardingTotalCount).cron("0/30 * * * * ?").failover(true).misfire(true).build(), 1.0d, 128.0d, jobExecutionType);
}
-
+
/**
* Create cloud job configuration.
+ *
* @param jobName job name
* @param misfire misfire
- * @return CloudJobConfiguration
+ * @return cloud job configuration
*/
public static CloudJobConfiguration createCloudJobConfiguration(final String jobName, final boolean misfire) {
- return new CloudJobConfiguration("test_app",
- new SimpleJobConfiguration(JobCoreConfiguration.newBuilder(jobName, "0/30 * * * * ?", 10).failover(true).misfire(misfire).build(), TestSimpleJob.class.getCanonicalName()),
- 1.0d, 128.0d, CloudJobExecutionType.TRANSIENT);
+ return new CloudJobConfiguration("test_app",
+ JobConfiguration.newBuilder(jobName, 10).cron("0/30 * * * * ?").failover(true).misfire(misfire).build(), 1.0d, 128.0d, CloudJobExecutionType.TRANSIENT);
}
-
+
/**
* Create cloud job configuration.
+ *
* @param jobName job name
* @param appName app name
- * @return CloudJobConfiguration
+ * @return cloud job configuration
*/
public static CloudJobConfiguration createCloudJobConfiguration(final String jobName, final String appName) {
- return new CloudJobConfiguration(appName,
- new SimpleJobConfiguration(JobCoreConfiguration.newBuilder(jobName, "0/30 * * * * ?", 10).failover(true).misfire(true).build(), TestSimpleJob.class.getCanonicalName()),
- 1.0d, 128.0d, CloudJobExecutionType.TRANSIENT);
+ return new CloudJobConfiguration(appName, JobConfiguration.newBuilder(jobName, 10).cron("0/30 * * * * ?").failover(true).misfire(true).build(), 1.0d, 128.0d, CloudJobExecutionType.TRANSIENT);
}
-
+
/**
* Create cloud job configuration.
+ *
* @param jobName job name
- * @return CloudJobConfiguration
+ * @return cloud job configuration
*/
public static CloudJobConfiguration createOtherCloudJobConfiguration(final String jobName) {
- return new CloudJobConfiguration("test_app",
- new SimpleJobConfiguration(JobCoreConfiguration.newBuilder(jobName, "0/30 * * * * ?", 3).failover(false).misfire(true).build(), TestSimpleJob.class.getCanonicalName()),
- 1.0d, 128.0d, CloudJobExecutionType.TRANSIENT);
+ return new CloudJobConfiguration(
+ "test_app", JobConfiguration.newBuilder(jobName, 3).cron("0/30 * * * * ?").failover(false).misfire(true).build(), 1.0d, 128.0d, CloudJobExecutionType.TRANSIENT);
}
-
+
/**
* Create cloud job configuration.
+ *
* @param jobName job name
- * @return CloudJobConfiguration
+ * @return cloud job configuration
*/
public static CloudJobConfiguration createCloudSpringJobConfiguration(final String jobName) {
- return new CloudJobConfiguration("test_spring_app",
- new SimpleJobConfiguration(JobCoreConfiguration.newBuilder(jobName, "0/30 * * * * ?", 10).failover(true).misfire(true).build(), TestSimpleJob.class.getCanonicalName()),
- 1.0d, 128.0d, CloudJobExecutionType.TRANSIENT, "springSimpleJob", "applicationContext.xml");
+ return new CloudJobConfiguration("test_spring_app", JobConfiguration.newBuilder(jobName, 10).cron("0/30 * * * * ?").failover(true).misfire(true).build(),
+ 1.0d, 128.0d, CloudJobExecutionType.TRANSIENT);
}
-
+
/**
* Create cloud job configuration.
+ *
* @param jobName job name
- * @return CloudJobConfiguration
+ * @return cloud job configuration
*/
public static CloudJobConfiguration createDataflowCloudJobConfiguration(final String jobName) {
return new CloudJobConfiguration("test_app",
- new DataflowJobConfiguration(JobCoreConfiguration.newBuilder(jobName, "0/30 * * * * ?", 3).failover(false).misfire(false).build(), SimpleJob.class.getCanonicalName(), true),
+ JobConfiguration.newBuilder(jobName, 3).cron("0/30 * * * * ?").failover(false).misfire(false).setProperty(DataflowJobProperties.STREAM_PROCESS_KEY, Boolean.TRUE.toString()).build(),
1.0d, 128.0d, CloudJobExecutionType.TRANSIENT);
}
-
+
/**
* Create cloud job configuration.
+ *
* @param jobName job name
- * @return CloudJobConfiguration
+ * @return cloud job configuration
*/
public static CloudJobConfiguration createScriptCloudJobConfiguration(final String jobName) {
return createScriptCloudJobConfiguration(jobName, 3);
}
-
+
/**
* Create script cloud job configuration.
+ *
* @param jobName job name
* @param shardingTotalCount sharding total count
- * @return CloudJobConfiguration
+ * @return cloud job configuration
*/
public static CloudJobConfiguration createScriptCloudJobConfiguration(final String jobName, final int shardingTotalCount) {
- return new CloudJobConfiguration("test_app",
- new ScriptJobConfiguration(JobCoreConfiguration.newBuilder(jobName, "0/30 * * * * ?", shardingTotalCount).failover(false).misfire(false).build(), "test.sh"),
- 1.0d, 128.0d, CloudJobExecutionType.TRANSIENT);
+ return new CloudJobConfiguration("test_app", JobConfiguration.newBuilder(jobName, shardingTotalCount).cron("0/30 * * * * ?")
+ .failover(false).misfire(false).setProperty(ScriptJobProperties.SCRIPT_KEY, "test.sh").build(), 1.0d, 128.0d, CloudJobExecutionType.TRANSIENT);
}
}
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/fixture/CloudJsonConstants.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/fixture/CloudJsonConstants.java
index 476b943..3b9a3c3 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/fixture/CloudJsonConstants.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/fixture/CloudJsonConstants.java
@@ -19,22 +19,21 @@ package org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobExecutionType;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class CloudJsonConstants {
- private static final String JOB_JSON = "{\"jobName\":\"%s\",\"jobClass\":\"org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.TestSimpleJob\",\"jobType\":\"SIMPLE\","
+ private static final String JOB_JSON = "{\"jobName\":\"%s\","
+ "\"cron\":\"0/30 * * * * ?\",\"shardingTotalCount\":10,\"shardingItemParameters\":\"\",\"jobParameter\":\"\",\"failover\":true,\"misfire\":%s,\"description\":\"\","
+ "\"appName\":\"test_app\",\"cpuCount\":1.0,\"memoryMB\":128.0,"
+ "\"jobExecutionType\":\"%s\"}";
- private static final String SPRING_JOB_JSON = "{\"jobName\":\"test_spring_job\",\"jobClass\":\"org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.TestSimpleJob\",\"jobType\":\"SIMPLE\","
+ private static final String SPRING_JOB_JSON = "{\"jobName\":\"test_spring_job\","
+ "\"cron\":\"0/30 * * * * ?\",\"shardingTotalCount\":10,\"shardingItemParameters\":\"\",\"jobParameter\":\"\",\"failover\":true,\"misfire\":true,\"description\":\"\","
+ "\"appName\":\"test_spring_app\",\"cpuCount\":1.0,\"memoryMB\":128.0,"
- + "\"jobExecutionType\":\"TRANSIENT\",\"beanName\":\"springSimpleJob\","
- + "\"applicationContext\":\"applicationContext.xml\"}";
-
+ + "\"jobExecutionType\":\"TRANSIENT\"}";
+
/**
* Get job in json format.
* @return job in json format
@@ -42,7 +41,7 @@ public final class CloudJsonConstants {
public static String getJobJson() {
return String.format(JOB_JSON, "test_job", true, "TRANSIENT");
}
-
+
/**
* Get job in json format.
* @param jobName job name
@@ -51,7 +50,7 @@ public final class CloudJsonConstants {
public static String getJobJson(final String jobName) {
return String.format(JOB_JSON, jobName, true, "TRANSIENT");
}
-
+
/**
* Get job in json format.
* @param jobExecutionType job execution type
@@ -60,7 +59,7 @@ public final class CloudJsonConstants {
public static String getJobJson(final CloudJobExecutionType jobExecutionType) {
return String.format(JOB_JSON, "test_job", true, jobExecutionType.name());
}
-
+
/**
* Get job in json format.
* @param misfire is misfire
@@ -69,7 +68,7 @@ public final class CloudJsonConstants {
public static String getJobJson(final boolean misfire) {
return String.format(JOB_JSON, "test_job", misfire, "TRANSIENT");
}
-
+
/**
* Get sprint job in json format.
* @return job in json format
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/FacadeServiceTest.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/FacadeServiceTest.java
index 7b03075..4758734 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/FacadeServiceTest.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/FacadeServiceTest.java
@@ -22,9 +22,9 @@ import org.apache.shardingsphere.elasticjob.infra.context.ExecutionType;
import org.apache.shardingsphere.elasticjob.infra.context.TaskContext;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.app.CloudAppConfiguration;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.app.CloudAppConfigurationService;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfigurationService;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobExecutionType;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.context.JobContext;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.CloudAppConfigurationBuilder;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.CloudJobConfigurationBuilder;
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/TaskLaunchScheduledServiceTest.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/TaskLaunchScheduledServiceTest.java
index baa7411..ef82f0d 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/TaskLaunchScheduledServiceTest.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/mesos/TaskLaunchScheduledServiceTest.java
@@ -29,7 +29,7 @@ import com.netflix.fenzo.plugins.VMLeaseObject;
import org.apache.mesos.SchedulerDriver;
import org.apache.shardingsphere.elasticjob.infra.context.ExecutionType;
import org.apache.shardingsphere.elasticjob.infra.context.TaskContext;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobExecutionType;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.context.JobContext;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.CloudAppConfigurationBuilder;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.CloudJobConfigurationBuilder;
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/producer/ProducerManagerTest.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/producer/ProducerManagerTest.java
index 5e35f8e..6d7449f 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/producer/ProducerManagerTest.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/producer/ProducerManagerTest.java
@@ -24,9 +24,9 @@ import org.apache.shardingsphere.elasticjob.infra.context.TaskContext;
import org.apache.shardingsphere.elasticjob.cloud.exception.AppConfigurationException;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.app.CloudAppConfiguration;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.app.CloudAppConfigurationService;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfigurationService;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobExecutionType;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.CloudAppConfigurationBuilder;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.CloudJobConfigurationBuilder;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.state.disable.job.DisableJobService;
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/producer/TransientProducerSchedulerTest.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/producer/TransientProducerSchedulerTest.java
index e344d15..8dcd2d7 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/producer/TransientProducerSchedulerTest.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/producer/TransientProducerSchedulerTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.elasticjob.cloud.scheduler.producer;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.CloudJobConfigurationBuilder;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfiguration;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobConfiguration;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.state.ready.ReadyService;
import org.junit.Before;
import org.junit.Test;
@@ -51,14 +51,14 @@ public final class TransientProducerSchedulerTest {
private final CloudJobConfiguration jobConfig = CloudJobConfigurationBuilder.createCloudJobConfiguration("test_job");
- private final JobDetail jobDetail = JobBuilder.newJob(TransientProducerScheduler.ProducerJob.class).withIdentity(jobConfig.getTypeConfig().getCoreConfig().getCron()).build();
+ private final JobDetail jobDetail = JobBuilder.newJob(TransientProducerScheduler.ProducerJob.class).withIdentity(jobConfig.getJobConfig().getCron()).build();
- private final Trigger trigger = TriggerBuilder.newTrigger().withIdentity(jobConfig.getTypeConfig().getCoreConfig().getCron())
- .withSchedule(CronScheduleBuilder.cronSchedule(jobConfig.getTypeConfig().getCoreConfig().getCron())
+ private final Trigger trigger = TriggerBuilder.newTrigger().withIdentity(jobConfig.getJobConfig().getCron())
+ .withSchedule(CronScheduleBuilder.cronSchedule(jobConfig.getJobConfig().getCron())
.withMisfireHandlingInstructionDoNothing()).build();
@Before
- public void setUp() throws NoSuchFieldException, SchedulerException {
+ public void setUp() throws NoSuchFieldException {
transientProducerScheduler = new TransientProducerScheduler(readyService);
ReflectionUtils.setFieldValue(transientProducerScheduler, "scheduler", scheduler);
}
@@ -74,7 +74,7 @@ public final class TransientProducerSchedulerTest {
@Test
public void assertDeregister() throws SchedulerException {
transientProducerScheduler.deregister(jobConfig);
- verify(scheduler).unscheduleJob(TriggerKey.triggerKey(jobConfig.getTypeConfig().getCoreConfig().getCron()));
+ verify(scheduler).unscheduleJob(TriggerKey.triggerKey(jobConfig.getJobConfig().getCron()));
}
@Test
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/restful/CloudJobRestfulApiTest.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/restful/CloudJobRestfulApiTest.java
index 930b671..622898e 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/restful/CloudJobRestfulApiTest.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/restful/CloudJobRestfulApiTest.java
@@ -18,9 +18,7 @@
package org.apache.shardingsphere.elasticjob.cloud.scheduler.restful;
import com.google.common.collect.Lists;
-import org.apache.shardingsphere.elasticjob.infra.context.ExecutionType;
-import org.apache.shardingsphere.elasticjob.infra.context.TaskContext;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobExecutionType;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.CloudAppJsonConstants;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.CloudJsonConstants;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.TaskNode;
@@ -29,9 +27,10 @@ import org.apache.shardingsphere.elasticjob.cloud.scheduler.restful.search.JobEv
import org.apache.shardingsphere.elasticjob.cloud.scheduler.state.failover.FailoverTaskInfo;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.state.running.RunningService;
import org.apache.shardingsphere.elasticjob.cloud.statistics.type.job.JobExecutionTypeStatistics;
-import org.apache.shardingsphere.elasticjob.cloud.statistics.type.job.JobTypeStatistics;
import org.apache.shardingsphere.elasticjob.cloud.statistics.type.task.TaskResultStatistics;
import org.apache.shardingsphere.elasticjob.cloud.util.json.GsonFactory;
+import org.apache.shardingsphere.elasticjob.infra.context.ExecutionType;
+import org.apache.shardingsphere.elasticjob.infra.context.TaskContext;
import org.apache.shardingsphere.elasticjob.tracing.event.JobExecutionEvent;
import org.apache.shardingsphere.elasticjob.tracing.event.JobStatusTraceEvent;
import org.junit.Test;
@@ -254,15 +253,6 @@ public final class CloudJobRestfulApiTest extends AbstractCloudRestfulApiTest {
}
@Test
- public void assertGetJobTypeStatistics() throws Exception {
- String result = RestfulTestsUtil.sentGetRequest("http://127.0.0.1:19000/api/job/statistics/jobs/type");
- JobTypeStatistics jobTypeStatistics = GsonFactory.getGson().fromJson(result, JobTypeStatistics.class);
- assertThat(jobTypeStatistics.getSimpleJobCount(), is(0));
- assertThat(jobTypeStatistics.getDataflowJobCount(), is(0));
- assertThat(jobTypeStatistics.getScriptJobCount(), is(0));
- }
-
- @Test
public void assertGetJobExecutionTypeStatistics() throws Exception {
String result = RestfulTestsUtil.sentGetRequest("http://127.0.0.1:19000/api/job/statistics/jobs/executionType");
JobExecutionTypeStatistics jobExecutionTypeStatistics = GsonFactory.getGson().fromJson(result, JobExecutionTypeStatistics.class);
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/ready/ReadyServiceTest.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/ready/ReadyServiceTest.java
index e528007..c81aa76 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/ready/ReadyServiceTest.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/ready/ReadyServiceTest.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.elasticjob.cloud.scheduler.state.ready;
import com.google.common.collect.Lists;
import org.apache.shardingsphere.elasticjob.infra.context.ExecutionType;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfigurationService;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobExecutionType;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.context.JobContext;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.env.BootstrapEnvironment;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.CloudJobConfigurationBuilder;
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/running/RunningServiceTest.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/running/RunningServiceTest.java
index 5f9b60a..b4c6fb8 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/running/RunningServiceTest.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/state/running/RunningServiceTest.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.elasticjob.cloud.scheduler.state.running;
import org.apache.shardingsphere.elasticjob.infra.context.ExecutionType;
import org.apache.shardingsphere.elasticjob.infra.context.TaskContext;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobExecutionType;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.CloudJsonConstants;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.TaskNode;
import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
diff --git a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/statistics/StatisticManagerTest.java b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/statistics/StatisticManagerTest.java
index f512e6d..c77331a 100755
--- a/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/statistics/StatisticManagerTest.java
+++ b/elasticjob-cloud/elasticjob-cloud-scheduler/src/test/java/org/apache/shardingsphere/elasticjob/cloud/scheduler/statistics/StatisticManagerTest.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.elasticjob.cloud.scheduler.statistics;
import com.google.common.collect.Lists;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobConfigurationService;
-import org.apache.shardingsphere.elasticjob.cloud.scheduler.config.job.CloudJobExecutionType;
+import org.apache.shardingsphere.elasticjob.cloud.config.CloudJobExecutionType;
import org.apache.shardingsphere.elasticjob.cloud.scheduler.fixture.CloudJobConfigurationBuilder;
import org.apache.shardingsphere.elasticjob.cloud.statistics.StatisticInterval;
import org.apache.shardingsphere.elasticjob.cloud.statistics.rdb.StatisticRdbRepository;
@@ -130,19 +130,6 @@ public final class StatisticManagerTest {
}
@Test
- public void assertJobTypeStatistics() throws NoSuchFieldException {
- ReflectionUtils.setFieldValue(statisticManager, "configurationService", configurationService);
- when(configurationService.loadAll()).thenReturn(Lists.newArrayList(
- CloudJobConfigurationBuilder.createCloudJobConfiguration("test_job_simple"),
- CloudJobConfigurationBuilder.createDataflowCloudJobConfiguration("test_job_dataflow"),
- CloudJobConfigurationBuilder.createScriptCloudJobConfiguration("test_job_script")));
- assertThat(statisticManager.getJobTypeStatistics().getSimpleJobCount(), is(1));
- assertThat(statisticManager.getJobTypeStatistics().getDataflowJobCount(), is(1));
- assertThat(statisticManager.getJobTypeStatistics().getScriptJobCount(), is(1));
- verify(configurationService, times(3)).loadAll();
- }
-
- @Test
public void assertJobExecutionTypeStatistics() throws NoSuchFieldException {
ReflectionUtils.setFieldValue(statisticManager, "configurationService", configurationService);
when(configurationService.loadAll()).thenReturn(Lists.newArrayList(
diff --git a/elasticjob-lite/elasticjob-lite-console/src/main/resources/console/i18n/message_en.properties b/elasticjob-lite/elasticjob-lite-console/src/main/resources/console/i18n/message_en.properties
index f1437e3..0c2d7a6 100644
--- a/elasticjob-lite/elasticjob-lite-console/src/main/resources/console/i18n/message_en.properties
+++ b/elasticjob-lite/elasticjob-lite-console/src/main/resources/console/i18n/message_en.properties
@@ -83,7 +83,6 @@ job-detail=Job detail
update-job=Update job
job-name=Job name
job-shardings-detail=Job shardings detail
-job-class=Job class
job-parameter=Job parameter
job-sharding-strategy-type=Job sharding strategy type
job-error-handler-type=Job error handler
diff --git a/elasticjob-lite/elasticjob-lite-console/src/main/resources/console/i18n/message_zh.properties b/elasticjob-lite/elasticjob-lite-console/src/main/resources/console/i18n/message_zh.properties
index bfaddec..964d881 100644
--- a/elasticjob-lite/elasticjob-lite-console/src/main/resources/console/i18n/message_zh.properties
+++ b/elasticjob-lite/elasticjob-lite-console/src/main/resources/console/i18n/message_zh.properties
@@ -83,7 +83,6 @@ job-detail=分片状态
update-job=修改作业
job-name=作业名称
job-shardings-detail=作业分片详情
-job-class=作业实现类
job-parameter=自定义参数
job-sharding-strategy-type=作业分片策略类型
job-error-handler-type=定制异常处理类全路径
diff --git a/examples/elasticjob-example-cloud/src/README.txt b/examples/elasticjob-example-cloud/src/README.txt
index aff020f..51d5df2 100755
--- a/examples/elasticjob-example-cloud/src/README.txt
+++ b/examples/elasticjob-example-cloud/src/README.txt
@@ -13,10 +13,10 @@ curl -l -H "Content-type: application/json" -X POST -d '{"appName":"foo_app","ap
b. 注册作业
注册的作业可用Java和Spring两种启动方式,作业启动在开发指南中有说明,这里只举例说明两种方式如何注册。
1. Java启动方式作业注册
-curl -l -H "Content-type: application/json" -X POST -d '{"jobName":"foo_job","jobClass":"yourJobClass","jobType":"SIMPLE","jobExecutionType":"TRANSIENT","cron":"0/5 * * * * ?","shardingTotalCount":5,"cpuCount":0.1,"memoryMB":64.0,"appName":"foo_app","failover":true,"misfire":true}' http://elastic_job_cloud_host:8899/api/job/register
+curl -l -H "Content-type: application/json" -X POST -d '{"jobName":"foo_job","jobClass":"yourJobClass","jobExecutionType":"TRANSIENT","cron":"0/5 * * * * ?","shardingTotalCount":5,"cpuCount":0.1,"memoryMB":64.0,"appName":"foo_app","failover":true,"misfire":true}' http://elastic_job_cloud_host:8899/api/job/register
2. Spring启动方式作业注册
-curl -l -H "Content-type: application/json" -X POST -d '{"jobName":"foo_job","beanName":"yourBeanName","applicationContext":"applicationContext.xml","jobType":"SIMPLE","jobExecutionType":"TRANSIENT","cron":"0/5 * * * * ?","shardingTotalCount":5,"cpuCount":0.1,"memoryMB":64.0,"appName":"foo_app","failover":true,"misfire":true}' http://elastic_job_cloud_host:8899/api/job/register
+curl -l -H "Content-type: application/json" -X POST -d '{"jobName":"foo_job","beanName":"yourBeanName","applicationContext":"applicationContext.xml","jobExecutionType":"TRANSIENT","cron":"0/5 * * * * ?","shardingTotalCount":5,"cpuCount":0.1,"memoryMB":64.0,"appName":"foo_app","failover":true,"misfire":true}' http://elastic_job_cloud_host:8899/api/job/register
参数详细配置请见:http://elasticjob.io/elastic-job/elastic-job-cloud/02-guide/cloud-restful-api/
@@ -28,14 +28,14 @@ curl -l -H "Content-type: application/json" -X POST -d '{"appName":"exampleApp",
2. Java启动方式作业注册:
-curl -l -H "Content-type: application/json" -X POST -d '{"jobName":"test_job_simple","appName":"exampleApp","jobType":"SIMPLE","jobExecutionType":"TRANSIENT","jobClass":"com.dangdang.ddframe.job.example.job.simple.JavaSimpleJob","cron":"0/10 * * * * ?","shardingTotalCount":1,"cpuCount":0.1,"memoryMB":64.0}' http://localhost:8899/api/job/register
+curl -l -H "Content-type: application/json" -X POST -d '{"jobName":"test_job_simple","appName":"exampleApp","jobExecutionType":"TRANSIENT","jobClass":"com.dangdang.ddframe.job.example.job.simple.JavaSimpleJob","cron":"0/10 * * * * ?","shardingTotalCount":1,"cpuCount":0.1,"memoryMB":64.0}' http://localhost:8899/api/job/register
-curl -l -H "Content-type: application/json" -X POST -d '{"jobName":"test_job_dataflow","appName":"exampleApp","jobType":"DATAFLOW","jobExecutionType":"DAEMON","jobClass":"com.dangdang.ddframe.job.example.job.dataflow.JavaDataflowJob","cron":"0/10 * * * * ?","shardingTotalCount":3,"cpuCount":0.1,"memoryMB":64.0}' http://localhost:8899/api/job/register
+curl -l -H "Content-type: application/json" -X POST -d '{"jobName":"test_job_dataflow","appName":"exampleApp","jobExecutionType":"DAEMON","jobClass":"com.dangdang.ddframe.job.example.job.dataflow.JavaDataflowJob","cron":"0/10 * * * * ?","shardingTotalCount":3,"cpuCount":0.1,"memoryMB":64.0}' http://localhost:8899/api/job/register
-curl -l -H "Content-type: application/json" -X POST -d '{"jobName":"test_job_script","appName":"exampleApp","jobType":"SCRIPT","jobExecutionType":"TRANSIENT","cron":"0/10 * * * * ?","shardingTotalCount":3,"cpuCount":0.1,"memoryMB":64.0, scriptCommandLine="script/demo.sh"}' http://localhost:8899/api/job/register
+curl -l -H "Content-type: application/json" -X POST -d '{"jobName":"test_job_script","appName":"exampleApp","jobExecutionType":"TRANSIENT","cron":"0/10 * * * * ?","shardingTotalCount":3,"cpuCount":0.1,"memoryMB":64.0, scriptCommandLine="script/demo.sh"}' http://localhost:8899/api/job/register
3. Spring启动方式作业注册:
-curl -l -H "Content-type: application/json" -X POST -d '{"jobName":"test_job_simple_spring","appName":"exampleApp","jobType":"SIMPLE","jobExecutionType":"TRANSIENT","jobClass":"com.dangdang.ddframe.job.example.job.simple.SpringSimpleJob","beanName":"springSimpleJob","applicationContext":"classpath:META-INF/applicationContext.xml","cron":"0/10 * * * * ?","shardingTotalCount":1,"cpuCount":0.1,"memoryMB":64.0}' http://localhost:8899/api/job/register
+curl -l -H "Content-type: application/json" -X POST -d '{"jobName":"test_job_simple_spring","appName":"exampleApp","jobExecutionType":"TRANSIENT","jobClass":"com.dangdang.ddframe.job.example.job.simple.SpringSimpleJob","beanName":"springSimpleJob","applicationContext":"classpath:META-INF/applicationContext.xml","cron":"0/10 * * * * ?","shardingTotalCount":1,"cpuCount":0.1,"memoryMB":64.0}' http://localhost:8899/api/job/register
-curl -l -H "Content-type: application/json" -X POST -d '{"jobName":"test_job_dataflow_spring","appName":"exampleApp","jobType":"DATAFLOW","jobExecutionType":"DAEMON","jobClass":"com.dangdang.ddframe.job.example.job.dataflow.SpringDataflowJob","beanName":"springDataflowJob","applicationContext":"classpath:META-INF/applicationContext.xml","cron":"0/10 * * * * ?","shardingTotalCount":3,"cpuCount":0.1,"memoryMB":64.0}' http://localhost:8899/api/job/register
+curl -l -H "Content-type: application/json" -X POST -d '{"jobName":"test_job_dataflow_spring","appName":"exampleApp","jobExecutionType":"DAEMON","jobClass":"com.dangdang.ddframe.job.example.job.dataflow.SpringDataflowJob","beanName":"springDataflowJob","applicationContext":"classpath:META-INF/applicationContext.xml","cron":"0/10 * * * * ?","shardingTotalCount":3,"cpuCount":0.1,"memoryMB":64.0}' http://localhost:8899/api/job/register
diff --git a/examples/elasticjob-example-cloud/src/main/java/com/dangdang/ddframe/job/example/CloudJobMain.java b/examples/elasticjob-example-cloud/src/main/java/com/dangdang/ddframe/job/example/CloudJobMain.java
index 4f1afcd..c014783 100755
--- a/examples/elasticjob-example-cloud/src/main/java/com/dangdang/ddframe/job/example/CloudJobMain.java
+++ b/examples/elasticjob-example-cloud/src/main/java/com/dangdang/ddframe/job/example/CloudJobMain.java
@@ -24,6 +24,6 @@ public final class CloudJobMain {
// CHECKSTYLE:OFF
public static void main(final String[] args) {
// CHECKSTYLE:ON
- JobBootstrap.execute();
+ JobBootstrap.execute("SCRIPT");
}
}