From fbc066ec3e135088ea704b88440ded6b69510fbb Mon Sep 17 00:00:00 2001 From: zhangliang Date: Wed, 25 Oct 2023 21:34:54 +0800 Subject: [PATCH] Move BlockUtils to kernel module --- .../executor/context/ExecutorContext.java | 3 --- kernel/pom.xml | 6 +----- ...bstractDistributeOnceElasticJobListener.java | 2 +- .../kernel/internal/election/LeaderService.java | 2 +- .../kernel/internal/server/ServerService.java | 2 +- .../internal/sharding/ShardingService.java | 2 +- .../kernel/internal/util}/BlockUtils.java | 17 +++++------------ 7 files changed, 10 insertions(+), 24 deletions(-) rename {infra/src/main/java/org/apache/shardingsphere/elasticjob/infra/concurrent => kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/util}/BlockUtils.java (77%) diff --git a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/context/ExecutorContext.java b/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/context/ExecutorContext.java index b43c77a678..858ff744e5 100644 --- a/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/context/ExecutorContext.java +++ b/ecosystem/executor/kernel/src/main/java/org/apache/shardingsphere/elasticjob/executor/context/ExecutorContext.java @@ -27,9 +27,6 @@ /** * Executor context. - * - * @see org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandlerReloadable - * @see org.apache.shardingsphere.elasticjob.infra.concurrent.ExecutorServiceReloadable */ public final class ExecutorContext { diff --git a/kernel/pom.xml b/kernel/pom.xml index 1bf670c004..3c9238bc99 100644 --- a/kernel/pom.xml +++ b/kernel/pom.xml @@ -37,11 +37,7 @@ elasticjob-infra ${project.parent.version} - - org.apache.shardingsphere.elasticjob - elasticjob-registry-center-api - ${project.parent.version} - + org.apache.shardingsphere.elasticjob elasticjob-registry-center-zookeeper-curator diff --git a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/api/listener/AbstractDistributeOnceElasticJobListener.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/api/listener/AbstractDistributeOnceElasticJobListener.java index 8a5970491d..33477e7127 100644 --- a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/api/listener/AbstractDistributeOnceElasticJobListener.java +++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/api/listener/AbstractDistributeOnceElasticJobListener.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.elasticjob.kernel.api.listener; import lombok.Setter; -import org.apache.shardingsphere.elasticjob.infra.concurrent.BlockUtils; +import org.apache.shardingsphere.elasticjob.kernel.internal.util.BlockUtils; import org.apache.shardingsphere.elasticjob.infra.env.TimeService; import org.apache.shardingsphere.elasticjob.infra.exception.JobSystemException; import org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener; diff --git a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/election/LeaderService.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/election/LeaderService.java index 628d99cbf6..ed94156856 100644 --- a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/election/LeaderService.java +++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/election/LeaderService.java @@ -24,7 +24,7 @@ import org.apache.shardingsphere.elasticjob.kernel.internal.storage.JobNodeStorage; import org.apache.shardingsphere.elasticjob.reg.base.LeaderExecutionCallback; import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter; -import org.apache.shardingsphere.elasticjob.infra.concurrent.BlockUtils; +import org.apache.shardingsphere.elasticjob.kernel.internal.util.BlockUtils; /** * Leader service. diff --git a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/server/ServerService.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/server/ServerService.java index 9aba51c8f6..1a16d34346 100644 --- a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/server/ServerService.java +++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/server/ServerService.java @@ -19,7 +19,7 @@ import com.google.common.base.Strings; import org.apache.commons.lang3.StringUtils; -import org.apache.shardingsphere.elasticjob.infra.concurrent.BlockUtils; +import org.apache.shardingsphere.elasticjob.kernel.internal.util.BlockUtils; import org.apache.shardingsphere.elasticjob.kernel.internal.instance.InstanceNode; import org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobRegistry; import org.apache.shardingsphere.elasticjob.kernel.internal.storage.JobNodeStorage; diff --git a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/sharding/ShardingService.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/sharding/ShardingService.java index ca46e01522..789f86dfa5 100644 --- a/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/sharding/ShardingService.java +++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/sharding/ShardingService.java @@ -19,7 +19,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.shardingsphere.elasticjob.api.JobConfiguration; -import org.apache.shardingsphere.elasticjob.infra.concurrent.BlockUtils; +import org.apache.shardingsphere.elasticjob.kernel.internal.util.BlockUtils; import org.apache.shardingsphere.elasticjob.infra.handler.sharding.JobInstance; import org.apache.shardingsphere.elasticjob.infra.handler.sharding.JobShardingStrategy; import org.apache.shardingsphere.elasticjob.infra.yaml.YamlEngine; diff --git a/infra/src/main/java/org/apache/shardingsphere/elasticjob/infra/concurrent/BlockUtils.java b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/util/BlockUtils.java similarity index 77% rename from infra/src/main/java/org/apache/shardingsphere/elasticjob/infra/concurrent/BlockUtils.java rename to kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/util/BlockUtils.java index 25f3139b2d..43c01e2090 100644 --- a/infra/src/main/java/org/apache/shardingsphere/elasticjob/infra/concurrent/BlockUtils.java +++ b/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/util/BlockUtils.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.elasticjob.infra.concurrent; +package org.apache.shardingsphere.elasticjob.kernel.internal.util; import lombok.AccessLevel; import lombok.NoArgsConstructor; @@ -26,21 +26,14 @@ @NoArgsConstructor(access = AccessLevel.PRIVATE) public final class BlockUtils { - /** - * Wait short time. - */ - public static void waitingShortTime() { - sleep(100L); - } + private static final long SLEEP_INTERVAL_MILLIS = 100L; /** - * Sleep for the specified number of milliseconds. - * - * @param millis the duration of sleep in milliseconds + * Waiting short time. */ - public static void sleep(final long millis) { + public static void waitingShortTime() { try { - Thread.sleep(millis); + Thread.sleep(SLEEP_INTERVAL_MILLIS); } catch (final InterruptedException ex) { Thread.currentThread().interrupt(); }