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

duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 45d125408df Remove schedule module (#24956)
45d125408df is described below

commit 45d125408dfe69d5f9da401cda4635fc16c2ca19
Author: zhaojinchao <[email protected]>
AuthorDate: Mon Apr 3 10:10:20 2023 +0800

    Remove schedule module (#24956)
---
 .../shardingsphere/infra/schedule/CronJob.java     |  35 -------
 .../infra/schedule/ScheduleContext.java            |  38 --------
 kernel/pom.xml                                     |   1 -
 kernel/schedule/core/pom.xml                       |  52 ----------
 .../schedule/core/ScheduleContextFactory.java      |  46 ---------
 .../core/context/ClusterScheduleContext.java       | 105 ---------------------
 .../core/context/StandaloneScheduleContext.java    |  37 --------
 .../schedule/core/model/JobParameter.java          |  24 -----
 kernel/schedule/pom.xml                            |  34 -------
 9 files changed, 372 deletions(-)

diff --git 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/schedule/CronJob.java
 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/schedule/CronJob.java
deleted file mode 100644
index 04c0089687f..00000000000
--- 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/schedule/CronJob.java
+++ /dev/null
@@ -1,35 +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.infra.schedule;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-import java.util.function.Consumer;
-
-@RequiredArgsConstructor
-@Getter
-public final class CronJob {
-    
-    private final String jobName;
-    
-    @SuppressWarnings("rawtypes")
-    private final Consumer job;
-    
-    private final String cron;
-}
diff --git 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/schedule/ScheduleContext.java
 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/schedule/ScheduleContext.java
deleted file mode 100644
index 4f6e96cb2a8..00000000000
--- 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/schedule/ScheduleContext.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.infra.schedule;
-
-/**
- * Schedule Strategy.
- */
-public interface ScheduleContext {
-    
-    /**
-     * Start schedule.
-     *
-     * @param job cron job
-     */
-    void startSchedule(CronJob job);
-    
-    /**
-     * close schedule.
-     *
-     * @param jobName job name
-     */
-    void closeSchedule(String jobName);
-}
diff --git a/kernel/pom.xml b/kernel/pom.xml
index aca584edeb7..48563d3ed17 100644
--- a/kernel/pom.xml
+++ b/kernel/pom.xml
@@ -34,7 +34,6 @@
         <module>authority</module>
         <module>transaction</module>
         <module>time-service</module>
-        <module>schedule</module>
         <module>data-pipeline</module>
         <module>sql-federation</module>
         <module>sql-translator</module>
diff --git a/kernel/schedule/core/pom.xml b/kernel/schedule/core/pom.xml
deleted file mode 100644
index ff05347fd0b..00000000000
--- a/kernel/schedule/core/pom.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ 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.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-schedule</artifactId>
-        <version>5.3.3-SNAPSHOT</version>
-    </parent>
-    <artifactId>shardingsphere-schedule-core</artifactId>
-    <name>${project.artifactId}</name>
-    
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-infra-common</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        
-        <dependency>
-            <groupId>org.apache.shardingsphere.elasticjob</groupId>
-            <artifactId>elasticjob-lite-core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.shardingsphere.elasticjob</groupId>
-            <artifactId>elasticjob-lite-lifecycle</artifactId>
-        </dependency>
-        
-        <dependency>
-            <groupId>com.zaxxer</groupId>
-            <artifactId>HikariCP</artifactId>
-            <scope>compile</scope>
-        </dependency>
-    </dependencies>
-</project>
diff --git 
a/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/ScheduleContextFactory.java
 
b/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/ScheduleContextFactory.java
deleted file mode 100644
index cb4ccb1c17f..00000000000
--- 
a/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/ScheduleContextFactory.java
+++ /dev/null
@@ -1,46 +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.schedule.core;
-
-import lombok.AccessLevel;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
-import org.apache.shardingsphere.infra.schedule.ScheduleContext;
-import org.apache.shardingsphere.schedule.core.context.ClusterScheduleContext;
-import 
org.apache.shardingsphere.schedule.core.context.StandaloneScheduleContext;
-
-/**
- * Schedule context factory.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-@Getter
-public final class ScheduleContextFactory {
-    
-    /**
-     * Create new instance of schedule context.
-     *
-     * @param modeConfig mode configuration
-     * @return Schedule context instance
-     */
-    public static ScheduleContext newInstance(final ModeConfiguration 
modeConfig) {
-        return "Cluster".equals(modeConfig.getType()) && 
"ZooKeeper".equals(modeConfig.getRepository().getType())
-                ? new 
ClusterScheduleContext(modeConfig.getRepository().getProps().getProperty("server-lists"),
 modeConfig.getRepository().getProps().getProperty("namespace"))
-                : new StandaloneScheduleContext();
-    }
-}
diff --git 
a/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/context/ClusterScheduleContext.java
 
b/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/context/ClusterScheduleContext.java
deleted file mode 100644
index 374fa99403b..00000000000
--- 
a/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/context/ClusterScheduleContext.java
+++ /dev/null
@@ -1,105 +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.schedule.core.context;
-
-import com.google.common.base.Preconditions;
-import lombok.RequiredArgsConstructor;
-import lombok.SneakyThrows;
-import org.apache.commons.lang3.concurrent.ConcurrentException;
-import org.apache.commons.lang3.concurrent.LazyInitializer;
-import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
-import org.apache.shardingsphere.elasticjob.api.ShardingContext;
-import 
org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap;
-import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
-import 
org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperConfiguration;
-import 
org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter;
-import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
-import org.apache.shardingsphere.infra.schedule.CronJob;
-import org.apache.shardingsphere.infra.schedule.ScheduleContext;
-import org.apache.shardingsphere.schedule.core.model.JobParameter;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-import java.util.function.Consumer;
-
-/**
- * Cluster schedule context.
- */
-@RequiredArgsConstructor
-public final class ClusterScheduleContext implements ScheduleContext {
-    
-    private static final Map<String, ScheduleJobBootstrap> 
SCHEDULE_JOB_BOOTSTRAP_MAP = new HashMap<>();
-    
-    private final String serverList;
-    
-    private final String namespace;
-    
-    private final LazyInitializer<CoordinatorRegistryCenter> 
registryCenterLazyInitializer = new 
LazyInitializer<CoordinatorRegistryCenter>() {
-        
-        @Override
-        protected CoordinatorRegistryCenter initialize() {
-            return initRegisterCenter();
-        }
-    };
-    
-    /**
-     * Start schedule.
-     *
-     * @param job cron job
-     */
-    @SuppressWarnings("unchecked")
-    public void startSchedule(final CronJob job) {
-        CoordinatorRegistryCenter registryCenter = getRegistryCenter();
-        Preconditions.checkNotNull(registryCenter, "Coordinator registry 
center failed to initialize.");
-        if (null != SCHEDULE_JOB_BOOTSTRAP_MAP.get(job.getJobName())) {
-            SCHEDULE_JOB_BOOTSTRAP_MAP.get(job.getJobName()).shutdown();
-        }
-        JobConfiguration jobConfig = 
JobConfiguration.newBuilder(job.getJobName(), 
1).cron(job.getCron()).overwrite(true).build();
-        ScheduleJobBootstrap bootstrap = new 
ScheduleJobBootstrap(registryCenter, new ConsumerSimpleJob(job.getJob()), 
jobConfig);
-        SCHEDULE_JOB_BOOTSTRAP_MAP.put(job.getJobName(), bootstrap);
-        SCHEDULE_JOB_BOOTSTRAP_MAP.get(job.getJobName()).schedule();
-    }
-    
-    @Override
-    public void closeSchedule(final String jobName) {
-        
Optional.ofNullable(SCHEDULE_JOB_BOOTSTRAP_MAP.remove(jobName)).ifPresent(ScheduleJobBootstrap::shutdown);
-    }
-    
-    @SneakyThrows(ConcurrentException.class)
-    private CoordinatorRegistryCenter getRegistryCenter() {
-        return registryCenterLazyInitializer.get();
-    }
-    
-    private CoordinatorRegistryCenter initRegisterCenter() {
-        CoordinatorRegistryCenter result = new ZookeeperRegistryCenter(new 
ZookeeperConfiguration(serverList, namespace));
-        result.init();
-        return result;
-    }
-    
-    @RequiredArgsConstructor
-    private static final class ConsumerSimpleJob implements SimpleJob {
-        
-        private final Consumer<JobParameter> job;
-        
-        @Override
-        public void execute(final ShardingContext shardingContext) {
-            job.accept(new JobParameter());
-        }
-    }
-}
diff --git 
a/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/context/StandaloneScheduleContext.java
 
b/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/context/StandaloneScheduleContext.java
deleted file mode 100644
index ca0a213691c..00000000000
--- 
a/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/context/StandaloneScheduleContext.java
+++ /dev/null
@@ -1,37 +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.schedule.core.context;
-
-import org.apache.shardingsphere.infra.schedule.CronJob;
-import org.apache.shardingsphere.infra.schedule.ScheduleContext;
-
-/**
- * Standalone schedule context.
- */
-public final class StandaloneScheduleContext implements ScheduleContext {
-    
-    @Override
-    public void startSchedule(final CronJob job) {
-        // TODO
-    }
-    
-    @Override
-    public void closeSchedule(final String jobName) {
-        // TODO
-    }
-}
diff --git 
a/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/model/JobParameter.java
 
b/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/model/JobParameter.java
deleted file mode 100644
index 7b0808ab186..00000000000
--- 
a/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/model/JobParameter.java
+++ /dev/null
@@ -1,24 +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.schedule.core.model;
-
-/**
- * Schedule job parameter.
- */
-public final class JobParameter {
-}
diff --git a/kernel/schedule/pom.xml b/kernel/schedule/pom.xml
deleted file mode 100644
index 8d05ff51649..00000000000
--- a/kernel/schedule/pom.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ 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.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-kernel</artifactId>
-        <version>5.3.3-SNAPSHOT</version>
-    </parent>
-    <artifactId>shardingsphere-schedule</artifactId>
-    <packaging>pom</packaging>
-    <name>${project.artifactId}</name>
-    
-    <modules>
-        <module>core</module>
-    </modules>
-</project>

Reply via email to